{
  "id": "connected-component",
  "title": "Connected Component",
  "lang": "en",
  "source_lang": "en",
  "summary": "A connected component is a maximal connected part of a topological space or graph, identifying a region that cannot be enlarged while preserving connectedness.",
  "category": "mathematics",
  "subcategory": "geometry",
  "type": "concept",
  "aliases": [
    "Component of connectedness"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/connected-component/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/connected-component/",
      "json": "https://aiwiki.page/zh/connected-component.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A connected component is a maximal connected part of a mathematical space or graph. In topology, it is a connected subset that is not properly contained in any larger connected subset. In graph theory, it is a maximal collection of vertices joined to one another by paths, together with the edges between them. Components divide an object into disjoint connected pieces, but the precise meaning of connectedness depends on the setting."
    },
    {
      "heading": "Connected components in topology",
      "text": "A topological space is a connected space if it cannot be expressed as the union of two disjoint, nonempty open subsets. A subset is called connected when it is connected in its subspace topology.\n\nFor a point \\(x\\) in a space \\(X\\), its connected component is\n\n\\[C(x)=\\bigcup\\{A\\subseteq X:x\\in A,\\ A\\text{ is connected}\\}.\\]\n\nEvery set in this union contains \\(x\\). A union of connected sets sharing a common point is connected, so \\(C(x)\\) is itself connected. It contains every connected subset containing \\(x\\), which establishes its maximality.\n\nHere, maximal means that the subset cannot be enlarged while remaining connected. It does not mean that the component has the largest cardinality, diameter, or measure among all components.\n\nPartition into components\n\nIf two connected subsets intersect, their union is connected. Consequently, two connected components that intersect must coincide.\n\nThus, the components form a partition of \\(X\\): every point belongs to exactly one component. Equivalently, the relation\n\n\\[x\\sim y \\quad\\Longleftrightarrow\\quad \\text{some connected subset of }X\\text{ contains both }x\\text{ and }y\\]\n\nis an equivalence relation, and its equivalence classes are precisely the connected components.\n\nA nonempty space is connected exactly when it has one component. The empty space has no components, although it is conventionally considered connected.\n\nClosedness and openness\n\nEvery connected component is a closed subset of the ambient space. This follows because the closure of a connected set is connected; maximality therefore forces a component to equal its closure.\n\nComponents need not be open. In the rational numbers with the topology inherited from the real line, every component is a singleton, but no singleton is open. Given distinct rational numbers \\(p<q\\), an irrational number between them separates any subset containing both into two relatively open, nonempty parts.\n\nIf a space has finitely many components, each component is both open and closed: its complement is a finite union of closed components. Components are also open in every locally connected space, meaning a space in which each point has a neighborhood basis of connected open sets.\n\nExamples\n\n- An interval in the real line is connected and therefore has exactly one component.\n- The subspace \\((-2,-1)\\cup(1,2)\\) has two components, namely the two intervals.\n- In a discrete space, every singleton is a component.\n- Every connected subset of the Cantor set is a singleton, so its components are individual points, despite the set being uncountable.\n\nA space whose components are all singletons is called totally disconnected. This does not imply that the topology is discrete."
    },
    {
      "heading": "Connected components and path components",
      "text": "A path-connected space is one in which any two points can be joined by a continuous path. A path from \\(x\\) to \\(y\\) is a continuous map\n\n\\[\\gamma:[0,1]\\longrightarrow X, \\qquad \\gamma(0)=x,\\quad \\gamma(1)=y.\\]\n\nA path component is a maximal path-connected subset.\n\nEvery path-connected space is connected, because continuous images of connected spaces are connected. Hence every path component lies within a connected component. The converse fails: a connected component may contain several path components.\n\nA standard example is the closed topologist’s sine curve,\n\n\\[T= \\{(x,\\sin(1/x)):0<x\\leq 1\\} \\cup \\bigl(\\{0\\}\\times[-1,1]\\bigr).\\]\n\nThe oscillating graph is connected, and its closure is \\(T\\), so \\(T\\) is connected. Nevertheless, no path in \\(T\\) joins the vertical segment at \\(x=0\\) to the oscillating graph. Thus \\(T\\) has one connected component but two path components.\n\nIn a locally path-connected space, connected components and path components coincide and are open. This applies to manifolds and open subsets of Euclidean space. It explains why the distinction is often invisible in elementary geometric examples."
    },
    {
      "heading": "Connected components of graphs",
      "text": "For an undirected graph \\(G=(V,E)\\), two vertices belong to the same component exactly when a finite graph path joins them. A path of length zero joins a vertex to itself, so an isolated vertex constitutes a component.\n\nThe component containing a vertex consists of all vertices reachable from it, together with all edges of \\(G\\) between those vertices. No edge joins different components: such an edge would provide a path connecting them.\n\nThis definition applies to finite and infinite graphs. An infinite graph is connected if every pair of vertices is joined by a finite path; a single path visiting every vertex is not required.\n\nComputing components\n\nFor a finite graph represented by adjacency lists, all components can be found by repeatedly exploring from an unvisited vertex:\n\n- Select an unvisited vertex and assign it a new component label.\n- Use breadth-first search or depth-first search to visit and label every reachable vertex.\n- Repeat until every vertex has been visited.\n\nEach vertex and edge is processed a bounded number of times, giving running time\n\n\\[O(|V|+|E|),\\]\n\nusing big-O notation. With an adjacency-matrix representation, scanning for neighbors generally takes \\(O(|V|^2)\\) time.\n\nA disjoint-set data structure, also called union–find, offers another approach. Starting with one set per vertex, it merges the sets containing the endpoints of each edge. This is particularly useful when edges are added incrementally. Edge deletion requires additional machinery because removing an edge may split an existing component.\n\nDirected graphs\n\nFor a directed graph, two distinct notions are important:\n\n- A weakly connected component is a component of the undirected graph obtained by ignoring edge directions.\n- A strongly connected component is a maximal set of vertices such that every vertex is reachable from every other vertex by a directed path.\n\nStrong components partition the vertices. Contracting each strong component to one vertex and retaining edges between different components produces a directed acyclic graph, called the condensation graph."
    },
    {
      "heading": "Algebraic and topological descriptions",
      "text": "Graph matrices\n\nIf the vertices of a finite undirected graph are ordered component by component, its adjacency matrix becomes block diagonal. Each diagonal block describes one component, and entries between blocks are zero.\n\nThe graph Laplacian gives an algebraic way to count components. For an unweighted undirected graph,\n\n\\[L=D-A,\\]\n\nwhere \\(A\\) is the adjacency matrix and \\(D\\) is the diagonal matrix of vertex degrees. For a real vector \\(z\\),\n\n\\[z^{\\mathsf T}Lz = \\sum_{\\{u,v\\}\\in E}(z_u-z_v)^2.\\]\n\nThus \\(Lz=0\\) exactly when \\(z\\) is constant on each component. The null space therefore has one independent direction per component, and\n\n\\[\\text{number of components}=\\dim\\ker L.\\]\n\nEquivalently, the multiplicity of the eigenvalue zero equals the number of components.\n\nComponent spaces and homology\n\nThe set of connected components can be given the quotient topology induced by the map\n\n\\[q:X\\longrightarrow \\operatorname{Comp}(X), \\qquad q(x)=C(x).\\]\n\nThis constructs a quotient space by collapsing each connected component to a point. The resulting space need not be discrete, since components need not be open.\n\nIn algebraic topology, the notation \\(\\pi_0(X)\\) conventionally denotes the set of path components, not necessarily connected components. Likewise, zeroth singular homology is the free abelian group on the path components. These constructions count connected components when connected components and path components coincide, but the distinction matters for general spaces."
    },
    {
      "heading": "Applications and dependence on the model",
      "text": "Component decomposition separates problems into independent pieces. A graph calculation with no interactions between components can often be performed separately on each component. In network models, components describe groups mutually reachable under the chosen connection rule.\n\nIn digital image analysis, connected-component labeling groups foreground pixels or voxels according to a specified adjacency relation. In a square pixel grid, allowing only edge-sharing neighbors gives 4-connectivity; also allowing corner-sharing neighbors gives 8-connectivity. Two diagonally touching pixels may therefore belong to different components under one rule and the same component under another.\n\nSimilarly, in cluster analysis, connecting data points whose distance falls below a threshold produces clusters defined by graph components. Such clusters depend on the distance, threshold, and edge rule. A chain of short links may join points that are far apart, because connectedness requires reachability rather than uniformly small pairwise distances."
    }
  ],
  "links": [
    "topology",
    "graph-theory",
    "topological-space",
    "connected-space",
    "subspace-topology",
    "set-partition",
    "equivalence-relation",
    "closed-set",
    "closure-topology",
    "open-set",
    "real-number",
    "cantor-set",
    "path-connected-space",
    "continuous-function",
    "manifold",
    "euclidean-space",
    "big-o-notation",
    "directed-graph",
    "strongly-connected-component",
    "directed-acyclic-graph",
    "adjacency-matrix",
    "graph-laplacian",
    "null-space",
    "quotient-space-topology",
    "algebraic-topology",
    "cluster-analysis"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}