Closed maximelucas closed 1 year ago
When we pass in edge data to the constructor, the self._edge_uid
is not being initializer correctly. It always starts at zero.
Exactly, but only in the {id : members} format apparently
H = xgi.Hypergraph({0: {1, 2}, 1: {1, 4}, 2: {0, 1, 8}, 3: {0, 3, 5}})
H._edge_uid
# -> count(0) # wrong
But
H = xgi.Hypergraph([{1, 2}, {1, 4}, {0, 1, 8}, {0, 3, 5}])
H._edge_uid
# -> count(4) # correct
convert_to_hypergraph
calls H.add_edges_from
which in turn increments _edge_uid
but ONLY when the incoming_data
is a list. All other cases use different mechanisms to add the edges so count is not incremented.
Yep, my conclusion too.
Create a Hypergraph:
Then remove an edge
But then, when adding a new hyperedge, [1,9,2], it is assigned the ID 0 already in use, and the previous hyperedge with ID 0 has disappeared:
It should just be assigned a new ID, probably 4. Not sure what is causing this yet.
Instead, specifying the ID explicitly works, and gives the expected result, but the above is still wrong: