Concept Flow - Cycle Detection in Directed Graph
Start at each unvisited node
Mark node as visited and in recursion stack
For each neighbor
If neighbor not visited
→Recurse DFS on neighbor
If neighbor in recursion stack
→Cycle detected!
Remove node from recursion stack
Repeat for all nodes
No cycle found if all done
We visit each node, track recursion stack to find back edges indicating cycles.
