Topology extends the notion of a connected component in an undirected graph (described above). The connected components of a topological space X are the maximal (by inclusion) connected subspaces of X.

Equivalently: Define an equivalence relation x~y ("x and y are connected") on points in X: x~y iff there is no partition X=A∪B into disjoint open subsets A,B for which x∈A and y∈B. The connected components of X are the equivalence classes of ~ (aka "X/~").

A related notion is path connected component; however, due to the difference between connectedness and path connectedness, the two concepts are not equivalent for general topological spaces.