Skip to content
  1. Home
  2. IB Question Bank
  3. Math AI
  4. Geometry & Trigonometry
  5. MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman
Topic 3.19 · HL only · 9 min read

IB Math AI MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman practice questions and question bank

Notes on what MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman covers and how it is examined, then 4 IB-style practice questions with hints.

Jump to 4 questions
  • Aligned to the current IB syllabus
  • Marked mark by mark, IB-style
  • Free to start, no card needed

Summary

  • Graph Terminology:
  • Complete Graph: Each vertex connected to every other.
  • Weighted Graph: Edges have numerical values (weights).
  • Directed Graph: Edges have direction; in-degree is number of edges leading to a vertex.
  • Trail: A walk with no repeated edges.
  • Circuit: A trail that begins and ends at the same vertex.
  • Path: A walk with no repeated vertices.
  • Cycle: A path that starts and ends at the same vertex.
  • Spanning Tree: A subgraph that is a tree, contains all vertices, has no cycles, and has `V−1V-1` edges (where `VV` is the number of vertices).
  • Minimum Spanning Tree (MST): A spanning tree with the lowest possible total edge weight.
  • Kruskal's Algorithm (MST):
  • Sort all edges by increasing weight.
  • Select the edge of least weight.
  • Select the next least weight edge that does not form a cycle with previously chosen edges.
  • Repeat until all vertices are connected.
  • Prim's Algorithm (MST - Graph):
  • Start at any vertex, choose the least weight edge connected to it.
  • Choose the least weight edge incident to any vertex already in the tree, ensuring it does not form a cycle.
  • Repeat until all vertices are added to the tree.
  • Prim's Algorithm (MST - Matrix):
  • Select a starting vertex, cross out its column, label its row '1'.
  • Circle the lowest value in the labelled row, add the edge, cross out the column of the new vertex.
  • Label the new vertex's row. Circle the lowest value in any currently labelled row, add the edge, cross out the column of the new vertex.
  • Repeat until all rows are labelled.
  • Chinese Postman Problem (CPP): Find the route of least weight that starts and finishes at the same vertex and traverses every edge at least once.
  • All vertices have even degree: The shortest route is the sum of all edge weights.
  • Two odd vertices: Find the shortest path between them; add its weight to the total sum of all graph edges.
  • Four odd vertices: Consider all three possible pairings of odd vertices. Find the shortest path for each pair. Choose the pairing with the lowest combined repeated distance and add this to the total sum of all graph edges.
  • Travelling Salesman Problem (TSP): Find the route of least weight that starts and finishes at the same vertex and visits every other vertex exactly once.
  • Nearest Neighbour Algorithm (TSP Upper Bound):
  • Choose a starting vertex.
  • Follow the edge of least weight from the current vertex to an unvisited adjacent vertex.
  • Repeat until all vertices have been visited.
  • Add the final edge to return to the starting vertex.
  • Deleted Vertex Algorithm (TSP Lower Bound):
  • Choose a vertex, delete it and all its incident edges.
  • Find the MST of the remaining graph.
  • Add the weights of the two shortest edges (from the original graph) that were connected to the deleted vertex to the MST weight.
  • The best lower bound is the highest value obtained by deleting different vertices.
  • GDC Use: Use for summing edge weights; explicitly write down values for method marks.
  • Exam Tips:
  • Distinguish between trails/circuits (focus on edges, CPP) and paths/cycles (focus on vertices, TSP).
  • State the order in which edges are selected for MST algorithms.
  • Look for hidden shorter routes between vertices (indirect paths).
  • Do not confuse Prim's (builds a tree, multiple circles in a labelled row possible) with Nearest Neighbour (builds a path, only one circle per column) when using tables.
  • Lower bound table entries may represent combinations of edges, not just direct connections.
  • Tables for undirected graphs are symmetric along the leading diagonal.

How it is examined

A long-question favourite because it has a natural sequence: identify odd vertices, run an algorithm, state a bound, then interpret. Two constraints define what is legal: no more than four odd vertices for a Chinese postman problem, and a practical travelling salesman problem must be reduced to the classical one via a table of least distances. Note that upper and lower bounds are asked for separately, and the deleted vertex algorithm gives the lower bound, which is the pairing students most often reverse. Students are asked to explain and justify here, not only to compute, so the marks are not all method marks.

Key ideas
  • Tree and cycle algorithms with undirected graphs.
  • Walks, trails, paths, circuits, cycles.
  • Eulerian trails and circuits.
  • Hamiltonian paths and cycles.

Practice questions

4 questions · 1 medium · 3 hard
Showing 4 of 4

Question 1

MediumPaper 1 · calculator13 marks
(a)(i)

A team of scientists needs to establish communication links between six remote research outposts (R1, R2, R3, R4, R5, R6) in an arctic region. The cost, in thousands of dollars, to lay a direct cable between any two outposts is shown in the table below.

From/ToR1R2R3R4R5R6
R1-70856095110
R270-50754080
R38550-356590
R4607535-5570
R595406555-45
R611080907045-

The data above can be represented by a graph G.

Use Prim's algorithm to find the weight of the minimum spanning tree of the subgraph of G obtained by deleting R1 and starting at R2. List the order in which the edges are selected.

[6]
(a)(ii)

Hence find a lower bound for the total cost needed to establish a full communication circuit visiting all outposts, starting and finishing at R1.

[6]
(b)

Describe how an improved lower bound might be found.

[1]

Question 2

HardPaper 1 · calculator5 marks
(a)

A data network connects several hubs, represented by vertices A, B, C, D, E. The numbers on the edges represent the cost (in hundreds of dollars) to lay a new fibre optic cable between two hubs. An engineer needs to inspect all existing cables.

Weighted graph with vertices A, B, C, D, E and edges with weights, including one labeled x. Edges are AB=6, BC=4, CD=7, DE=5, EA=3, BD=2, AC=x. All weights are positive.

Write down the vertices with odd degree.

[1]
(b)

The total cost of all existing cables is 2700+100x2700 + 100x dollars. The engineer wants to traverse every cable in the network, starting and ending at the same hub, while minimizing the total distance travelled. This may involve traversing some cables more than once.

Find two expressions, in terms of xx, for the minimum total cost (in hundreds of dollars) required to traverse all cables, beginning and ending at the same hub.

Include in your answer the interval of values of xx for which each expression is valid.

[4]

Question 3

HardPaper 2 · calculator17 marks
(a)

The vertices in the following graph represent seven distribution hubs (V1 to V7). The edges represent direct transport routes. The weight on each edge represents the distance, in kilometres, between the two connected hubs.

Graph showing seven distribution hubs (V1-V7) as vertices and transport routes as edges with weights representing distances.

Determine whether it is possible for a delivery driver to complete a route that starts and finishes at different hubs, using each transport route exactly once. Give a reason for your answer.

[2]
(b)

The shortest distance, in kilometres, between any two hubs is given in the table.

V1V2V3V4V5V6V7
V1-1015a242520
V210-81514b24
V3158-71611c
V422157-91513
V5d14169-611
V6251911156-5
V720241613115-

Find the values of aa, bb, cc, and dd.

[2]
(c)

Use the nearest neighbour algorithm, starting at hub V7, to find an upper bound for the travelling salesman problem.

[3]
(d)(i)

Sketch a minimum spanning tree for the subgraph formed by removing hub V7.

[3]
(d)(ii)

Write down the total weight of the minimum spanning tree.

[1]
(e)

Hence find a lower bound for the travelling salesman problem.

[2]
(f)

Explain one way in which an improved lower bound could be found.

[1]
(g)

The optimal solution for the travelling salesman problem, starting at V1, is V1−V2−V3−V4−V5−V6−V7−V1V1-V2-V3-V4-V5-V6-V7-V1. Given that the length of each transport route shown on the graph is given to the nearest kilometre, find the lower bound for the total distance in the optimal solution.

[3]

Question 4

HardPaper 2 · calculator17 marks
(a)

The following table shows the average transmission times in milliseconds (ms) for direct data packets between six deep-space observatories. Blank cells indicate no direct data link. The rows represent the sending observatory. The columns represent the receiving observatory.

O1O2O3O4O5O6
O1-120180---
O2120--90150-
O3180--200-220
O4-90200-110160
O5-150-110-250
O6--220160250-

Show the direct data links between the observatories as a graph.

[2]
(b)

Write down the adjacency matrix for this graph, assuming the observatories are ordered O1, O2, O3, O4, O5, O6.

[2]
(c)

Using your answer to part (b), find the number of different ways to transmit data from and return to observatory O1 in exactly 4 hops.

[2]
(d)

State whether or not it is possible to transmit data from and return to observatory O1 in exactly 6 hops, having visited each of the other 5 observatories exactly once. Justify your answer.

[2]
(e)

The following table shows the least transmission time (in ms) to travel between the observatories.

O1O2O3O4O5O6
O10120180a270370
O2120030090150b
O31803000200310220
O4a902000110160
O52701503101100250
O6370b2201602500

Find the values of aa and bb.

[2]
(f)

A research team needs to visit each of the observatories, starting and finishing at observatory O1. Use the nearest neighbour algorithm to find an upper bound for the total transmission time of the trip.

[3]
(g)

By deleting observatory O1, use the deleted vertex algorithm to find a lower bound for the total transmission time of the trip.

[4]

1,013 more IB Math AI questions in the app

Every answer is marked mark by mark, IB-style, and the AI tutor helps when you are stuck.

Where marks are lost

  • Using your own wrong value after failing a "show that." All follow through is withdrawn for the rest of that question.
  • Leaving an answer in calculator notation. Never accepted in a final answer, and AI's constant calculator use makes this the easiest slip in the whole subject.

Links to other topics and subjects

  • Other contexts: using GPS to find the shortest route home; describing current and voltage in circuits as cycles; vehicle routing problems.
  • International-mindedness: the "Bridges of Konigsberg" problem. The Chinese postman problem was first posed by the Chinese mathematician Kwan Mei-Ko in 1962.
  • TOK: what practical problems can or does mathematics try to solve? Why are problems such as the travelling salesman problem so enduring? What does it mean to say the travelling salesman problem is "NP hard"?
Free. Every IB subject.
No card, no trial that runs out. Just a free account.
  • 50 marked answers a month
    Marked mark by mark, IB-style
  • Hints and mark schemes
    On every part of every question
  • 3,000+ questions
    All 6 subjects, SL and HL, mapped to the syllabus
  • Progress that adapts
    Your Study Profile picks what to practise next

Practise this topic as a session

Pick a difficulty and paper, and FourtyFive tracks your progress on this topic as you go.

or with email
FAQ

Questions,
answered.

Can't find what you're looking for? Email our student team.

What does MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman cover in IB Maths AI?

Graph Terminology:. Complete Graph: Each vertex connected to every other. Weighted Graph: Edges have numerical values (weights).

Is MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman SL or HL?

MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman is HL only. SL students are not examined on it.

How do I revise MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman for IB Maths AI?

Start from the core idea: graph Terminology:. In the exam: a long-question favourite because it has a natural sequence: identify odd vertices, run an algorithm, state a bound, then interpret. Two constraints define what is legal: no more than four odd vertices for a Chinese postman problem, and a practical travelling salesman problem must be reduced to the classical one via a table of least distances. Then practise exam-style questions, easiest first, writing out every step of your working before you check it.

How does FourtyFive help me practise MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman?

FourtyFive has 4 MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman questions. Every answer you write is marked mark by mark, IB-style, and you see where each mark was won or lost. Every part has a hint, the AI tutor helps you through the step you are stuck on, and your Study Profile picks what to practise next.

Is FourtyFive free for MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman practice?

Yes. A free account gives you 50 marked answers a month, and you do not need a card to sign up.

Can I handwrite MST algorithms (prim’s, Kruskal’s), Chinese postman, travelling salesman answers on an iPad?

Yes. In the FourtyFive iPad app you write your working by hand with Apple Pencil, the way you would on paper, and it is marked the same way.

Start with the IB question
bank built for you.

Free to start, no card needed. Thousands of syllabus-mapped questions, AI Examiner marking, your weakest topics first.