-
Notifications
You must be signed in to change notification settings - Fork 161
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
Improve documentation of all_pairs_all_simple_paths
with example on how to consume all paths
#1311
Comments
Some code to test This builds the graphs
This shows that the networkx implementation and rustworkx implementation give different results
|
I'll stop you right at:
For Networkx, you are creating a directed graph. For rustworkx, you are creating an undirected graph. So you are comparing the simple paths of two very different graphs! Try swaping |
I guess I should have put more of the code down
|
but I did just try it replacing with your suggestion and it was the same. For example the last block of code spits out this Not in rustworkx 5: [0, 1, 2, 3, 4, 16, 23, 24, 25, 26] |
It's worth noting I added the edges in both directions on the DiGraph because yes, I'm aware it's directional (I was trying to minimally change some other code which is how it ended up in this odd state) |
So, I found the issue in the code with the reported bug. There is a big assumption I tweaked the first part just to match the graph type. Both NetworkX and rustworkx are using undirected graphs for simplicity:
Then, we have the tweaked path iterator:
That version of the code outputs:
|
I also ran the additional snippet:
And it printed nothing. I think we can profit from this to improve the documentation on how to consume the API. The |
all_pairs_all_simple_paths
with example on how to consume all paths
Thank you for figuring this out -- I suspect this'll let David use Rustworkx in his code :) |
Much appreciated @IvanIsCoding ! |
Information
What is the current behavior?
When comparison all_pairs_all_simple_paths to a brute force search of paths there is a discrepancy
What is the expected behavior?
Steps to reproduce the problem
Code from Oliver (I'll ask him to post)
The text was updated successfully, but these errors were encountered: