# connected graph

A connected graph is a graph such that there exists a path between all pairs of vertices. If the graph is a directed graph, and there exists a path from each vertex to every other vertex, then it is a strongly connected graph.

A connected component is a maximal (under inclusion) subset of vertices of any graph and any edges between them that forms a connected graph. Similarly, a strongly connected component is a maximal (under inclusion) subset of vertices of any digraph and any edges between them that forms a strongly connected graph. Any graph or digraph is a union of connected or strongly connected components, plus some edges to join the components together. Thus any graph can be decomposed into its connected or strongly connected components. For instance, Tarjan’s algorithm can decompose any digraph into its strongly connected components.

For example, the following graph and digraph are connected and strongly connected, respectively.