Comparing MST Algorithms (Edexcel International AS Maths: Decision 1)

Revision Note

Naomi C

Author

Naomi C

Last updated

Comparing MST Algorithms

Which should I use - Prim’s or Kruskal’s algorithm?

  • Both algorithms find a minimum spanning tree
    • They may give different answers but both will produce a minimal solution
  • Prim’s algorithm can be used in either graph or matrix form
    • If an MST is asked for and the information is given in table/matrix form, use Prim’s algorithm
  • Kruskal’s algorithm can be used when the information is in graph form (or if a list of edges is available) 
    • If trying to use Kruskal's algorithm from a table/matrix, it is best to draw a graph first
  • Kruskal's algorithm allows edges to be added in any order
    • I.e. the tree can be 'split' (unconnected) at stages of the algorithm
    • Prim's algorithm 'builds' as edges are added such that they will connect to edges already in the tree
  • Prim’s algorithm is sometimes considered to be more efficient than Kruskal’s algorithm as
    • the edges do not need to be ordered at the start
    • it does not require checking for cycles at each step
  • An exam question will usually specify which method should be used, otherwise either is fine

Examiner Tip

  • A common exam question is to state that certain edges need to be included in a spanning tree
    • You are then asked to describe which algorithm you should use and how it should be adapted
    • You should start off by drawing in the edges given, and then complete the tree using Kruskal's algorithm!
      • This may not be a minimum spanning tree (depending on the edges that have to be included)

You've read 0 of your 5 free revision notes this week

Sign up now. It’s free!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Naomi C

Author: Naomi C

Expertise: Maths

Naomi graduated from Durham University in 2007 with a Masters degree in Civil Engineering. She has taught Mathematics in the UK, Malaysia and Switzerland covering GCSE, IGCSE, A-Level and IB. She particularly enjoys applying Mathematics to real life and endeavours to bring creativity to the content she creates.