-
Notifications
You must be signed in to change notification settings - Fork 338
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
Add topological sort #2467
Add topological sort #2467
Conversation
Looks like #2472 is going well, so making this as ready. |
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.
LGTM
const typename Graph::adjacency_list& adjacency | ||
) | ||
{ | ||
status[start] = Visited::ongoing; |
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.
Is it safe to do this instead of using .at
here?
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.
If it's required that start
is in boundaries of status
size, maybe just add an assertion?
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.
@Klaim This is a private function, but it is true that the input is not checked from the caller (dfs_raw
).
That being said, node_id
s are passed from the user all over the class without being checked. Should we fix that, or is that a contract?
I'm adding a couple of assert where you specified.
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 think that's a contract of the functions and the asserts are enough checks yeah.
is_reachable
signaturedepth_first_search
a free function to mirror networkx, rename itdfs_