-
Notifications
You must be signed in to change notification settings - Fork 33
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
Hypergraph operations #126
Comments
Could frame them as set operations: union, intersection, subtraction. |
I like this idea! |
Okay, so addition first: I add two hypergraphs. What should it return? And what I mean is
|
When there is no canonical way of doing things, we should offer both ways OR implement whatever is easiest for the time being.
I'd suggest something like the following xgi.add(G, H, attrs_from="first") # keep ONLY the attributes of G
xgi.add(G, H, attrs_from="second") # keep ONLY the attributes of H
xgi.add(G, H, attrs_from="update_first") # use attrs from G and then call .update() with attrs of H
xgi.add(G, H, attrs_from="update_second") # use attrs from H and then call .update() with attrs of G
If there are ID conflicts I would throw an exception
This should always be an option, whether or not there are conflicts.
This is the same as adding all edges from both graphs and then removing duplicates, no? |
That would be super nice to be able to do without reindexing all the edges in H3.
Another thought that I had (though in the context of this discussion seems maybe too reductive?) was that it would be cool to define |
I agree, but the question is, after executing this code, what do you expect the node IDs of Unless you meant that you would like
Yes that's what I was thinking too - this can easily be done by just defining |
Yeah, it's an interesting question. I can see both ways of doing it. I think the key problem is that some edge IDs actually mean something if we got the IDs from a dataset but some are auto-created if they don't already exist. Re-indexing would be good for this second case but doesn't make sense if the IDs mean something. |
If we ever implement |
#203 adds a version of "add" |
I would be okay with closing this. I think we learned that it is actually pretty challenging to make hypergraph operations truly commutative so I don't know if the add method will be possible in the short term. And I think eventually subtraction would be interesting to have but I can't think of a good use for it now. |
We could probably implement union and intersection? Using our ideas from the merge function. |
Closing this for now. Reasons:
|
It would be cool to define the add and subtract methods (and maybe other methods?) for hypergraphs.
The text was updated successfully, but these errors were encountered: