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
Explanation: See Detect Cycle in a Graph
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.