Concept Flow - Topological Sort Using DFS
Start with all nodes
Pick unvisited node
DFS: Visit node
For each neighbor
If neighbor unvisited
Recursive DFS on neighbor
After all neighbors visited
Add node to stack
Repeat until all nodes visited
Pop all nodes from stack for order
Start DFS from unvisited nodes, visit neighbors recursively, then add nodes to stack. Finally, pop stack for topological order.
