All revision notes topics

Minimum spanning treesEdexcel A-Level Further Maths: Revision notes

Section 1

The minimum spanning tree problem

A spanning tree connects every vertex of a network with no cycles. A minimum spanning tree (minimum connector) is a spanning tree with the smallest possible total weight. It answers questions such as: what is the cheapest set of cables, pipes or roads that joins all the sites? A network with nn vertices has a spanning tree with exactly n−1n-1 edges. If all the weights are different, the minimum spanning tree is unique. If some weights are equal, there may be more than one. Two algorithms find it: Kruskal's and Prim's.

Key termsminimum spanning tree
Common mistake

Thinking the tree gives the shortest route between two vertices. It only minimises the total weight.

Section 2

Kruskal's algorithm

Kruskal's algorithm works on the list of edges.

  1. Sort the edges in increasing order of weight.
  2. Take the next edge. Accept it unless it would form a cycle with the edges already accepted, in which case reject it.
  3. Stop when n−1n-1 edges have been accepted. Example (six vertices, edges DE=3DE=3, AC=4AC=4, CD=5CD=5, BC=6BC=6, AB=7AB=7, CE=8CE=8, BD=9BD=9, EF=10EF=10, DF=12DF=12): accept DEDE, ACAC, CDCD, BCBC; reject ABAB (cycle ABCABC), CECE (cycle CDECDE) and BDBD (cycle BCDBCD); accept EFEF. That is 5 edges with total 3+4+5+6+10=283+4+5+6+10=28.
Key termsKruskal's algorithm
Common mistake

Rejecting an edge because it joins two vertices that are already in the tree. The test is whether the two ends are already connected, so it would form a cycle.

Exam tip

Write the sorted edge list with ticks and crosses. Showing the rejected edges and the reason earns method marks.

Section 3

Prim's algorithm

Prim's algorithm grows a single tree from any starting vertex.

  1. Choose any vertex to start the tree.
  2. Look at all edges joining a vertex in the tree to a vertex not in the tree. Add the one of smallest weight.
  3. Repeat until all vertices are in the tree. Example with edges AB=6AB=6, AC=9AC=9, BC=4BC=4, BD=8BD=8, CD=7CD=7, CE=5CE=5, DE=3DE=3 starting at AA: add AB(6)AB(6), then BC(4)BC(4), then CE(5)CE(5), then ED(3)ED(3). The total is 18. The tree is always connected as it grows, so cycles can never form.
Key termsPrim's algorithm
Exam tip

State the starting vertex and list arcs in the order added. A different starting vertex gives the same tree if weights are all different, but the order changes.

Section 4

Prim's algorithm on a matrix

When a network is given as a distance matrix, Prim's algorithm is applied directly to it.

  1. Choose a start vertex. Number its column 1 and delete its row.
  2. Look at the numbered columns. Among the entries in the rows not yet deleted, choose the smallest and circle it.
  3. The row of the circled entry is a new vertex. Number its column next, and delete its row.
  4. Repeat until all rows are deleted. The circled entries are the arcs of the tree. In the 5×55\times5 matrix for the example above, starting at AA gives circled entries AB=6AB=6, BC=4BC=4, CE=5CE=5, ED=3ED=3. Read the arcs in the order of the column numbers.
Key termsdistance matrix

Section 5

Matrices and networks

You may be asked to draw a network from a matrix or to write down the matrix of a network.

  • For an undirected network the matrix is symmetric: the entry in row XX, column YY equals the entry in row YY, column XX.
  • A dash (or blank) means there is no direct edge. Each edge appears twice, once above and once below the leading diagonal.
  • To count edges, count the numerical entries on one side of the diagonal.
  • To draw the network, plot a vertex for each row and join XX to YY with an edge labelled with the entry whenever it is a number. Removing an edge from the network changes the tree only if that edge was in it. Replace it with the cheapest remaining connection to the vertex it served.
Key termssymmetric matrix
Common mistake

Counting every number in the matrix as a separate edge. Each edge appears twice, so halve it.

That's the notes covered.

Carry on to the next subtopic.

Exam questions on Minimum spanning trees

  1. A network has six vertices AA, BB, CC, DD, EE and FF. Its edges and weights are AB=7AB=7, AC=4AC=4, BC=6BC=6, BD=9BD=9, CD=5CD=5, CE=8CE=8, DE=3DE=3, DF=12DF=12 and EF=10EF=10.
    Explain why Kruskal's algorithm rejects the edge ABAB.2 marks
  2. Five towns AA, BB, CC, DD, EE are linked by roads. The distance matrix (in km) is given row by row, with columns in the order AA to EE and a dash meaning no direct road. Row AA: −-, 66, 99, −-, −- Row BB: 66, −-, 44, 88, −- Row CC: 99, 44, −-, 77, 55 Row DD: −-, 88, 77, −-, 33 Row EE: −-, −-, 55, 33, −-
    The road DEDE is closed for repairs. Find the total length of the minimum spanning tree of the remaining roads.2 marks
  3. A company must connect six villages PP, QQ, RR, SS, TT and UU with cable. The possible links and their costs, in thousands of pounds, are PQ=14PQ=14, PR=9PR=9, QR=11QR=11, QS=8QS=8, RS=12RS=12, RT=10RT=10, ST=6ST=6, SU=13SU=13 and TU=7TU=7.
    Use Kruskal's algorithm to find a minimum spanning tree, listing the edges in the order they are considered and stating which are accepted and which rejected.3 marks
See the full worksheet

Written by the Exaim team, led by Shaun Daswani (Head of Upper Secondary, Improve ME Institute; MSc Financial Mathematics, Imperial College London; BSc, UCL) and Jason Daswani (operational lead, Improve ME Institute; LSE).