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 cycle found, return true
If neighbor in recursion stack
→Cycle detected, return true
Remove node from recursion stack
No cycle found from this node, continue
All nodes processed, no cycle found
Return false
The algorithm visits each node, marks it in a recursion stack, explores neighbors recursively, and detects a cycle if a neighbor is already in the recursion stack.
