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

Add the ability to draw hypergraphs as a bipartite graph #492

Closed nwlandry closed 5 months ago

nwlandry commented 11 months ago

This PR does the following:

codecov[bot] commented 11 months ago

Codecov Report

Attention: Patch coverage is 91.12426% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 92.29%. Comparing base (0f9be8d) to head (730bd74).

Files Patch % Lines
xgi/drawing/draw.py 91.33% 13 Missing :warning:
xgi/drawing/layout.py 88.88% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #492 +/- ## ========================================== + Coverage 92.16% 92.29% +0.13% ========================================== Files 60 60 Lines 4418 4493 +75 ========================================== + Hits 4072 4147 +75 Misses 346 346 ```

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

maximelucas commented 11 months ago

Just a thought: conceptually, could this function just be the same as the draw_dihypergraph with the edge markers, except that the links are drawn without arrows and the layout would be different?

nwlandry commented 11 months ago

Mmmmm. This is a great point. I think you're right. Would it make sense to group them together, call it draw_bipartite and have different handling for directed and undirected hypergraphs?

maximelucas commented 11 months ago

I thought that could be a possibility. Worth thinking about. The current dihypergraph one only make sense as a bipartite if the edge markers are drawn though, I'd say.

Maybe directedness and "bipartite-ness" are two somewhat independent elements here. Could the arrow drawing be included as a directed option in draw_hyperedges? Not sure that would include the edge markers.

And then the draw_bipartite could just be about the layout really. Either the current layout we have in the dihypergraph one, or a more bipartitey layout, the user could choose. And draw directed or undirected edges.

nwlandry commented 7 months ago

I thought that could be a possibility. Worth thinking about. The current dihypergraph one only make sense as a bipartite if the edge markers are drawn though, I'd say.

Maybe directedness and "bipartite-ness" are two somewhat independent elements here. Could the arrow drawing be included as a directed option in draw_hyperedges? Not sure that would include the edge markers.

And then the draw_bipartite could just be about the layout really. Either the current layout we have in the dihypergraph one, or a more bipartitey layout, the user could choose. And draw directed or undirected edges.

I have refactored the function so that it accepts both directed and undirected hypergraphs. Because of this, draw_dihypergraph is now unnecessary and so I removed it.

review-notebook-app[bot] commented 7 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

nwlandry commented 7 months ago

I have now implemented all of your suggestions, @maximelucas. Should be ready to re-review.

nwlandry commented 7 months ago

Thanks for the suggestions, @maximelucas! It looks like I need to take more time to address these concerns, and I'll let you know when I'm done!

nwlandry commented 7 months ago

@maximelucas, I believe I addressed all of your comments! Thanks for such a thorough and helpful review! I did the following:

maximelucas commented 6 months ago

Thanks! Those are quick small comments for the last changes, I'll have a better look at the entire code soon.

nwlandry commented 6 months ago

@maximelucas, are you still able to review this? Thanks so much!

maximelucas commented 6 months ago

I'll do that next week!

nwlandry commented 5 months ago

Great! Thanks so much!

maximelucas commented 5 months ago

Some more minor comments.. we're almost there, it's a lot of code 😄 I'll check the rest of the code later today.

nwlandry commented 5 months ago

@maximelucas thanks so much! Let me know when you're done and I'll start addressing your comments!

maximelucas commented 5 months ago

I think I checked all of it 😛 I would just add an example somewhere of an undirected one, and raise an issue to create a new function with the "classic" graph bipartite layout, and maybe also with the barycenter layout. Thanks for all the work!

nwlandry commented 5 months ago

@maximelucas, thanks for the review! A quick overview of my changes based on your comments:

At this point, I believe that I've addressed all your comments. Let me know if there are other things you would like me to change.

maximelucas commented 5 months ago

Looks good, thanks so much for the work!