-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix cycles in when traversing graph #520
fix cycles in when traversing graph #520
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard would it be to construct a small dataset to have a unit test for this?
if match_dep_types and edge.req_type not in match_dep_types: | ||
continue | ||
visited.add(edge.destination_node.key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add the start nodes, too, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they will get added when they are being process in the loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the start nodes from self.nodes[ROOT].children
on line 243 will be added unless they also appear as a destination node of something else, right?
One way to address it would be to add start_node
to the visited
set as the first thing this function does. That way every node that is traversed is added. I think if you make that change, you don't need line 291, because the set will be updated during the recursion on line 293.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I think the confusion is the name of the variable start_nodes
. It should be start_edges
because children
is an array of edges. I have added a test case that adds a duplicate toplevel entry (start node) and the test passes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK.
ad18b77
to
05f48d7
Compare
05f48d7
to
6aa4f20
Compare
due to cycles graph traversal would cause maximum recursive depth reached error Signed-off-by: Shubh Bapna <[email protected]>
6aa4f20
to
15bc9e5
Compare
if match_dep_types and edge.req_type not in match_dep_types: | ||
continue | ||
visited.add(edge.destination_node.key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK.
fixes #519
due to cycles graph traversal would cause maximum recursive depth reached error