-
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
Get rid of KeyErrors in to_line_graph #558
Conversation
…edge1, edge2 to avoid KeyError
@pgberlureau thanks so much for finding this bug and for your contribution! Two quick questions:
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,
|
What I was realizing is that using tuples may be unexpectedly buggy. Because the order of 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, 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! |
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.
This looks awesome, @pgberlureau! Thanks so much! Let me know if you're done, and if so, I'll merge.
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)