AlgoBazaAlgoBaza
Back to algorithms

Kosaraju's Algorithm (all SCCs)

Kosaraju's algorithm finds ALL strongly connected components (SCC) in a directed graph using two DFS passes. The first pass records the finish order of vertices. The second pass processes vertices in reverse finish order on the reversed graph — each DFS in the second pass finds exactly one SCC!

Zaawansowany
O(V+E)O(V+E)OIJOI
Select programming language
Choose the language to see the Kosaraju SCC implementation.
Select example
Small, Medium, and Large examples show recursion code generation. Very large shows only the call stack.

Kosaraju SCC (Python): Small graph (5 vertices, directed)

1/0
1.0x