xgi-org / xgi

CompleX Group Interactions (XGI) is a Python package for higher-order networks.
https://xgi.readthedocs.io
Other
180 stars 28 forks source link

feat: hypergraph random edge shuffle #531

Closed doabell closed 6 months ago

doabell commented 6 months ago

This PR implements random_edge_shuffle for hypergraphs, as described in Configuration models of random hypergraphs, Philip S C., 2020.

Given two edges, the existing double_edge_swap swaps two nodes, whereas random_edge_shuffle puts all nodes in a bucket and shuffles them. This preserves the edge sizes and node degrees. If the same node appears in both hyperedges, then this is still true after reshuffling.

The user can also use this to shuffle two randomly selected hyperedges, if no edge IDs are specified.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.16%. Comparing base (b717e4b) to head (a286f66).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #531 +/- ## ========================================== + Coverage 92.12% 92.16% +0.04% ========================================== Files 60 60 Lines 4393 4417 +24 ========================================== + Hits 4047 4071 +24 Misses 346 346 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

doabell commented 6 months ago

Resolved these comments, could you take another look? Thanks.

nwlandry commented 6 months ago

Looks great! Thanks so much! Merging now.