Strong connectivity
In a directed graph, the edges can be traversed in one direction only, so even if the graph is connected, this does not guarantee that there would be a path from a node to another node. For this reason, it is meaningful to define a new concept that requires more than connectivity.
A graph is strongly connected if there is a path from any node to all other nodes in the graph. For example, in the following picture, the left graph is strongly connected while the right graph is not.
The right graph is not strongly connected because, for example, there is no path from node 2 to node 1.
The strongly connected components of a graph divide the graph into strongly connected parts that are as large as possible. The strongly connected components form an acyclic component graph that represents the deep structure of the original graph.
the strongly connected components are as follows:
The corresponding component graph is as follows:
The components are (A=\{1,2\}), (B=\{3,6,7\}), (C=\{4\}) and (D=\{5\}).
A component graph is an acyclic, directed graph, so it is easier to process than the original graph. Since the graph does not contain cycles, we can always construct a topological sort and use dynamic programming techniques like those presented in Chapter 16.