Directed graph traversal
me21 opened this issue · 0 comments
me21 commented
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.