Strongly Connected Components
Definition
A strongly connected component (SCC) of a directed graph is a maximal subset such that for every ordered pair of vertices , there exists a directed path from to and a directed path from to . In other words, every vertex in the SCC can reach every other vertex within the SCC.
SCCs form a partition of the vertex set: every vertex belongs to exactly one SCC. A singleton vertex with no self-loop is a trivial SCC of size 1. SCCs generalise the notion of connected components from undirected graphs to directed graphs, requiring bidirectional reachability rather than just undirected connectivity.
Worked Example
Directed graph: , edges:
, , , , , , , , , , , , .
SCC decomposition:
- SCC 1: . Vertices 1, 2, 3, 4 are all mutually reachable: forms a directed cycle; is another cycle; is within the same SCC since gives the return path. Edges to vertices outside: enters this SCC.
- SCC 2: . is a cycle; is another cycle. All four are mutually reachable.
Thus the graph has two SCCs.
The Component Graph
Define the component graph :
- Each vertex in corresponds to one SCC of .
- A directed edge exists iff there is at least one edge where and (i.e. there is an edge from some vertex in to some vertex in in the original graph).
Theorem: is always a DAG (directed acyclic graph).
Proof: Suppose contained a directed cycle . Then:
- A vertex in can reach a vertex in (by the original graph edges).
- A vertex in can reach a vertex in .
- …
- A vertex in can reach a vertex in .
By transitivity of reachability, every vertex in can reach every other vertex in this union. But then would itself be strongly connected, contradicting the maximality of the SCCs (they would have been merged into a single larger SCC). Hence is acyclic.
Since the component graph is a DAG, it has at least one source SCC (no incoming edges from other SCCs) and at least one sink SCC (no outgoing edges to other SCCs). It also admits a topological ordering.
Properties
- SCCs are closed under cycles: Any directed cycle is entirely contained within a single SCC.
- Condensation: Collapsing each SCC into a single super-node produces the component graph, which is a DAG. Many graph problems become simpler on the condensed graph.
- DFS and SCCs: DFS on a directed graph assigns finish times that respect the topological ordering of the component graph: vertices in a “downstream” SCC (closer to a sink) finish before vertices in an “upstream” SCC.
Why SCCs Matter
- Cycle analysis: If a graph has cycles, they are contained within SCCs. Reducing the graph to its component DAG reveals the acyclic structure.
- Social networks: Mutual follow groups correspond to SCCs.
- Deadlock detection: In a wait-for graph of processes/resources, cycles indicate deadlocks. The SCC decomposition identifies all deadlocked groups.
- Graph compression: A large graph can be compressed by replacing each SCC with a single representative node.
- Logic and compilation: Dependency graphs for modules or SAT solvers often contain SCCs; collapsing them simplifies analysis.
Algorithms to Find SCCs
| Algorithm | Technique | Time |
|---|---|---|
| Kosaraju | Two-pass DFS ( then ) | |
| Tarjan | Single-pass DFS with lowlinks |
Only Kosaraju is on the Part IA syllabus. See Kosaraju’s Algorithm for the full treatment.
Relationship with Other Concepts
- Weakly connected components (undirected sense) can span multiple SCCs. SCC is a stricter notion of connectivity.
- DAGs: Every vertex in a DAG is its own SCC (there are no cycles, so no nontrivial mutual reachability). The component graph of a DAG is isomorphic to the DAG itself.
- Topological sort: Works on DAGs. For a general directed graph, topologically sort the component graph, then topologically sort within each SCC (though within an SCC no total order respecting all edges can exist since there are cycles).
Summary
| Term | Definition |
|---|---|
| SCC | Maximal mutually reachable vertex set |
| Component graph | DAG where each node = one SCC |
| Condensation | Collapsing SCCs yields DAG |
| Kosaraju | Two-pass DFS, |
| Key property | is always acyclic |
| DFS property | Finish times reflect component DAG topological order |
Past paper questions: SCCs are assessed conceptually; Kosaraju’s steps may appear in open-ended algorithm questions. Also see y2026p1q10 (DAG).