Tutorials › Graph Theory (Undergraduate) › Comparing Subgraphs by Worked Examples

Subgraphs, Isomorphism and Special Families · Tutorial 25 of 799

Comparing Subgraphs by Worked Examples

Use vertex and edge lists to decide whether a graph is a subgraph or an induced subgraph of another graph, and justify the decision precisely.

Beginner 9 min read

What You'll Learn

  • Apply the vertex-set and edge-set tests for an ordinary subgraph.
  • Decide whether a candidate subgraph is induced by checking every host edge between its selected vertices.
  • Distinguish deleting vertices from deleting edges after selecting vertices.
  • Diagnose common errors caused by overlooking extra host edges or inventing edges absent from the host.
  • Verify subgraph decisions directly from explicit vertex and edge lists.

Comparing Graphs from Their Lists

When two graphs are given by vertex and edge lists, deciding whether one is a subgraph of the other is a finite comparison: check the vertices, then check the edges. To decide whether it is an induced subgraph, one more question matters: are there any edges in the larger graph between selected vertices that the smaller graph has left out? This distinction is useful whenever a graph is formed by keeping some of the original vertices, with or without all the edges among them.

Throughout, graphs are finite and simple. An edge \(uv\) denotes the unordered pair \(\{u,v\}\), and an edge list such as \(12,23\) is a set of edges. We compare graphs using their displayed vertex names: a vertex named \(1\) in one graph is the same vertex as \(1\) in the other only when the lists establish that fact. Whether graphs with different labels can be matched by a relabeling is a question of graph isomorphism, not the comparison made here.

Definition: Let \(G=(V(G),E(G))\) and \(H=(V(H),E(H))\) be graphs. The graph \(H\) is a subgraph of \(G\) if \(V(H)\subseteq V(G)\), \(E(H)\subseteq E(G)\), and every edge in \(E(H)\) has both endpoints in \(V(H)\). It is a spanning subgraph if, in addition, \(V(H)=V(G)\). It is an induced subgraph of \(G\) if \(V(H)\subseteq V(G)\) and \(H\) contains exactly the edges of \(G\) whose two endpoints are in \(V(H)\).

For a vertex set \(S\subseteq V(G)\), the induced subgraph on \(S\), written \(G[S]\), has vertex set \(S\) and edge set consisting of every edge of \(G\) with both endpoints in \(S\). Thus selecting vertices determines \(G[S]\) uniquely. An ordinary subgraph on the same selected vertices can have fewer edges than \(G[S]\). In the special case \(S=\varnothing\), the induced subgraph has no vertices and no edges; the definitions apply without change.

A Direct Test

For explicit lists, use two tests in order. First compare the vertex sets: every vertex listed for \(H\) must occur in \(G\). Next compare the edge sets: every edge listed for \(H\) must occur in \(G\), with both its endpoints among the vertices of \(H\). These conditions are exactly the definition of an ordinary subgraph. For an induced subgraph, additionally list all the edges of \(G\) whose endpoints are both in \(V(H)\) and check that this list agrees exactly with \(E(H)\).

Theorem: Let \(H\) and \(G\) be finite simple graphs. Then \(H\) is an induced subgraph of \(G\) if and only if \(V(H)\subseteq V(G)\) and, for every pair of distinct vertices \(u,v\in V(H)\), \(uv\in E(H)\) exactly when \(uv\in E(G)\).

Proof. Suppose first that \(H\) is induced in \(G\). By definition, \(V(H)\subseteq V(G)\), and \(E(H)\) contains exactly the edges of \(G\) whose endpoints both belong to \(V(H)\). Therefore, for every distinct \(u,v\in V(H)\), the edge \(uv\) belongs to \(H\) precisely when it belongs to \(G\). Conversely, suppose the vertex inclusion holds and the stated equivalence holds for every pair of distinct vertices in \(V(H)\). Since the graphs are simple, all edges have two distinct endpoints. The equivalence therefore says that \(E(H)\) consists of all and only the edges of \(G\) with both endpoints in \(V(H)\). This is precisely the definition of \(H\) being induced in \(G\). \(\square\)

This test highlights the difference between the two questions. For a subgraph, an edge of \(H\) must be present in \(G\), but \(H\) may omit other edges of \(G\). For an induced subgraph, it may not omit any edge of \(G\) between its chosen vertices.

Worked Example: A Subgraph That Is Not Induced

Let \(G=(V,E)\), where \(V=\{1,2,3,4,5\}\) and \(E=\{12,13,23,24,34,45\}\). Let \(H=(V_H,E_H)\), where \(V_H=\{1,2,3,4\}\) and \(E_H=\{12,23,34\}\). Decide whether \(H\) is a subgraph of \(G\), and whether it is induced.

First compare vertices: \(V_H=\{1,2,3,4\}\subseteq\{1,2,3,4,5\}=V\). Next check each edge of \(H\): \(12\in E\), \(23\in E\), and \(34\in E\). Each has both endpoints in \(V_H\). Hence \(H\) is a subgraph of \(G\).

For the induced test, gather the host edges with both endpoints in \(V_H\). From \(E=\{12,13,23,24,34,45\}\), the edges \(12,13,23,24,34\) have both endpoints in \(\{1,2,3,4\}\), while \(45\) does not. Thus \(G[V_H]\) has edge set \(\{12,13,23,24,34\}\), which is not \(E_H=\{12,23,34\}\). The omitted edges \(13\) and \(24\) show that \(H\) is not induced.

Check: \(E_H=\{12,23,34\}\subseteq E\), confirming the edge-inclusion test for an ordinary subgraph. But \(13\in E\), both \(1\) and \(3\) are selected, and \(13\notin E_H\), so the induced condition fails.

When Vertex Selection Gives an Induced Subgraph

Once a vertex set \(S\) has been selected, there is no further choice in forming the induced subgraph: retain every host edge whose endpoints both lie in \(S\). This provides a useful way to organize comparisons. First compute \(G[S]\); then compare the candidate edge set with the edge set of \(G[S]\). Equality means the candidate is induced, while a proper subset means it is a non-induced subgraph on those vertices, provided its listed edges are indeed host edges.

Result: If \(H\) is a subgraph of \(G\), then \(H\) is an induced subgraph of \(G\) exactly when \(E(H)=E(G[V(H)])\).

Proof. Assume \(H\) is a subgraph, so its vertices are in \(G\) and each edge of \(H\) is an edge of \(G\) with endpoints in \(V(H)\). If \(H\) is induced, its definition says that it contains every host edge with both endpoints in \(V(H)\); the subgraph condition already ensures it contains no other edges. Therefore \(E(H)=E(G[V(H)])\). Conversely, if the edge sets are equal, then \(H\) contains exactly the edges of \(G\) with both endpoints in \(V(H)\). Together with \(V(H)\subseteq V(G)\), this is the definition of an induced subgraph. \(\square\)

Worked Example: Checking an Induced Subgraph

Let \(G=(V,E)\), where \(V=\{a,b,c,d,e\}\) and \(E=\{ab,ac,bc,bd,cd,de\}\). Let \(H=(V_H,E_H)\), where \(V_H=\{a,b,d,e\}\) and \(E_H=\{ab,bd,de\}\). Decide whether \(H\) is induced in \(G\).

The vertex check gives \(\{a,b,d,e\}\subseteq\{a,b,c,d,e\}\). Now inspect every edge of \(G\). The edge \(ab\) has both endpoints in \(V_H\). The edge \(ac\) has endpoint \(c\notin V_H\), so exclude it. The edge \(bc\) also has endpoint \(c\notin V_H\), so exclude it. The edge \(bd\) has both endpoints in \(V_H\). The edge \(cd\) has endpoint \(c\notin V_H\), so exclude it. The edge \(de\) has both endpoints in \(V_H\). Therefore \(E(G[V_H])=\{ab,bd,de\}\).

Since this equals \(E_H\), the candidate is an induced subgraph. It is also an ordinary subgraph because the three listed edges are all in \(E\) and have endpoints in \(V_H\).

Check: The host list has six edges. Exactly three, \(ac,bc,cd\), meet the unselected vertex \(c\); removing those leaves \(ab,bd,de\), the three edges listed for \(H\). This independent scan confirms the induced-edge list.

Failures of the Subgraph Test

A candidate can fail to be a subgraph in either of the two basic checks: it may list a vertex absent from the host, or it may list an edge absent from the host. An extra host edge between selected vertices does not cause failure as an ordinary subgraph; it causes failure only for the induced test. Keeping these cases separate prevents a common mix-up.

Worked Example: An Edge Missing from the Host

Let \(G=(V,E)\), where \(V=\{1,2,3,4\}\) and \(E=\{12,23,34\}\). Let \(H=(V_H,E_H)\), where \(V_H=\{1,2,4\}\) and \(E_H=\{12,14\}\). Is \(H\) a subgraph of \(G\)?

The vertex condition holds because \(\{1,2,4\}\subseteq\{1,2,3,4\}\). Check the proposed edges separately: \(12\in E\), but \(14\notin E=\{12,23,34\}\). Thus \(E_H\) is not a subset of \(E\), and \(H\) is not a subgraph of \(G\). The fact that both endpoints of \(14\) were selected does not create that edge in the host.

Check: The only host edges whose endpoints both lie in \(V_H\) are those among \(12,23,34\) with no endpoint \(3\). That leaves \(E(G[V_H])=\{12\}\), not \(\{12,14\}\). This confirms both that \(14\) is absent and that the candidate is not induced.

A Reliable Comparison Checklist

For a pair of listed graphs, record the results in a small table rather than relying on a visual impression. When the names are the same, direct membership checks are enough; when they differ, this test does not permit relabeling. The edge test for inducedness must use the host graph, not the candidate’s list alone.

QuestionWhat to checkWhat failure means
Are the vertices allowed?\(V(H)\subseteq V(G)\)\(H\) is not a subgraph.
Are the candidate edges present?\(E(H)\subseteq E(G)\), with endpoints in \(V(H)\)\(H\) is not a subgraph.
Are all internal host edges retained?\(E(H)=E(G[V(H)])\)If \(H\) is a subgraph, it is not induced.

Common mistake. A frequent incorrect calculation is: “The vertices of \(H\) are in \(G\), so \(H\) is induced.” Vertex inclusion is necessary, but it does not check any edges. In the first worked example, \(V_H\subseteq V(G)\) and \(E_H\subseteq E(G)\), yet \(H\) is not induced because the host edges \(13\) and \(24\) between selected vertices are missing from \(H\). The correction is to compute \(G[V(H)]\) and compare its edge set with \(E(H)\), not to stop after checking the vertices.

Another error is to reject an ordinary subgraph merely because the host has extra edges between selected vertices. That reasoning applies only to induced subgraphs. In the first example, \(H\) is an ordinary subgraph precisely because its own edges all occur in \(G\); the extra host edges explain why it is not induced, not why it fails to be a subgraph.

Check Your Understanding

For each question, use the vertex and edge lists explicitly, and state whether the conclusion concerns a subgraph or an induced subgraph.

  1. Let \(G\) have vertices \(\{1,2,3,4\}\) and edges \(\{12,13,23,34\}\). Is the graph with vertices \(\{1,2,3\}\) and edges \(\{12,23\}\) a subgraph? Is it induced?
  2. For the same \(G\), list the edge set of \(G[\{1,3,4\}]\).
  3. Let \(G\) have vertices \(\{a,b,c\}\) and edges \(\{ab,bc\}\). Is the graph with vertices \(\{a,c\}\) and edge set \(\{ac\}\) a subgraph?
  4. Explain why the condition \(V(H)\subseteq V(G)\) alone is insufficient to prove that \(H\) is a subgraph.
  5. Give the edge-set equality that tests whether a subgraph \(H\) is induced in \(G\), and explain what its two sides mean.