Walks, trails, paths, circuits and cycles
Learn to name and describe routes through a graph in Year 12 VCE General Mathematics. A tram that loops back to its depot, a jogger who never runs the same stretch twice along the Yarra, and a tourist who visits each Great Ocean Road lookout just once are all following different kinds of route, and each kind has its own name.
You will learn exactly what makes a route a walk, a trail, a path, a circuit or a cycle, give the most specific name for a route, and find its length by counting edges. You will follow arrows in directed graphs and count the cycles in small graphs, ready to search for routes that use every edge, or visit every vertex, exactly once.
Theory
Routes through a graph have precise names. This Year 12 General Mathematics guide for students in Victoria explains walks, trails, paths, circuits and cycles, how to find the length of a walk, how walks work in a directed graph, and how to count the cycles in a small graph.
A walk is a sequence of edges joining one vertex to the next, written as a list of vertices such as \(A\)β\(B\)β\(C\). In a walk, vertices and edges may be repeated. The length of a walk is the number of edges it uses. A trail is a walk with no repeated edge (a vertex may repeat). A path is a walk with no repeated vertex, so it cannot repeat an edge either.
A circuit is a trail that starts and finishes at the same vertex. A cycle is a path that starts and finishes at the same vertex: only the start and finish vertex is repeated, and it has at least \(3\) edges. So every cycle is also a circuit, but a circuit that passes through some vertex twice is not a cycle. When asked to name a route, give its most specific name.
In a directed graph, a walk must follow the direction of the arrows. An edge that is a bridge can never be part of a cycle, because a cycle always offers a second way round.
The length of a walk counts its edges, which is one less than the number of vertices in its list:
A cycle of length \(n\) passes through exactly \(n\) different vertices:
How to name a route:
| Name | Repeated edge? | Repeated vertex? | Starts and finishes at the same vertex? |
|---|---|---|---|
| walk | allowed | allowed | either |
| trail | no | allowed | either |
| path | no | no | no |
| circuit | no | allowed | yes |
| cycle | no | only the start and finish | yes |
How to name a route
- Check it is a walk. Every consecutive pair of vertices must be joined by an edge (following the arrows in a digraph).
- Look for a repeated edge. If an edge is used twice, the route is only a walk.
- Look for a repeated vertex (ignore the finish if it equals the start). None: it is a path, or a cycle if it is closed. Some: it is a trail, or a circuit if it is closed.
- Give the length by counting the edges.
How to count the cycles in a small graph
- Sort the cycles by length: \(3\), then \(4\), and so on up to the number of vertices.
- For each length, list the cycles in an organised way, writing each with its vertices in order.
- Cross out repeats (the same cycle from a different start or in reverse).
Check for a repeated edge first, then a repeated vertex, then whether the route is closed.
| \(A\text{β}B\text{β}E\text{β}F\text{β}A\) | \(:\) | \(\text{cycle}\) |
| \(A\text{β}B\text{β}C\text{β}D\text{β}E\text{β}B\text{β}A\) | \(:\) | \(\text{walk}\) |
| \(F\text{β}A\text{β}B\text{β}E\text{β}D\text{β}C\text{β}B\) | \(:\) | \(\text{trail}\) |
| \(C\text{β}D\text{β}E\text{β}F\) | \(:\) | \(\text{path}\) |
(i) Only \(A\) repeats, as the start and finish: a cycle. (ii) Edge \(AB\) is used twice: only a walk. (iii) \(B\) is visited twice but no edge repeats, and it finishes at a different vertex: a trail. (iv) No vertex repeats and it is not closed: a path.
Look for a repeated vertex (other than the start and finish), then count the edges.
| \(\text{(i) repeated}\) | \(:\) | \(C \text{ twice, no edge repeated}\) |
| \(\text{length}\) | \(=\) | \(8 - 1\) |
| \(\) | \(=\) | \(7\) |
| \(\text{(ii) repeated}\) | \(:\) | \(\text{only } A \text{ (start and finish)}\) |
| \(\text{length}\) | \(=\) | \(7 - 1\) |
| \(\) | \(=\) | \(6\) |
(i) No edge is used twice and the route returns to \(A\), but it passes through \(C\) twice: a circuit, not a cycle, of length \(7\). (ii) No vertex repeats except \(A\) at the start and finish: a cycle of length \(6\) (every cycle is also a circuit, but "cycle" is the most specific name). (iii) The graph has \(6\) vertices and the cycle in (ii) passes through all of them, so the longest cycle has length \(6\).
Follow the arrows only.
| \(A\text{β}B\text{β}D\text{β}E\) | \(:\) | \(\text{length } 3\) |
| \(E\text{β}C\text{β}B\text{β}D\text{β}A\) | \(:\) | \(\text{length } 4\) |
(i) \(A\)β\(B\)β\(D\)β\(E\), length \(3\). (ii) From \(E\) the only arc goes to \(C\), then \(C \to B\), \(B \to D\), \(D \to A\): \(E\)β\(C\)β\(B\)β\(D\)β\(A\), length \(4\). Going back takes longer because the arrows only allow one way round. (iii) The arc between \(B\) and \(C\) points from \(C\) to \(B\), so you cannot travel \(B \to C\).
List the cycles by length, in an organised order.
| \(\text{length } 3\) | \(:\) | \(A\text{β}B\text{β}C\text{β}A,\ A\text{β}C\text{β}D\text{β}A,\ C\text{β}D\text{β}E\text{β}C\) |
| \(\text{length } 4\) | \(:\) | \(A\text{β}B\text{β}C\text{β}D\text{β}A,\ A\text{β}C\text{β}E\text{β}D\text{β}A\) |
| \(\text{length } 5\) | \(:\) | \(A\text{β}B\text{β}C\text{β}E\text{β}D\text{β}A\) |
There are \(3\) cycles of length \(3\), \(2\) of length \(4\) and \(1\) of length \(5\) (the longest, through every vertex): \(6\) cycles in all.
Common pitfalls
Frequently asked questions
What is the difference between a walk, a trail and a path?
A walk is any route along edges, and it may repeat vertices and edges. A trail is a walk with no repeated edge. A path is a walk with no repeated vertex, so it cannot repeat an edge either.
What is the difference between a circuit and a cycle?
Both start and finish at the same vertex. A circuit is a closed trail, so it may pass through a vertex more than once. A cycle is a closed path, so only the start and finish vertex repeats. Every cycle is a circuit.
What is the length of a walk?
The length of a walk is the number of edges it uses. It is one less than the number of vertices written in the route, counting repeats.
What is the shortest possible cycle?
In a simple graph a cycle needs at least 3 edges, so the shortest cycle is a triangle of length 3.
Can a bridge be part of a cycle?
No. If an edge were on a cycle, the rest of the cycle would give another way between its ends, so removing it could not disconnect the graph.
How do walks work in a directed graph?
A walk in a digraph must follow the direction of every arrow. A route that goes against an arrow is not a walk, even if the two vertices are joined.