Two vertices are defined to be in the same connected component if there exists a path between them. Since this definition doesn't really make sense in an arbitrary directed graph (there could be a path from to but not one from to ), for directed graphs one uses the similar concept of a strongly connected component.
A graph is called connected when there is exactly one connected component.
In an undirected graph, the existence of a path between two vertices u and v is an equivalence relation, since:
The connected components are then the equivalence classes of this relation.
Connected components are useful because often algorithms or theorems can be applied to each connected component individually, taking advantage of it being a connected graph, and combine these solutions to obtain a solution for the entire graph. For example, if we find a minimum spanning tree or a maximum matching for each connected component, their union is a minimum spanning forest or maximum matching for the entire graph.
Since SL=L, these problems all lie in L and so can be solved with a deterministic machine in O(log n) space. However, the most practical algorithms for them are randomized algorithms using random walks.