Graph Theory37 sections · 1633 units
Open in CourseQuiz: Cycle Detection in Directed Graphs
Knowledge check
Check Your Understanding
In directed graph cycle detection, you use colors: white (unvisited), gray (in current path), black (fully processed). You find a cycle when DFS encounters which color?
- A.White. An unvisited node means you have gone in a circle
- B.Gray. A node still on the current recursion stack means you have found a back edge
- C.Black. A fully processed node means you are revisiting it
- D.Any non-white color indicates a cycle