Walks, trails, paths, cycles and circuits

Exploring and travelling involves moving between vertices along the edges of a graph. Understanding the various methods and mathematical principles behind this allows for the identification of the most efficient routes and ways to optimise resources such as time, distance, and cost.


Use this page to revise the following concepts within walks, trails, paths, cycles and circuits:


Basic Terminology

Some of the key terminology required for understanding exploring and travelling problems include:

Eulerian Trails and Circuits

Eulerian trails and circuits describe a trail or circuit that traverses every edge of a graph once. They can only occur on connected graphs.

Eulerian Trail

Eulerian trails can start at any vertex and end at any other vertex. These exist on a graph when it has exactly two vertices with an odd degree. The two vertices with an odd degree indicate the starting or ending vertex.

This can be observed in how a walk passes through a vertex with different degrees.

Consider a vertex with an even degree:

single vertex with two edges coming out from it. A red line is shown coming in through one edge and out through another with arrows indicating the direction

If the vertex has an even degree, the trail must pass through it.

Consider a vertex with an odd degree:

single vertex with three edges coming out from it. A red line is shown coming in through one edge and out through another, and then a red line coming in to the vertex with arrows indicating the direction. Image is repeated to the right with arrows going the opposite directions.

If the vertex has an odd degree, there must be a trail either starting or terminating at that vertex. Any additional even component would be the trail passing through the vertex.

Worked Example

Determine whether the graph below contains a Eulerian trail. If it does, provide one of the trails.

graph with vertices A, B, C, D, E. Edges connecting A to B, B to C, B to D, B to E, C to E, and D to E

Determine the degree of each of the vertices

\(\deg(A)=1,\ \deg(B)=4,\ \deg(C)=2,\ \deg (D)=2,\  \deg (E )=3\)

There are two vertices with an odd degree (\(A\) and \(E\)) therefore a Eulerian trail exists, and begins and starts at \(A\) or \(E\).

Draw on the graph physically or mentally to determine the trail

graph with vertices A, B, C, D, E. Edges connecting A to B, B to C, B to D, B to E, C to E, and D to E. Red line drawn from A to B to C to E to B to D to E with arrows indicating the direction

A possible Eulerian trail is \(A-B-C-E-D-E\).

Note

This is not the only Eulerian trail. Starting at E is also an option. For example \(E-B-C-E-D-B-A\) is also a valid Eulerian trail.

Eulerian Circuit

Eulerian circuits must start and end on the same vertex. As it starts and ends on the same vertex, this vertex must be even. Therefore, Eulerian circuits only exist on a graph when it has all vertices with an even degree. Starting and ending can occur at any vertex to create a Eulerian circuit.

Worked Example

Determine whether the graph below contains a Eulerian circuit. If it does, provide one of the circuits.

graph with vertices A, B, C, D, E. Single edges connecting A to B, B to C, B to D, B to E, and C to E. Two edges connecting D to E

Determine the degree of each of the vertices

\(\deg(A)=2,\ \deg(B)=4,\ \deg(C)=2,\ \deg(D)=4,\  \deg(E )=4\)

All of the vertices have an even degree. Therefore, Eulerian circuits exist in this graph.

Draw on the graph physically or mentally to determine the trail

graph with vertices A, B, C, D, E. Single edges connecting A to B, B to C, B to D, B to E, and C to E. Two edges connecting D to E. Red line drawn from A to B to C to E to D to E to B to D to A, with arrows indicating the direction. A possible Eulerian trail is \(A-B-C-E-D-E-B-D-A\).

Note

This is also not the only Eulerian circuit. It can start from any vertex, and can traverse multiple ways.

Hamiltonian Paths and Cycles

Hamiltonian paths and cycles describe paths or cycles that traverse every vertex of a graph only once. As these are paths, edges cannot be repeated as well ; however not every edge needs to be traversed.

  • Hamiltonian paths must start at one vertex and end at another.
  • Hamiltonian cycles must start and end at the same vertex.

There are no straightforward methods of determining exact solutions for these. As a result, simpler Hamiltonian path and cycle problems are solved by inspection or trial-and-error.