Tutorials › Graph Theory (Undergraduate) › Paths and Cycles as Graph Families

Subgraphs, Isomorphism and Special Families · Tutorial 30 of 799

Paths and Cycles as Graph Families

Learn the exact edge patterns of path and cycle graphs and how to verify their copies inside a larger graph.

Beginner 9 min read

What You'll Learn

  • Define \(P_n\) and \(C_n\) from explicit vertex and edge sets
  • Handle the small cases \(P_1\), \(P_2\), and \(C_3\)
  • Test whether selected vertices and edges form a path or cycle subgraph
  • Distinguish a subgraph copy from an induced subgraph
  • Use edge counts and degrees as checks, not as automatic certificates
  • Identify and correct common errors when checking a proposed copy

Two Basic Families of Graphs

Paths and cycles are among the simplest graph shapes, but recognizing them correctly requires keeping track of both vertices and edges. A larger graph may contain a path or cycle even when it has extra edges among the same vertices. Those extra edges matter if we are asking for an induced subgraph, but they do not prevent the selected edges from forming an ordinary subgraph. The distinction is important whenever a graph is specified by an edge list rather than a picture.

All graphs in this tutorial are finite and simple: they have no loops or multiple edges. A graph \(H=(W,F)\) is a subgraph of \(G=(V,E)\) if \(W\subseteq V\), \(F\subseteq E\), and every edge in \(F\) has both endpoints in \(W\). The subgraph need not include every edge of \(G\) whose endpoints are in \(W\). The induced subgraph \(G[W]\), by contrast, has vertex set \(W\) and includes every edge of \(G\) with both endpoints in \(W\).

Definition: For \(n\geq 1\), the path graph \(P_n\) has vertex set \(\{v_1,\ldots,v_n\}\) and edge set \(\{v_iv_{i+1}:1\leq i<n\}\). Thus \(P_1\) is a single vertex with no edges, and \(P_2\) is two vertices joined by one edge. For \(n\geq 3\), the cycle graph \(C_n\) has vertex set \(\{v_1,\ldots,v_n\}\) and edge set \(\{v_iv_{i+1}:1\leq i<n\}\cup\{v_nv_1\}\). The restriction \(n\geq3\) ensures that \(C_n\) is a simple graph.

The vertex labels in these definitions are placeholders: any graph obtained by consistently renaming the vertices has the same structure. A copy of \(P_n\) or \(C_n\) in a graph \(G\) means a subgraph isomorphic to that graph. Equivalently, we can specify distinct vertices in \(G\) in a suitable order and select the edges joining consecutive vertices, with the additional closing edge for a cycle. Other edges of \(G\) may be present but left out of the selected subgraph.

What the Edge Lists Require

For a proposed path copy, the selected vertices must be distinct and can be ordered \(x_1,\ldots,x_n\) so that the selected edge set is exactly \(x_ix_{i+1}\) for \(1\leq i<n\). There are \(n-1\) such edges. For a proposed cycle copy, the distinct vertices can be ordered \(x_1,\ldots,x_n\), with \(n\geq3\), so that the selected edges are exactly \(x_ix_{i+1}\) for \(1\leq i<n\), together with \(x_nx_1\). There are \(n\) such edges. In both cases “exactly” describes the selected subgraph, not necessarily all the edges of the larger graph between those vertices.

These descriptions give a direct test that does not depend on a drawing. First list the vertices in the proposed order. Then check each required edge against the ambient edge set. Finally, specify the subgraph’s edge set, so it is clear which edges are being used. For a cycle, also check the closing edge between the last and first listed vertices. Distinctness of the vertices prevents a repeated vertex from being mistaken for a longer path or cycle.

Proposition: A graph \(H=(W,F)\) is isomorphic to \(P_n\) if and only if its vertices can be ordered \(x_1,\ldots,x_n\) so that \(F=\{x_ix_{i+1}:1\leq i<n\}\). For \(n\geq3\), \(H\) is isomorphic to \(C_n\) if and only if its vertices can be ordered \(x_1,\ldots,x_n\) so that \(F=\{x_ix_{i+1}:1\leq i<n\}\cup\{x_nx_1\}\).

Proof. Suppose first that \(H\) is isomorphic to \(P_n\). By the definition of isomorphism, there is a bijection from the vertices \(v_1,\ldots,v_n\) of \(P_n\) to the vertices of \(H\) that preserves adjacency in both directions. Write \(x_i\) for the image of \(v_i\). The edges of \(P_n\) are exactly the pairs \(v_iv_{i+1}\) with \(1\leq i<n\). Because the bijection preserves adjacency in both directions, the edges of \(H\) are exactly the pairs \(x_ix_{i+1}\) in that same index range. Conversely, if such an ordering exists, the bijection \(v_i\mapsto x_i\) is a bijection of vertices and preserves adjacency in both directions, since the stated edge set contains precisely the consecutive pairs. Thus it is an isomorphism to \(P_n\).

For \(C_n\), the same reasoning applies with its defining edge set: an isomorphism sends each \(v_i\) to a distinct \(x_i\), and sends exactly the consecutive pairs and the closing pair \(v_nv_1\) to \(x_ix_{i+1}\) and \(x_nx_1\). Conversely, an ordering with exactly those edges defines a bijection preserving adjacency in both directions, and hence an isomorphism to \(C_n\). \(\square\)

Useful Checks from Degrees and Edge Counts

The edge lists also give quick checks on a proposed graph family. In \(P_n\), when \(n\geq2\), the vertices \(v_1\) and \(v_n\) each have degree \(1\), and every other vertex has degree \(2\). For \(P_1\), the sole vertex has degree \(0\). Every vertex of \(C_n\), for \(n\geq3\), has degree \(2\). These facts follow directly from the listed edges: an internal path vertex occurs in two consecutive pairs, a path endpoint occurs in one, and a cycle vertex is joined to its predecessor and successor.

Counting the edges in the definitions gives \(|E(P_n)|=n-1\) for \(n\geq1\), and \(|E(C_n)|=n\) for \(n\geq3\). For \(P_1\), the range \(1\leq i<1\) contains no indices, so the edge count is \(0=1-1\). For \(P_n\) with \(n\geq2\), there are \(n-1\) consecutive pairs. For \(C_n\), there are those \(n-1\) pairs and one closing pair, for a total of \(n\).

Takeaway: Degree patterns and edge counts are necessary checks for a path or cycle, but they do not by themselves establish the required edge arrangement. To certify a copy, give an ordering of distinct vertices and verify its defining edge set.

Proof of the checks. For \(P_n\) with \(n\geq2\), the first vertex is incident only with \(v_1v_2\), and the last only with \(v_{n-1}v_n\). Each \(v_i\) with \(1<i<n\) is incident with \(v_{i-1}v_i\) and \(v_iv_{i+1}\). This proves the stated degrees; for \(P_1\), its edge set is empty. In \(C_n\), each \(v_i\) is incident with the edge to its predecessor and the edge to its successor, where the closing edge makes these neighbors available also at the ends of the list. For \(n\geq3\), these are two distinct edges, so every degree is \(2\). The edge counts follow by counting the consecutive pairs in each defining edge set and, for the cycle, adding the one closing edge. \(\square\)

Worked Examples

Worked Example: A Path That Is Not Induced

Let \(G=(V,E)\), where \(V=\{a,b,c,d,e,f\}\) and \(E=\{ab,bc,cd,de,ef,ac,df\}\). Show that \(G\) contains a subgraph isomorphic to \(P_5\), and decide whether the same five vertices induce that path.

Choose the ordered vertices \(a,b,c,d,e\). The consecutive pairs are \(ab,bc,cd,de\), and all four belong to \(E\). Select the subgraph \(H\) with vertex set \(\{a,b,c,d,e\}\) and edge set \(\{ab,bc,cd,de\}\). By the ordered-edge characterization, \(H\) is isomorphic to \(P_5\).

To check its degrees, \(a\) and \(e\) each have one selected incident edge, while \(b,c,d\) each have two. Thus the selected degrees are \(1,2,2,2,1\), as required for \(P_5\). The edge count is \(4\), which agrees with \(5-1=4\).

The induced subgraph on those five vertices also includes \(ac\), because \(ac\in E\) and both endpoints are selected. Its edge set is therefore \(\{ab,bc,cd,de,ac\}\), not the edge set of \(P_5\). The extra edge does not prevent an ordinary path subgraph, but it does mean that these five vertices do not induce that path.

Check: The selected edge list contains exactly the four consecutive pairs \(ab,bc,cd,de\); the ambient edge \(ac\) is omitted from \(H\), and adding it gives five edges in the induced subgraph.

Worked Example: A Cycle with a Chord

Let \(G=(V,E)\), where \(V=\{1,2,3,4,5\}\) and \(E=\{12,23,34,41,13,35\}\). Identify a cycle subgraph on four vertices and determine whether it is induced.

Use the ordered vertices \(1,2,3,4\). The required cycle edges are \(12,23,34\), followed by the closing edge \(41\). Each belongs to \(E\). Hence the subgraph \(H\) with vertex set \(\{1,2,3,4\}\) and edge set \(\{12,23,34,41\}\) is a copy of \(C_4\).

There are four selected edges, matching the four vertices of \(C_4\). Each selected vertex has degree \(2\) in \(H\): vertex \(1\) meets \(12\) and \(41\), vertex \(2\) meets \(12\) and \(23\), vertex \(3\) meets \(23\) and \(34\), and vertex \(4\) meets \(34\) and \(41\).

The induced subgraph on \(\{1,2,3,4\}\) also contains edge \(13\). Its edge set has five edges, so it is not the cycle graph \(C_4\). Edge \(35\) is not included in this induced subgraph because vertex \(5\) is not selected.

Check: The cycle’s required closing edge is \(41\), and it is in \(E\). The induced edge set adds exactly \(13\) among the four selected vertices, giving the four cycle edges plus one chord.

Worked Example: One Graph Containing a Path and a Cycle

Let \(G=(V,E)\), where \(V=\{p,q,r,s,t\}\) and \(E=\{pq,qr,rs,sp,st\}\). Exhibit both a \(P_5\) subgraph and a \(C_4\) subgraph.

For a path, order the vertices as \(t,s,r,q,p\). Its required consecutive edges are \(ts,sr,rq,qp\), all of which are in \(E\). Select \(H_1\) with all five vertices and edge set \(\{st,rs,qr,pq\}\). This is a copy of \(P_5\); the selected degrees in that order are \(1,2,2,2,1\), and the selected edge count is \(4=5-1\).

For a cycle, order four vertices as \(p,q,r,s\). The consecutive edges \(pq,qr,rs\) and closing edge \(sp\) all belong to \(E\). The subgraph \(H_2\) with vertex set \(\{p,q,r,s\}\) and edge set \(\{pq,qr,rs,sp\}\) is a copy of \(C_4\). Each of its four vertices has degree \(2\), and its edge count is \(4\).

The two copies use different selected edge sets, even though they lie in the same graph. The edge \(sp\), for example, is part of the cycle but is left out of the selected path. Neither claim depends on the full edge set of \(G\) matching the smaller graph’s edge set.

Check: The path list uses four edges, \(st, sr, rq, qp\), each present in \(E\); the cycle list uses four edges, \(pq, qr, rs, sp\), each present in \(E\). The counts agree with \(P_5\) having \(5-1=4\) edges and \(C_4\) having \(4\) edges.

Common Pitfalls and Why the Distinction Matters

A common mistake is to reject a path or cycle because the larger graph has an extra edge between its selected vertices. For example, in the first worked example, the incorrect calculation is: “The five vertices have edges \(ab,bc,cd,de,ac\), so they cannot contain \(P_5\).” This treats the induced subgraph as if it were the only allowed subgraph. The correction is to specify the selected edge set \(\{ab,bc,cd,de\}\). It is a subgraph and is isomorphic to \(P_5\); the additional edge \(ac\) only prevents the five vertices from inducing \(P_5\).

A second mistake is to use a degree pattern as a complete certificate. A path graph with \(n\geq2\) has two degree-\(1\) vertices and all its other vertices have degree \(2\), but seeing those degrees does not verify that the edges connect the vertices in one path-shaped arrangement. Likewise, degree \(2\) at every vertex is a necessary check for a cycle graph, not a replacement for checking the ordered edge set. The reliable certificate is explicit: give the distinct vertices in order and list the required edges, including the closing edge for a cycle.

Small cases should also be handled from the definitions rather than from a remembered picture. \(P_1\) has no edges, and \(P_2\) has one edge; a cycle requires at least three vertices in a simple graph. In particular, the path edge-count formula includes \(P_1\), while the cycle definition begins at \(C_3\). Keeping these conditions visible avoids applying a cycle description where its closing edge would duplicate an existing edge or fail to define a simple cycle graph.

Paths and cycles provide standard patterns for describing pieces of larger graphs. Their explicit edge lists make it possible to verify a claimed subgraph by inspection of the vertex and edge sets, while the induced-subgraph distinction clarifies exactly what has been selected. In later structural arguments, the same habit—state the vertices, state the edges, and check every required pair—helps prevent a plausible drawing from substituting for a proof.

Check Your Understanding

For each question, use vertex and edge sets or an explicit ordering of distinct vertices to justify your answer.

  1. Write the vertex set and edge set of \(P_4\), and state the degree of each vertex.
  2. Can a simple graph on three vertices contain a subgraph isomorphic to \(C_3\) and also have an extra edge among those same vertices? Explain using the number of possible edges.
  3. Let \(V=\{a,b,c,d\}\) and \(E=\{ab,bc,cd,da,ac\}\). Give a \(C_4\) subgraph and state whether its four vertices induce \(C_4\).
  4. Why is having exactly \(n-1\) edges not, by itself, a certificate that a graph is \(P_n\)?
  5. State the smallest allowed value of \(n\) for \(P_n\) and for \(C_n\), and explain why the two lower bounds differ.