The strongly connected component algorithm from my book:
strongly-connected-component(G)
- call DFS(G) to compute finishing times f[u] for each vertex u
- compute Transpose(G)
- call DFS(Transpose(G)), but in the main loop of DFS, consider the vertices in order of decreasing f[u] (as computed in line 1)
- output the vertices of each tree in the depth-first forest of step 3 as a separate strong connected component
I do not really understand how line 4 works, how the algorithm makes the forest from the DFS on the transpose graph. I do understand why to call both times to DFS.
Thanks for any help.