Explanation
- **Kosaraju's Algorithm** is used to find the **strongly connected components (SCC)** of a directed graph. It works by performing two depth-first searches (DFS).
-
-
Steps:
- Perform DFS on the original graph to get the finish times of each vertex.
- Reverse all edges in the graph.
- Perform DFS on the reversed graph in the order of decreasing finish times from the first DFS to identify SCCs.
-
Time Complexity:
- O(V + E), where
Vis the number of vertices andEis the number of edges.
- O(V + E), where