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 on neighbor
If neighbor in recursion stack
→Cycle detected
Remove node from recursion stack
Repeat for all nodes
No cycle found if all done
The algorithm visits each node, tracks recursion stack to detect back edges indicating cycles.
