Find the strongly connected components of a directed graph with two depth-first searches: the first records the order nodes finish in, the second runs on the reversed graph in reverse finish order, and each search it starts sweeps up exactly one component.
- Average time
- O(V + E)
- Space
- O(V + E)