Strongly Connected Components
A directed graph is strongly connected if there is a path from every vertex to all the other vertices in the graph.
The strongly connected components (SCCs) of a graph divide the graph into strongly connected parts as large as possible. For example consider the following graph:
Its strongly connected components are:
The corresponding component graph is:
The components are `A = {1,2}, B = {3,6,7}, C = {4} and D = {5}.
A component graph is always a directed acyclic graph or DAG.
The number of SCCs in a graph can be computed using Kosaraju’s Algorithm which uses two DFS traversals (one of the original graph and the other of the transposed graph).
Pseudocode to get the number of SCCs in a graph:
References: GeeksforGeeks