-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support DiHypergraph in from_bipartite_graph #633
Conversation
@colltoaction --- thanks so much for the contribution! My biggest question is whether the default should be to read/write from a DiGraph. I think that what you've implemented makes sense as well --- maybe we could handle this with a kwarg or something? |
My understanding is that we always need a MultiGraph, except maybe for half-edges which I don't know.
I guess using other classes of graphs we get something different than a hypergraph, is this a known structure? |
Thanks for the contribution @colltoaction ! Really useful functionality, I had actually been wondering about how to do this recently. Wondering if it is possible to achieve this using the original My reasoning is that as written, we ask the user to specify they want a directed hypergraph in 3 different ways: (1) they have to set the "network-type" variable in the bipartite graph to the string On the latter, my potentially wrong understanding is that if a user has not done (2) correctly (e.g., if they accidentaly typed Related, but separate: Do we want to allow users to construct simplicial complexes from bipartite graphs? Is that implemented separately? Related because if someone passed |
@tlarock for context, some of those decisions are part of the HIF format seen here: My intention is to provide a HIF loader for NX that higher-order order libraries can reuse. I.e it should be the same to load from HIF JSON directly to XGI or through an intermediate NX graph then converting it. |
@colltoaction @tlarock --- I thought more about the API for this and here is what I would propose:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the PR and would like to point out some comments below
@colltoaction --- I made some changes to simplify the API and to add the ability to convert a DiHypergraph to a bipartite DiGraph. Let me know what you think! |
@nwlandry your changes worked perfectly in my library after small tweaks. I switched from a MultiDiGraph to a DiGraph, so that makes me think what information could be missing. Anyways it would be very helpful to have this! |
Glad to hear! XGI handles multiedges with unique edge IDs, so we don't need multiedges in the bipartite directed graph. But I suppose that could be good to handle in the distant future! |
See #625.