Which of the following condition is sufficient to detect cycle in a directed graph?
There is an edge from currently being visited node to an already visited node.
There is an edge from currently being visited node to an ancestor of currently visited node in DFS forest.
Every node is seen twice in DFS.
None of the above
This question is part of this quiz :
Top MCQs on Graph Traversals with Answers