AlgoBazaAlgoBaza
Back to algorithms

Strongly Connected Component (Naive)

Naive algorithm for finding the Strongly Connected Component (SCC) from a single vertex. Performs forward DFS to find reachable vertices, then a separate backward DFS for each candidate. Introduction to more efficient algorithms (Kosaraju, Tarjan).

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

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

1/0
1.0x