Tutorials › Graph Theory (Undergraduate) › Maximal Connected Subgraphs

Paths, Cycles and Connectedness · Tutorial 53 of 799

Maximal Connected Subgraphs

Use paths and inclusion to recognize maximal connected subgraphs, and check why each component contains all edges between its vertices.

Beginner 9 min read

What You'll Learn

  • Define a maximal connected subgraph using inclusion among subgraphs of a fixed graph
  • Prove that maximal connected subgraphs are exactly the components
  • Explain why each component contains every edge of the graph between its vertices
  • Distinguish maximal from largest by number of vertices
  • Test maximality in examples, including a component consisting of one isolated vertex

Components as Maximal Connected Subgraphs

Connectedness groups vertices according to whether paths join them. A component is one such group together with the graph structure on it. This tutorial characterizes components in a second way: they are precisely the connected subgraphs that cannot be enlarged while staying connected. The word maximal refers to inclusion, not to having the greatest number of vertices.

Throughout, graphs are finite and simple. A subgraph \(H\) of \(G\) has \(V(H)\subseteq V(G)\) and \(E(H)\subseteq E(G)\), with every edge of \(H\) having both endpoints in \(V(H)\). A path joins two vertices when its first and last vertices are those vertices. A graph is connected if it has at least one vertex and every pair of its vertices is joined by a path; a graph with one vertex is connected. We use the convention that the empty graph has no components.

Definition: A component of \(G\) is the subgraph induced by one equivalence class of vertices under the relation “there is a path between them.” The induced subgraph on \(S\subseteq V(G)\), written \(G[S]\), has vertex set \(S\) and contains every edge of \(G\) whose two endpoints are in \(S\). A connected subgraph \(H\) of \(G\) is maximal connected if no connected subgraph of \(G\) properly contains \(H\).

The path relation is an equivalence relation: each vertex is joined to itself by a path of length zero, reversing a path gives a path in the opposite direction, and joining paths gives a walk from which a path can be obtained. Thus the equivalence classes partition \(V(G)\). A component is the induced subgraph on one class, not merely the class as a set of vertices.

The Characterization

Theorem: For a finite graph \(G\), a subgraph \(H\) is a component of \(G\) if and only if \(H\) is a maximal connected subgraph of \(G\). In particular, each component contains every edge of \(G\) whose endpoints are in that component.

Proof. First suppose \(H\) is a component, and let \(C=V(H)\) be its vertex set, an equivalence class of the path relation. The subgraph \(H=G[C]\) is connected: for any \(u,v\in C\), the definition of the class gives a path from \(u\) to \(v\), and every vertex on that path is itself joined to \(u\), so it also lies in \(C\). The path therefore lies in \(G[C]\).

Now suppose a connected subgraph \(J\) of \(G\) contains \(H\). Every vertex \(w\in V(J)\) is joined in \(J\) to a vertex of \(C\), since \(J\) is connected and \(C\) is nonempty. Hence \(w\) belongs to the same equivalence class \(C\). So \(V(J)\subseteq C\), and because \(J\) contains \(H\), also \(V(J)=C\). The subgraph \(H=G[C]\) already contains every edge of \(G\) with both endpoints in \(C\). Thus \(J\) cannot add any edge to \(H\), and \(J=H\). This proves that \(H\) is maximal connected.

Conversely, suppose \(H\) is a maximal connected subgraph of \(G\), and choose any vertex \(r\in V(H)\). Let \(C\) be the equivalence class of \(r\). Every vertex of \(H\) is joined to \(r\) by a path in \(H\), so \(V(H)\subseteq C\). The subgraph \(G[C]\) is connected by the argument above and contains \(H\) as a subgraph. Maximality forces \(H=G[C]\), so \(H\) is a component.

Finally, if \(u,v\) lie in one component, its vertex set is some class \(C\), and its edge set is the edge set of \(G[C]\). By the definition of an induced subgraph, every edge of \(G\) with endpoints \(u,v\) belongs to that component. This also shows why a maximal connected subgraph cannot omit an edge between its own vertices: adding the omitted edge would preserve connectedness and make a larger connected subgraph. \(\square\)

The theorem treats “maximal” as a statement about inclusion of subgraphs. A maximal connected subgraph cannot be enlarged, even by adding a single edge. It need not be larger than every other connected subgraph by vertex count. In particular, an isolated vertex is a maximal connected subgraph when no edge joins it to another vertex.

Worked Examples

Worked Example: Listing All Components

Let \(G=(V,E)\), where \(V=\{1,2,3,4,5,6,7,8\}\) and \(E=\{12,23,13,34,56\}\). Find the components and verify their maximality.

Vertices \(1,2,3\) are joined by the edges \(12,23,13\). Vertex \(4\) is joined to \(3\) by edge \(34\), so paths connect \(4\) to each of \(1,2,3\). Thus \(C_1=\{1,2,3,4\}\) is one path-equivalence class. Vertices \(5\) and \(6\) are joined by edge \(56\), giving the class \(C_2=\{5,6\}\). Vertices \(7\) and \(8\) have no incident edges, so each forms its own class: \(C_3=\{7\}\) and \(C_4=\{8\}\).

The induced component on \(C_1\) has edge set \(\{12,23,13,34\}\); the induced component on \(C_2\) has edge set \(\{56\}\); and each of \(G[\{7\}]\) and \(G[\{8\}]\) has no edges. No edge joins vertices belonging to different listed sets. Any connected subgraph containing vertices from two different sets would therefore need a path that crossed between sets, which is impossible. Each listed subgraph is connected, and none can be enlarged while remaining connected, so all four are maximal connected subgraphs.

Check: the component vertex sets are disjoint and cover \(V\): their sizes add to \(4+2+1+1=8=|V|\). Their edge sets together contain \(\{12,23,13,34,56\}\), exactly the five edges of \(G\), with no edge left out or assigned across components.

Worked Example: A Connected Subgraph That Is Not Maximal

Let \(G=(V,E)\), where \(V=\{a,b,c,d\}\) and \(E=\{ab,bc,ac,cd\}\). Consider the subgraph \(H\) with \(V(H)=\{a,b,c\}\) and \(E(H)=\{ab,bc\}\). Is \(H\) maximal connected?

The edges \(ab\) and \(bc\) form a path from \(a\) to \(c\), so \(H\) is connected. But \(H\) omits the graph edge \(ac\), whose endpoints are both in \(V(H)\). Adding that edge gives a strictly larger subgraph on the same vertices, and the enlarged subgraph remains connected. Therefore \(H\) is not maximal connected.

In fact, the whole graph is connected: \(d\) is joined to \(c\) by \(cd\), and \(a,b,c\) are joined by the edges already listed. Thus \(G\) itself is the only component. It is the induced subgraph on \(\{a,b,c,d\}\) and has all four edges \(ab,bc,ac,cd\).

Check: \(H\) has the two edges \(ab,bc\), while \(G\) has \(ab,bc,ac,cd\). The omitted edge \(ac\) alone proves \(H\) is not maximal; adding \(d\) together with \(cd\) also enlarges it to the component.

Worked Example: Maximal Does Not Mean Largest

Let \(G=(V,E)\), where \(V=\{u,v,w,x,y,z\}\) and \(E=\{uv,vw,xy\}\). Identify the maximal connected subgraphs and compare their sizes.

The path \(u,v,w\) connects \(u,v,w\), so one component is \(G[\{u,v,w\}]\), with edges \(\{uv,vw\}\). Edge \(xy\) gives the component \(G[\{x,y\}]\), with edge set \(\{xy\}\). Vertex \(z\) has no incident edge, so \(G[\{z\}]\) is a component with no edges.

There are no edges between these three vertex sets, so no path can join vertices in different sets. Each induced subgraph is connected, including the one-vertex graph \(G[\{z\}]\). By the theorem, each is maximal connected. Their vertex counts are \(3,2,1\), respectively; therefore the component on \(\{x,y\}\) and the isolated vertex are maximal even though they have fewer vertices than the component on \(\{u,v,w\}\).

Check: the three edge sets \(\{uv,vw\}\), \(\{xy\}\), and \(\varnothing\) are disjoint and together give all three edges of \(G\). The isolated vertex is not excluded: its one-vertex subgraph is connected, and there is no connected subgraph of \(G\) that properly contains it.

Why the Edge Condition Matters

Connectedness asks whether paths exist; it does not require a connected subgraph to include every available edge. Maximality is stronger. If an edge of \(G\) has both endpoints in a connected subgraph, adding that edge does not break any existing path or destroy connectedness. Therefore a maximal connected subgraph must include it. This is why the component is \(G[C]\), the induced subgraph on its vertex class, rather than an arbitrary connected subgraph with the same vertices.

The reverse check is useful too. To show that a connected subgraph is a component, it is not enough to show that its vertices are joined by paths. One must also rule out a connected enlargement. The characterization gives two equivalent ways to do this: show that its vertices form an entire path-equivalence class, or show that no connected subgraph of \(G\) properly contains it. For a proposed component, checking that it contains all edges between its vertices is a necessary part of this verification.

Common Pitfall

A common mistake is to call a connected subgraph maximal merely because no new vertex has yet been listed. In the second example, \(H\) has all three vertices \(a,b,c\) from its proposed component, but it omits the edge \(ac\). The incorrect calculation is to count only \(E(H)=\{ab,bc\}\) and conclude that \(H\) is maximal because it already connects its three vertices. The correction is to compare with the edges of \(G\) whose endpoints are in \(V(H)\): those are \(ab,bc,ac\). Since \(ac\notin E(H)\), the strictly larger connected subgraph with edge set \(\{ab,bc,ac\}\) contains \(H\). So \(H\) is not maximal, even before considering the additional vertex \(d\).

Also avoid replacing “maximal” with “largest.” A component may be smaller than another component and still be maximal, because there is no connected enlargement of it inside \(G\). The isolated-vertex component in the third example is the simplest case.

Check Your Understanding

Use the definition of maximality by subgraph inclusion, and pay attention to edges as well as vertices.

  1. Let \(G\) have vertices \(\{1,2,3,4\}\) and edges \(\{12,23,34\}\). Is the subgraph with vertices \(\{1,2,3\}\) and edges \(\{12,23\}\) a component?
  2. Give an example of a connected subgraph that has the same vertex set as a component but is not maximal connected.
  3. Why is a one-vertex graph with no incident edges a maximal connected subgraph of a graph in which that vertex is isolated?
  4. State precisely what edges must belong to a component with vertex set \(C\).
  5. Can two distinct components of a graph have different numbers of vertices and both be maximal connected? Explain.