A topological space decomposes into its connected components. The connectedness relation between two pairs of points satisfies transitivity, i.e., if and then . Hence, being in the same component is an equivalence relation, and the equivalence classes are the connected components.
Using pathwise-connectedness, the pathwise-connected component containing is the set of all pathwise-connected to . That is, it is the set of such that there is a continuous path from to .
Technically speaking, in some topological spaces, pathwise-connected is not the same as connected. A subset of is connected if there is no way to write with and disjoint open sets. Every topological space decomposes into a disjoint union where the are connected. The are called the connected components of .
The connected components of a graph are the set of largest subgraphs of that are each connected. Connected components of a graph may be computed in the Wolfram Language as ConnectedComponents[g] (returned as lists of vertex indices) or ConnectedGraphComponents[g] (returned as a list of graphs). Precomputed values for a number of graphs are available as GraphData[g, "ConnectedComponents"].