I am reading Introduction to Algorithms. In 22.5 Strongly Connected Component, the algorithm STRONGLY-CONNECTED-COMPONENT(G) is defined as:
- Call DFS(G) to compute finishing times u.f for each vertex u
- Compute G transpose
- Call DFS(G transpose), but in the main loop of DFS, consider the vertices in order of decreasing u.f(as computed in line 1)
- Output the vertices of each tree in the depth-first forest formed in line 3 as a separate strongly connected component
If I change the alogrithm to just using G, without calculating G transpose. Also consider the vertices in order of Increasing u.f(Reverse order of topological sort):
- Call DFS(G) to compute finishing times u.f for each vertex u
- Call DFS(G), but in the main loop of DFS, consider the vertices in order of increasing u.f(as computed in line 1)
- Output the vertices of each tree in the depth-first forest formed in line 2
Why is this algorithm wrong?