Algorithms | Graph Traversals | Question 9

Which of the following condition is sufficient to detect cycle in a directed graph?
(A) There is an edge from currently being visited node to an already visited node.
(B) There is an edge from currently being visited node to an ancestor of currently visited node in DFS forest.
(C) Every node is seen twice in DFS.
(D) None of the bove


Answer: (B)

Explanation: See Detect Cycle in a Graph

Quiz of this Question



My Personal Notes arrow_drop_up