DFS Topological Sort
Reverse postorder of a DFS is a topological order, and a back edge means there is none.
Topological Sort: DFS finish order
Enter 0. Its edges go to 1, 2. Unvisited: 1, 2. Go into 1 first.
Cost
- Best
- O(V + E)
- Average
- O(V + E)
- Worst
- O(V + E)
- Space
- O(V)
Before this
Related
Taught by the same lesson
Topological Sort covers these too, in the same run.