â€£

Strongly Connected Components Kosaraju's Algorithm Graph Algorithm:Â https://www.youtube.com/watch?v=RpgcYiky7uw

A directed graph is strongly connected if there is a path between all pairs of vertices. A strongly connected component (SCC) of a directed graph is a maximal strongly connected subgraph. For example, there are 3 SCCs in the following graph.

â€£

- Initialize with stack and set of visited vertices
- Do DFS on all vertices, while maintaining:
- Visited vertices upon seeing it
- And putting completed vertices in the stack upon finishing (track finish times)
- Reverse all edges
- Do DFS from elements popped in the stack while mantaining
- Another visited set
- Strongly connected components where each SCC consists of vertices reachable from the popped element