Mathster Maths topics Free worksheets Coverage Mathster for schools

Maths topics › A level Further Maths › D1, algorithms and graphs

Find the shortest path between two vertices using Dijkstra's algorithm

A level Further Maths · D1, algorithms and graphs

A question

Use Dijkstra's algorithm to find the shortest route from \( U \) to \( E \) in this network. Complete the box at every vertex, then state the shortest route and its length.

Free worksheet

10 questions on this objective, ready to print.

Download the worksheet (PDF)

We use this address to send you the answers, and for news only if you tick the box.

Worked solution

The working

  1. Start at U: order 1, final value 0. Each time, update the working values of the vertices joined to the vertex just made permanent, then make the smallest working value permanent.
  2. U gets permanent label 0 (order 1). Update the working values: K: \(0 + 10 = 10\); N: \(0 + 12 = 12\).
  3. K gets permanent label 10 (order 2). Update the working values: A: \(10 + 12 = 22\); J: \(10 + 11 = 21\); N: \(10 + 11 = 21\), not better than 12.
  4. N gets permanent label 12 (order 3). Update the working values: A: \(12 + 5 = 17\) (better than 22); L: \(12 + 2 = 14\).
  5. L gets permanent label 14 (order 4). Update the working values: A: \(14 + 17 = 31\), not better than 17; F: \(14 + 8 = 22\).
  6. A gets permanent label 17 (order 5). Update the working values: E: \(17 + 7 = 24\); J: \(17 + 18 = 35\), not better than 21.
  7. J gets permanent label 21 (order 6). Update the working values: E: \(21 + 9 = 30\), not better than 24.
  8. F gets permanent label 22 (order 7). Update the working values: E: \(22 + 8 = 30\), not better than 24.
  9. E gets permanent label 24 (order 8).
  10. Table: A order 5, final value 17; E order 8, final value 24; F order 7, final value 22; J order 6, final value 21; K order 2, final value 10; L order 4, final value 14; N order 3, final value 12; U order 1, final value 0.
  11. (a) The length of the shortest route is the final value of E: 24.
  12. (b) Trace back from E, using edges whose weight equals the difference of the final values: UNAE, \((12 + 5 + 7) = 24\).
  13. Answers: (a) 24; (b) UNAE.

Mathster is maths homework, practice and assessment for schools, with animated worked solutions. Try Mathster free for 60 days →

Objectives from the AS and A level subject content for further mathematics (Department for Education). Contains public sector information licensed under the Open Government Licence v3.0.