Skip to content
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

Directed graph traversal #292

Open
me21 opened this issue Jun 27, 2024 · 0 comments
Open

Directed graph traversal #292

me21 opened this issue Jun 27, 2024 · 0 comments

Comments

@me21
Copy link

me21 commented Jun 27, 2024

It seems the code given at https://ru.algorithmica.org/cs/graph-traversals/cycle/ incorrectly finds a cycle in the following directed graph:

1->2->3
1->4->3

It goes into dfs, passes the first branch 1->2->3, marks these nodes as used, then goes through the second branch and when it gets to the node 3 again it incorrectly assumes there is a cycle. But there is no cycle, the graph is directed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant