Menu
Sign up Sign in

AI HL · AHL 1

Graph Theory

AHL 1.3

Walks, trails, paths, circuits and cycles

AHL 1.3

Walks, trails, paths, circuits and cycles

Target: I can describe a walk by the list of vertices it visits, and give its length. (+3 more)

By the end of this section

Key points

Walks and their kinds

  • A walk is a route along edges. Its length is the number of edges. Write it as a list of vertices, such as A–B–D–E.
  • A trail is a walk with no repeated edge.
  • A path is a walk with no repeated vertex. Every path is a trail.
  • A circuit is a closed trail: it starts and ends at the same vertex. A cycle is a closed path: no vertex is repeated apart from the start and end. Every cycle is a circuit.

Listing routes

  • To list paths of length k from X to Y, take each neighbour of X, then each neighbour of that, and so on for k edges. Drop any route that repeats a vertex or does not end at Y.
  • To list cycles of length k from X, do the same, but the last vertex must be adjacent to X. In this course write a cycle and its reverse as two separate cycles.
  • Check each answer: every step is an edge, the length is right, and no vertex is repeated.

A trail that uses every edge

  • Find the degree of every vertex first. A trail that uses every edge once needs 0 or 2 vertices of odd degree.
  • With 2 odd vertices, the trail starts at one and ends at the other. With 0 odd vertices, the trail is a circuit and can start anywhere.
  • Cross off each edge as you use it. If you get stuck with edges unused, go back and choose differently.

Explore: walk along a graph

Press a vertex to start. Then press a vertex joined to where you are, again and again, to build a walk. The sentence says what kind of walk it is.

Graph

Length
Edges used
Vertices visited
Odd vertices

Press a vertex to start a walk.

  1. On Six towns, find a walk that is a trail but not a path. Then find a path that is not a trail. Which one is impossible?
  2. Try to use every edge exactly once. Where do you have to start? Tick the box: what do the odd vertices tell you?
  3. On the Triangles graph, find an Eulerian circuit. Then try to visit every vertex exactly once and return to the start. Why does it fail?
  4. On Königsberg, try to cross every bridge once. How many odd vertices are there, and why does that stop you?

Worked examples

Problems like the ones in class. Pick one, try it, then open the working.
Listing paths of a given length

List all the paths of length 3 from A to F in the graph. How many are there?

ABCDEF
Working
  1. What is a path of length 3?

    3 edges, 4 different vertices, from A to F

    A path is a walk with no repeated vertex. Its length is the number of edges.

  2. Work from A

    A has neighbours B and D. From B: C or D. From D: B or E.

    Take each first step in turn, then each second step, and keep only routes that can reach F on the third edge.

  3. Check the last step

    Only C and E are adjacent to F

    So the second vertex must lead to C or E.

  4. The paths

    A–B–C–F; A–D–E–F: 2 paths

    Check that no vertex appears twice in any route.

Video walkthrough coming
Listing cycles of a given length

List all the cycles of length 4 that start and end at C. Write a cycle and its reverse as two separate cycles.

ABCDEF
Working
  1. What is a cycle?

    A closed path: 4 different vertices, then back to C

    A cycle starts and ends at the same vertex and repeats no other vertex.

  2. Neighbours of C

    B, E, F

    The first step goes to one of these. The last step comes back from one of these.

  3. Search

    C–B–D–E–C works, and so does its reverse C–E–D–B–C. C–F–E–D then needs an edge D–C, which does not exist.

    Try each first step, then each second step, and check that the last vertex is adjacent to C.

  4. The cycles

    C–B–D–E–C; C–E–D–B–C

    The second is the first written backwards.

Video walkthrough coming
A trail that uses every edge once

Find a trail in this graph that uses every edge exactly once. What is its length?

ABCDE
Working
  1. Degrees

    A 2, B 4, C 2, D 3, E 3

    Only D and E have odd degree.

  2. Where to start

    Start at D (or E)

    A trail that uses every edge once can only start and end at the odd vertices. Pass through any other vertex and you use edges in pairs.

  3. Build the trail

    D–A–B–C–E–B–D–E

    Cross off each edge as you use it. Back up and try again if you get stuck with edges unused.

  4. Length

    7 edges, so length 7

    The trail has 8 vertices in the list.

Video walkthrough coming
Classifying a walk

In the graph, a walk is B–C–E–D–B–A–D. Classify it as a walk, trail, path, circuit or cycle, giving the most specific name.

ABCDEF
Working
  1. Is it a walk?

    Each pair of neighbours in the list is joined by an edge

    Check BC, CE, ED, DB, BA, AD in the graph.

  2. Repeated edges?

    BC, CE, ED, DB, BA, AD: all different

    No edge is repeated, so it is a trail.

  3. Repeated vertices?

    B and D appear twice

    A vertex is repeated, so it is not a path.

  4. Closed?

    Starts at B, ends at D

    It is not closed, so it is not a circuit or a cycle. It is a trail.

Video walkthrough coming