Strongly Connected Components | Data Structures Interview | Skill-Lync Resources
Hard Data Structures Graphs

How do you find strongly connected components in a directed graph?

Answer

Kosaraju's algorithm: (1) DFS on original graph, pushing finished vertices to stack. (2) Transpose the graph. (3) Pop vertices from stack, DFS on transposed graph - each DFS tree is an SCC. O(V+E) time. Tarjan's algorithm uses single DFS with low-link values, identifying SCCs when a node's low-link equals its discovery time. Both find maximal sets where every vertex is reachable from every other vertex within the set.

Master These Concepts with IIT Certification
IIT Certified

Master These Concepts with IIT Certification

175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.

Relevant for Roles

Senior Software Engineer Algorithm Developer Systems Architect