Strongly Connected Components - Tarjan
Learn Strongly Connected Components - Tarjan (Graphs, Advanced DSA) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Tarjan's Algorithm for Strongly Connected Components Tarjan finds all SCCs in a single DFS . Each vertex gets a discovery time disc and a low-link value low : the smallest discovery time reachable from its subtree using one back edge to a vertex still on the stack. Vertices are kept on a stack. When low[u] == disc[u] , u is the root of an SCC, and everything above it on the stack belongs to that component. Cost: O(V + E) .
More lessons in Graphs
- Graph Representation - Adjacency Matrix
- Graph Representation - Adjacency List
- Directed Graph
- Undirected Graph
- Weighted Graph
- BFS
- DFS
- Connected Components
- Cycle Detection
- Bipartite Graph
- Topological Sort
- Kahn's Algorithm
- DFS Topological Sort
- Shortest Path - BFS
- Shortest Path - Dijkstra
- Shortest Path - Bellman-Ford
- Shortest Path - Floyd-Warshall
- Minimum Spanning Tree - Prim's
- Minimum Spanning Tree - Kruskal's
- Disjoint Set Union - DSU
- Union-Find
- Strongly Connected Components - Kosaraju
- Bridges
- Articulation Points
- Euler Path / Circuit
- Hamiltonian Path / Cycle
- Graph Coloring
- Network Flow
- Maximum Flow
- Bipartite Matching