-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
MultiGraph
views return inconsistent has_edge
results
#7724
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
Comments
Thanks for this Report! It is not a known/reported issue. I can verify that this behavior is indeed a bug. So, we need to 1) add a hook into those lookups to check if any visible edges are present, and 2) make sure that other strange behavior isn't also happening for other lookups. This bug only affects edge_subgraphs of multigraphs. A workaround is |
Thank you for the quick reply! I had no idea of the trade-off between memory and time on subgraph view lookups, nor the amount of memory saved by subgraph views in contrast to graphs. That's very good to know, thanks for sharing! On the issue itself, it's interesting that this can only be observed for multigraphs. After debugging it for a bit, I found a one-liner solution (#7729) that fixes the inconsistencies in the example above, but I'm not sure it covers every possible use case. |
Excellent! I'm not sure how to ensure that other strange behavior is not also occurring. That is what tests are for! :) I thought we had it covered, but clearly we didn't. Hopefully this at least gets us closer. |
Great! It was indeed very nice to find such an easy fix - wasn't sure to expect it or not. Debugging was also a breeze, btw. Hope this is enough to solve the issue! At least for starters, as I can't think of any more tests to include right now. :) |
* Fix for filtered MultiGraph views from `edge_subgraph` (#7724). * Added `test_consistent_edges` method to `TestEdgeSubGraph`.
Uh oh!
There was an error while loading. Please reload this page.
Current Behavior
Filtered views of a
MultiGraph
, created withedge_subgraph
, return inconsistent results fromhas_edge
.Expected Behavior
Match the same results from a
Graph
: eitherTrue
if the edge exists in the subgraph view, orFalse
if not.Steps to Reproduce
In case of a
MultiGraph
: checking if the edge('a', 'c')
exists in the view may return eitherTrue
orFalse
.In case of a
Graph
: checking if the edge('a', 'c')
exists in the view returns onlyFalse
(as expected).Note that the same results follow in case of a
DiGraph
vs. aMultiDiGraph
object.Environment
Python version:
3.11.10
NetworkX version:
3.4.2
Additional context
I am not sure if this is a known issue or a side-effect of edge keys in multigraphs, but thought I should report it just in case.
The text was updated successfully, but these errors were encountered: