...

/

Application 2: Strongly Connected Components

Application 2: Strongly Connected Components

Learn how to split a graph into its strongly connected components.

In this lesson, we use graph traversal to separate a directed graph into its strongly connected components. Such a decomposition can reveal useful information on the graph structure and can be the first step for more involved graph algorithms.

Strongly connected components

Recall that a directed graph is called strongly connected when any pair of nodes can reach each other. Even if the whole graph is not strongly connected, it can be split up into parts called its strongly connected components (SCCs).

The following illustration shows a graph GG with three strongly connected components, marked in green, red, and blue, respectively.

g 2 2 3 3 2->3 5 5 2->5 3->2 3->5 0 0 6 6 0->6 1 1 0->1 4 4 6->4 4->0 4->5 1->4
A graph with three strongly connected components

For example, the nodes 00 and 44 are in the same SCC, as we can reach node 00 from node 44 and also reach node 44 from node 00 (via node 66). On the other hand, nodes 44 and 55 are in distinct SCCs: although we can go from node 44 to node 55, there is no way to go from node 55 to node 44.

After identifying strongly connected components in a graph G=(V,E)G = (V, E), we can contract them to form a new graph GG', called the contracted component graph of GG. The nodes of the contracted component graph are the SCCs of GG ...