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 vertices has a spanning tree with exactly 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.
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.
- Sort the edges in increasing order of weight.
- Take the next edge. Accept it unless it would form a cycle with the edges already accepted, in which case reject it.
- Stop when edges have been accepted. Example (six vertices, edges , , , , , , , , ): accept , , , ; reject (cycle ), (cycle ) and (cycle ); accept . That is 5 edges with total .
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.
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.
- Choose any vertex to start the tree.
- Look at all edges joining a vertex in the tree to a vertex not in the tree. Add the one of smallest weight.
- Repeat until all vertices are in the tree. Example with edges , , , , , , starting at : add , then , then , then . The total is 18. The tree is always connected as it grows, so cycles can never form.
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.
- Choose a start vertex. Number its column 1 and delete its row.
- Look at the numbered columns. Among the entries in the rows not yet deleted, choose the smallest and circle it.
- The row of the circled entry is a new vertex. Number its column next, and delete its row.
- Repeat until all rows are deleted. The circled entries are the arcs of the tree. In the matrix for the example above, starting at gives circled entries , , , . Read the arcs in the order of the column numbers.
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 , column equals the entry in row , column .
- 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 to 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.
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
- A network has six vertices , , , , and . Its edges and weights are , , , , , , , and .Explain why Kruskal's algorithm rejects the edge .2 marks
- Five towns , , , , are linked by roads. The distance matrix (in km) is given row by row, with columns in the order to and a dash meaning no direct road.
Row : , , , ,
Row : , , , ,
Row : , , , ,
Row : , , , ,
Row : , , , , The road is closed for repairs. Find the total length of the minimum spanning tree of the remaining roads.2 marks
- A company must connect six villages , , , , and with cable. The possible links and their costs, in thousands of pounds, are , , , , , , , and .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
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).