Conversation
skrawcz
commented
Feb 17, 2026
jernejfrank
reviewed
Mar 4, 2026
Comment on lines
+1097
to
+1105
| n = stack.pop() | ||
| if n in nodes: | ||
| continue | ||
| nodes.add(n) | ||
| if n.user_defined: | ||
| user_nodes.add(n) | ||
| for next_n in next_nodes_fn(n): | ||
| if next_n not in nodes: | ||
| stack.append(next_n) |
Contributor
There was a problem hiding this comment.
This can lead to duplicate nodes being on stack I think because you don't mark the nodes as seen until you pop from the stack instead of marking them when you push onto the stack.
| @@ -1091,13 +1090,19 @@ def directional_dfs_traverse( | |||
| nodes = set() | |||
| user_nodes = set() | |||
|
|
|||
Contributor
There was a problem hiding this comment.
FYI, this dfs transversal order should in principle be different from the iterative one.
Since we are doing DAGs I think this should be fine.
This should help someone create a really large and deep graph. This needs more testing/eyes to think about impact.
So this ensures we don't visit things twice. It also ensures that we have the same order of traversal as before. I don't want to change the order of behavior if we don't have to.
9777085 to
ca3bcc9
Compare
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 should help someone create a really large and deep graph.
Changes
How I tested this
Notes
Even though this is a pretty core change I think this is isolated enough that we are confident in this change.
Alternatively we could enable an environment variable to switch, but I don't see much value in that given that we're swapping the function stack for a regular stack.
Checklist