algorithmica icon indicating copy to clipboard operation
algorithmica copied to clipboard

Directed graph traversal

Open me21 opened this issue 1 year ago • 0 comments

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.

me21 avatar Jun 27 '24 13:06 me21