Closed pgberlureau closed 3 days ago
@pgberlureau thanks so much for finding this bug and for your contribution! Two quick questions:
tests/convert/test_line_graph.py
called test_557
so that we don't break this in the future?for e1, e2 in combinations(H._edge, 2):
edge_intersect = len(H._edge[e1].intersection(H._edge[e2]))
if edge_intersect >= s:
LG.add_edge(e1, e2)
I saw that the unit tests are failing due to an unrelated issue which I will fix. Thanks again!!
Hey,
Hey,
- yes i can add the test, no problem :)
- You are right, only thing is that in the obtained nx graph, nodes are now indices and the original corresponding hyperedges are attributes of those nodes. This is not a problem to me but is this really the desired behaviour ? (Or I didn't got what you meant sorry)
What I was realizing is that using tuples may be unexpectedly buggy. Because the order of set
is not guaranteed, when we cast to tuples, we may be getting different permutations of the edges, e.g., (1, 2, 3)
and (3, 1, 2)
. I propose that we fix this using the code that I suggested, or, at the very least, putting a sorted
statement inside the casting to tuple.
My worry about using the edges as keys is that the line graph will be the same with or without multiedges, so if a hypergraph is not a simple hypergraph, then we're not getting the accurate linegraph.
Yes,
indeed tuple(set([-1,-2])) == tuple(set([-2,-1])) is False
.
I just suggest we use your code but we keep original hyperedges as data of the corresponding created nodes in the linegraph so we don't lose information (which can be useful with spatial hypergraph for instance).
Yes, indeed
tuple(set([-1,-2])) == tuple(set([-2,-1])) is False
.I just suggest we use your code but we keep original hyperedges as data of the corresponding created nodes in the linegraph so we don't lose information (which can be useful with spatial hypergraph for instance).
That sounds perfect!
I have nothing to add, thank you for your work !
Use edge_label_dict.values() as nodes and get edge1 and edge2 from edge_label_dict.keys() to avoid KeyError. (Fix issue #557)