-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
new implementation of method is_transitive
with linear memory space
#39221
base: develop
Are you sure you want to change the base?
Conversation
Documentation preview for this PR (built with commit 5fe04f7; changes) is ready! 🎉 |
Can you just reuse some existing implementation of dfs/bfs e.g. |
We could do that, but all my trials are way slower. That's why I decided to go this way. |
Of course it's not as much about complexity, but avoiding duplication of code. Where does the slowness come from? both are O(n ⋅ (n + m)) right? (function call overhead? → |
This new version is slightly simpler as it calls |
The previous version of method$O(n^2 + m)$ . We change that to a version with memory usage in $O(n + m)$ . In addition, this new version is faster for non-transitive digraphs.
is_transitive
was building the distance matrix of the digraph and so had memory usage inBefore
With this PR
📝 Checklist
⌛ Dependencies