Skip to content

Directed graph traversal #292

Description

@me21

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions