Skip to main content
EnglandFurther MathsSyllabus dot point

How do standard algorithms find minimum spanning trees, shortest paths and good routes through a network?

Kruskal's and Prim's algorithms for minimum spanning trees, Dijkstra's algorithm for the shortest path, and the route inspection and travelling salesperson problems.

A focused answer to the AQA A-Level Further Mathematics network algorithms content, covering Kruskal's and Prim's algorithms for minimum spanning trees, Dijkstra's algorithm for the shortest path, and the route inspection and travelling salesperson problems.

Generated by Claude Opus 4.811 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. Minimum spanning trees
  3. Dijkstra's algorithm
  4. Route inspection and travelling salesperson

What this dot point is asking

AQA wants you to apply Kruskal's and Prim's algorithms to find a minimum spanning tree, use Dijkstra's algorithm to find the shortest path between two vertices, solve the route inspection (Chinese postman) problem, and find upper and lower bounds for the travelling salesperson problem.

Minimum spanning trees

Prim's algorithm reaches the same tree by a different route: it grows a single connected tree outward from a chosen start vertex, at each step adding the cheapest edge that joins a new vertex to the tree so far. Prim's never needs an explicit cycle check, because it only ever reaches out to vertices not yet included, which makes it well suited to the matrix form of the algorithm where you cross out columns as vertices join.

Dijkstra's algorithm

Both algorithms always return a minimum spanning tree, but they suit different question formats. Kruskal's works from a sorted edge list and is natural when the network is given as a list of weighted edges; its only subtlety is the cycle check, usually done by tracking which vertices are already joined into the same component. Prim's works from the network's distance matrix, crossing out the column of each newly added vertex and scanning the rows of the joined vertices for the smallest uncrossed entry, which makes it the method examiners pair with a matrix presentation. When edge weights are all distinct the minimum spanning tree is unique, so both algorithms must produce the same tree, a fact you can use to check your work.

Route inspection and travelling salesperson

Route inspection (the Chinese postman problem) finds the least total distance of a closed route that traverses every edge at least once. If every vertex has even degree the network already has an Eulerian circuit and no edge needs repeating, so the answer is just the sum of all edge weights. Otherwise you list the odd-degree vertices (there is always an even number of them), pair them up in every possible way, find the shortest path between each pair, and choose the pairing whose total is smallest. That smallest total is the extra distance added to the sum of all edges, because those paths are the edges you walk twice.

The travelling salesperson problem visits every vertex exactly once and returns to the start with least total distance, and unlike route inspection it has no efficient exact algorithm, so the exam asks for bounds instead. The nearest-neighbour algorithm gives an upper bound: start at a vertex, repeatedly go to the nearest unvisited vertex, then return to the start. A lower bound comes from deleting one vertex, finding a minimum spanning tree of the remaining network, and adding back the two shortest edges from the deleted vertex. The true optimum lies between the best lower bound and the best upper bound, and a question is effectively solved when the two bounds coincide.

Exam-style practice questions

Practice questions written in the style of AQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

AQA 20196 marksA network has vertices A, B, C, D, E with edges AB(5), AC(3), BC(4), BD(6), CD(7), CE(8), DE(2). Use Kruskal's algorithm to find a minimum spanning tree, listing the edges in the order chosen, and state its total weight.
Show worked answer →

Kruskal's algorithm: sort the edges by weight, then add the cheapest unused edge that does not create a cycle, until n1=4n - 1 = 4 edges are chosen.

Sorted edges: DE(2), AC(3), BC(4), AB(5), BD(6), CD(7), CE(8).

Add DE(2): accepted. Add AC(3): accepted. Add BC(4): accepted (connects B to the A-C component). Add AB(5): rejected, it would form a cycle A-B-C-A. Add BD(6): accepted, connecting D to the rest. Now 44 edges are chosen, so stop.

Minimum spanning tree edges in order: DE, AC, BC, BD. Total weight =2+3+4+6=15= 2 + 3 + 4 + 6 = 15.

Markers reward sorting by weight, the cycle rejection of AB, choosing exactly 44 edges, and the total weight 1515.

AQA 20217 marksApply Dijkstra's algorithm to find the shortest distance from A to E in a network with edges AB(4), AC(2), BC(1), BD(5), CD(8), CE(10), DE(2). Show the order in which vertices receive permanent labels.
Show worked answer →

Assign A the permanent label 00. Update neighbours: B gets working value 44, C gets 22.

Smallest working value is C at 22: make C permanent (order 2). Update from C: B via C is 2+1=32 + 1 = 3 (better than 44, so B becomes 33); D via C is 2+8=102 + 8 = 10; E via C is 2+10=122 + 10 = 12.

Smallest working value is B at 33: make B permanent (order 3). Update from B: D via B is 3+5=83 + 5 = 8 (better than 1010, so D becomes 88).

Smallest working value is D at 88: make D permanent (order 4). Update from D: E via D is 8+2=108 + 2 = 10 (better than 1212, so E becomes 1010).

Make E permanent (order 5) at 1010. The shortest distance from A to E is 1010, via the route A, C, B, D, E.

Markers reward correct permanent-labelling order (A, C, B, D, E), the working-value updates, and the final shortest distance 1010 with its route.

Related dot points

Sources & how we know this