xgi
xgi copied to clipboard
new add method
Allows users to add two hypergraphs together. This reindexes all edges and keeps them all.
I haven't read the entire code yet BUT the +
operator should absolutely at all times represent an operation that is commutative. If it is not commutative, then we shouldn't use the +
operator.
😭
OK how about this?
# Keeps edge ids of H1 and relabels the edge ids of H2
# All edges (after relabeling) keep all their attributes
# The node attributes of H1 take precedence over the node attributes of H2
# The hypergraph attributes of H1 take precedence over the hypergraph attributes of H2
X = H1 << H2
Since this is not commutative, I propose we use <<
since I don't think we'd be using it for any other purpose.
Note that if H1
and H2
have no attributes at all, then H1 << H2
and H2 << H1
are isomorphic (though the edge ids are different).
Okay, I did your suggestion with the small difference that H2 attributes take preference, but very happy to change to H1 precedence.