Skip to content

Edexcel A-level Further Maths revision notes

Algorithms on graphs

Section D1-2
Both years
Both years: this holds AS subject content and content the exam board adds beyond it for the full A-level.
2 specification points

Notes and three levels of exam-style practice for each registered specification point in this section.

Checked against Edexcel 9FM0 section D1-2

Checked against Edexcel 9FM0 section D1-2. Review basis: the qualification registry sourced from the Pearson Edexcel Level 3 Advanced GCE in Further Mathematics (9FM0) specification; registry verification recorded 17 July 2026.

How this checking works

In the exam: Formulae booklet provided · calculator allowed in every paper

Open the printable pack
D1-2.1

The minimum spanning tree (minimum connector) problem. Prim's and Kruskal's algorithm.

Notes
Evidence from your answers: none yet
Your confidence:

A self-report of how sure you feel. It does not measure mastery. Evidence from your answers reaches secure after the latest Tier 2/3 attempt is correct, with three correct distinct drills across at least two dates and two practice sources.

Explanation

  • A spanning tree of a connected network on nn vertices uses every vertex and exactly n1n-1 arcs and contains no cycle; the minimum spanning tree, or minimum connector, is the one of least total weight.
  • Kruskal's algorithm sorts every arc into ascending order of weight and then adds arcs one at a time, rejecting any arc that would form a cycle, stopping once n1n-1 arcs are in the tree.
  • Prim's algorithm grows a single tree from a chosen start vertex: at each stage it adds the shortest arc joining a vertex already in the tree to a vertex not yet in it, and it never needs a cycle check because one endpoint is always outside the tree.
  • Prim's algorithm also runs directly on a distance matrix: delete the row of the newly connected vertex, label its column, and scan every labelled column for the smallest uncrossed entry.
  • Both algorithms return a tree of the same minimum weight, though the arcs may be listed in a different order and different trees of equal weight can occur when weights are repeated.
Worked example

A network has vertices AA, BB, CC, DD and arcs AB=8AB=8, AC=3AC=3, AD=9AD=9, BC=5BC=5, BD=7BD=7, CD=6CD=6. Use Kruskal's algorithm to find the minimum spanning tree.

  1. 1.In ascending order the arcs are AC=3AC=3, BC=5BC=5, CD=6CD=6, BD=7BD=7, AB=8AB=8, AD=9AD=9.
  2. 2.Accept ACAC; accept BCBC; accept CDCD.
  3. 3.The tree now has 3=413=4-1 arcs, so the algorithm stops; BDBD, ABAB and ADAD would all create cycles.
  4. 4.The total weight is 3+5+6=143+5+6=14.

Answer: The minimum spanning tree uses ACAC, BCBC and CDCD and has weight 1414.

Common mistakes

  • Don't fall into the trap of continuing past n1n-1 arcs, or stopping before every vertex is connected.
  • Don't fall into the trap of sorting the arcs for Prim's algorithm, which is a Kruskal step and wastes time.
  • Don't fall into the trap of deleting a column instead of a row in the matrix form of Prim's algorithm, or forgetting to scan every labelled column.

Exam tip

State the arcs in the order your algorithm selects them; examiners award marks for the correct selection order as well as the final weight.

Tier 1 · Easy

ORIGINAL

1.

A network has vertices AA, BB, CC, DD, EE and arcs AB=6AB=6, AC=4AC=4, BC=3BC=3, BD=9BD=9, CD=5CD=5, CE=8CE=8, DE=7DE=7. Use Kruskal's algorithm to find a minimum spanning tree, listing the arcs in the order you consider them, and state its total weight.

(5)

(Total for Question 1 is 5 marks)

Tier 2 · Standard

ORIGINAL

1.

A network has vertices AA to FF and arcs AB=9AB=9, AC=5AC=5, AD=12AD=12, BC=7BC=7, BE=8BE=8, CD=6CD=6, CE=11CE=11, CF=13CF=13, DF=10DF=10, EF=4EF=4. Use Prim's algorithm starting at AA to find a minimum spanning tree, stating the arcs in the order they are added and the total weight.

(6)

(Total for Question 1 is 6 marks)

Tier 3 · Hard

ORIGINAL

1.

Apply Prim's algorithm starting at AA to the network with vertices AA to GG and arcs AB=14AB=14, AC=10AC=10, AD=17AD=17, BC=8BC=8, BE=13BE=13, CD=9CD=9, CE=16CE=16, CF=21CF=21, DF=12DF=12, EF=7EF=7, EG=19EG=19, FG=11FG=11. State the order in which the vertices join the tree, the arcs used, and verify that the weight agrees with Kruskal's answer of 5757.

(7)

(Total for Question 1 is 7 marks)

Your progress and exam materials

This section: Evidence from your answers: 0/2 secureYour confidence: 0 self-rated secureTracker status: 0/2 secure, 0 shaky, 2 unseen

Overall: Evidence from your answers: 0/116 secureYour confidence: 0 self-rated secureTracker status: 0/116 secure, 0 shaky, 116 unseen

Progress is saved on this device for guests and accounts right now; cross-device account sync is not live yet.

D1-2.2

Dijkstra's and Floyd's algorithm for finding the shortest path.

Notes
Evidence from your answers: none yet
Your confidence:

A self-report of how sure you feel. It does not measure mastery. Evidence from your answers reaches secure after the latest Tier 2/3 attempt is correct, with three correct distinct drills across at least two dates and two practice sources.

Explanation

  • Dijkstra's algorithm finds the shortest path from one start vertex to every other. Each vertex carries a box with three entries: the order of labelling, the final label, and a list of working values.
  • Give the start vertex final label 00, then repeatedly choose the smallest working value anywhere in the network, make it final,
  • and update every unlabelled neighbour with the sum of the new final label and the connecting arc, recording the new value only if it beats the values already there. To recover the route, trace back from the end vertex, keeping an arc XYXY whenever the final label of YY minus the final label of XX equals the weight of XYXY.
  • Floyd's algorithm instead finds the shortest distance between every pair. Start with the distance matrix and a route matrix whose column jj is filled with jj.
  • On iteration kk compare each entry dijd_{ij} with dik+dkjd_{ik}+d_{kj}; if the route through kk is shorter, replace dijd_{ij} and set the route entry rijr_{ij} to rikr_{ik}. Iteration kk works on the kkth row and column, and after nn iterations the matrices are complete.
Worked example

In a network with vertices AA, BB, CC, DD and arcs AB=4AB=4, AC=7AC=7, BC=2BC=2, BD=8BD=8, CD=3CD=3, use Dijkstra's algorithm from AA to find the shortest path to DD.

  1. 1.AA is labelled first with final label 00.
  2. 2.Working values become B=4B=4 and C=7C=7; the smaller is BB, labelled second with final label 44.
  3. 3.From BB, CC receives 4+2=64+2=6, which beats 77, and DD receives 4+8=124+8=12; CC is labelled third with final label 66.
  4. 4.From CC, DD receives 6+3=96+3=9, which beats 1212, so DD is labelled fourth with final label 99.

Answer: The shortest path is ABCDABCD with length 99, found by tracing back from DD through the arcs whose weights match the differences in final labels.

Common mistakes

  • Don't fall into the trap of overwriting a working value with a larger number instead of keeping the smallest so far.
  • Don't fall into the trap of updating a vertex that already has a final label.
  • Don't fall into the trap of changing a Floyd route entry to kk rather than to the current value of rikr_{ik}.

Exam tip

Never rub out a working value: examiners award marks for the full list of working values in each box, and the crossed-out values show the algorithm was followed.

Tier 1 · Easy

ORIGINAL

1.

A network has vertices AA, BB, CC, DD, EE and arcs AB=4AB=4, AC=7AC=7, BC=2BC=2, BD=8BD=8, CD=3CD=3, CE=9CE=9, DE=5DE=5. Use Dijkstra's algorithm from AA to find the final label of every vertex and the shortest path from AA to EE.

(6)

(Total for Question 1 is 6 marks)

Tier 2 · Standard

ORIGINAL

1.

A network has vertices AA to FF and arcs AB=5AB=5, AC=8AC=8, BC=2BC=2, BD=9BD=9, CD=4CD=4, CE=7CE=7, DF=6DF=6, EF=4EF=4. Use Dijkstra's algorithm from AA to complete every box and find the shortest route from AA to FF.

(7)

(Total for Question 1 is 7 marks)

Tier 3 · Hard

ORIGINAL

1.

For the network on AA, BB, CC, DD with AB=7AB=7, AD=4AD=4, BC=3BC=3, CD=2CD=2 and no direct arcs ACAC or BDBD, complete Floyd's algorithm and write down the final distance matrix and final route matrix. Use them to state the shortest route from AA to CC and from BB to DD.

(8)

(Total for Question 1 is 8 marks)

Want help turning these notes into marks?

Bring a tricky specification point or a recent answer, and we can work through the method and exam wording together.