Fix #449: rewrite causal-flow algorithm iteratively.#455
Merged
matulni merged 9 commits intoTeamGraphix:masterfrom Mar 5, 2026
Merged
Fix #449: rewrite causal-flow algorithm iteratively.#455matulni merged 9 commits intoTeamGraphix:masterfrom
matulni merged 9 commits intoTeamGraphix:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #455 +/- ##
==========================================
- Coverage 88.29% 88.29% -0.01%
==========================================
Files 44 44
Lines 6535 6533 -2
==========================================
- Hits 5770 5768 -2
Misses 765 765 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
thierry-martinez
left a comment
There was a problem hiding this comment.
Thanks for this nice change! I just have a few minor comments.
emlynsg
approved these changes
Mar 4, 2026
Contributor
emlynsg
left a comment
There was a problem hiding this comment.
Agree with Thierry's comments. Nice fix and clean tests!
Co-authored-by: thierry-martinez <thierry.martinez@inria.fr>
thierry-martinez
approved these changes
Mar 4, 2026
graphix/flow/_find_cflow.py
Outdated
| layers: list[frozenset[int]] = [ | ||
| frozenset(corrected_nodes) | ||
| frozenset(og.output_nodes) | ||
| ] # A copy is necessary because `corrected_nodes` is mutable and changes during the algorithm. |
Collaborator
There was a problem hiding this comment.
This comment is no longer relevant. The whole expression can now fit on the same line.
Contributor
Author
There was a problem hiding this comment.
Ahh sorry, I misunderstood which comment you referred to. Done in 115d800
emlynsg
pushed a commit
that referenced
this pull request
Mar 6, 2026
This commit replaces the recursion call in the causal flow algorithm by a while loop. This rewriting prevents the RecursionError reported in #449 for linear graphs with more than 1000 nodes. --------- Co-authored-by: thierry-martinez <thierry.martinez@inria.fr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit replaces the recursion call in the causal flow algorithm by a
whileloop. This rewriting prevents theRecursionErrorreported in #449 for linear graphs with more than 1000 nodes.Example
TODO
Update CHANGELOG