- Subjects
- Maths AI
- Question bank
- 3.16 Tree and cycle algorithms
3.16 Tree and cycle algorithms questions for IB Maths AI
36 questions on Tree and cycle algorithms, written by Augment in the style of IB exam papers. Six of them are below in full, to answer on paper.
- IB Mathematics: Applications and Interpretation
- Part of 3 Geometry and trigonometry
- HL only
Questions by paper and level
| Paper | Questions |
|---|---|
| Paper 1 | 17 |
| Paper 2 | 18 |
| Paper 3 | 1 |
| Every paper | 36 |
Counted on
Questions to try
Written by Augment in the style of IB exams, not past papers. Answer them on paper, then check each one against its markscheme with a free account.
A university is laying fibre-optic cable to connect seven buildings, , , , , , and . The cable can only be laid along the service tunnels shown in the following graph. The weight of each edge is the length of the tunnel, in metres.

The university wants every building to be connected to the network using the least total length of cable.
- (a)
Use Kruskal's algorithm to find the minimum spanning tree of the graph. List the edges in the order in which they are added.
3 marks
- (b)
Write down the total length of cable needed.
1 mark
- (c)
The cable costs 12.40 Swiss francs (CHF) per metre. Calculate the cost of the cable.
2 marks
A mobile library van serves seven villages in rural Wales, , , , , , and . The roads between the villages are shown in the following graph. The weights are the lengths of the roads, in km.

- (a)
State, with a reason, whether the graph has an Eulerian trail.
2 marks
- (b)
The following table shows the least distances, in km, between the villages. Find the values of , , and .
–
24
42
20
26
24
–
31
42
44
19
31
–
18
45
41
42
18
–
27
49
23
42
45
27
–
22
16
20
44
49
22
–
38
26
19
41
23
16
38
–
2 marks
- (c)
The van is based at . Use the nearest neighbour algorithm, starting at , to find an upper bound for the length of a route that visits every village and returns to .
3 marks
- (d)
By deleting vertex and using Kruskal's algorithm on the table, find the minimum spanning tree of the remaining six vertices. Sketch the tree and write down its weight.
4 marks
- (e)
Hence find a lower bound for the length of the route.
2 marks
- (f)
Deleting vertex instead gives a lower bound of 142 km. Explain why the lower bound in part (e) is more useful.
1 mark
- (g)
Let be the length of the shortest route that visits every village and returns to . Write down the best inequality for found so far.
2 marks
The purpose of this question is to use graph theory to plan two kinds of inspection route around an irrigation network.
Valentina is the engineer for a vineyard cooperative near Mendoza, Argentina. Water is pumped between seven pumping stations, , , , , , and , along underground pipelines. A service track runs beside every pipeline. The graph shows the stations and the lengths of the service tracks, in km. Valentina's office is at station .

The total length of the service tracks is 64 km.
Once a year Valentina drives along every service track to check the pipelines for leaks.
- (a)
Explain why Valentina cannot start and finish at and drive along every service track exactly once.
2 marks
- (b)
Find the length of the shortest route that starts and finishes at and travels along every service track at least once.
5 marks
- (c)
In some years a colleague collects Valentina at the end of her inspection, so her route must start at but can finish at any station.
Determine where her route should finish to make it as short as possible, and find the length of this route.
3 marks
- (d)
Write down the adjacency matrix for the graph, with the vertices in the order .
2 marks
- (e)
Find the number of walks of length 4 from to .
2 marks
- (f)
Valentina also has to visit every pumping station to read its meters, starting and finishing at . She does not need to travel along every track. She draws up the following table of least distances, in km, between the stations.
5
6
4
13
8
7
11
10
3
9
13
12
5
6
12
7
7
4
Find the values of , and .
3 marks
- (g)
Use the nearest neighbour algorithm, starting at , to find an upper bound for the length of Valentina's meter-reading route.
3 marks
- (h)
By first deleting vertex , use the deleted vertex algorithm to find a lower bound for the length of this route.
4 marks
- (i)
Valentina finds that deleting vertex instead gives a lower bound of 35 km.
Find a cycle that visits every station and has a length less than your answer to part (g). Hence state the narrowest interval, from this question, that must contain the length km of the shortest meter-reading route.
3 marks
- (j)
Explain why, if Valentina drives the route found in part (g), she will pass through one of the stations twice.
1 mark
A farm has six water storage tanks, , , , , and . Pipes can be laid directly between any two tanks. The following table shows the length, in metres, of pipe needed between each pair of tanks.
– | 34 | 51 | 28 | 46 | 60 | |
34 | – | 25 | 39 | 57 | 44 | |
51 | 25 | – | 48 | 31 | 37 | |
28 | 39 | 48 | – | 42 | 53 | |
46 | 57 | 31 | 42 | – | 35 | |
60 | 44 | 37 | 53 | 35 | – |
The farmer, Amaru, wants to connect all six tanks using the minimum total length of pipe.
- (a)
Use Prim's algorithm, starting at , to find the minimum spanning tree. Show clearly the order in which the edges are selected.
4 marks
- (b)
Find the minimum total length of pipe needed.
2 marks
Eleni sells handmade jewellery on five Greek islands, , , , and . She lives on island . The following table shows the cost, in euros (EUR), of a ferry ticket between islands. There is no direct ferry between and .
– | 38 | 45 | 29 | 47 | |
38 | – | 33 | – | 41 | |
45 | 33 | – | 42 | 36 | |
29 | – | 42 | – | 49 | |
47 | 41 | 36 | 49 | – |
- (a)
The table is represented by a graph whose vertices are the islands and whose edges are the direct ferry routes. Explain why this graph is not complete.
1 mark
- (b)
Use Kruskal's algorithm to find the minimum spanning tree of the graph. State the order in which the edges are added and the weight of the tree.
3 marks
- (c)
Hence write down an upper bound for the cost of a trip that starts and finishes at and visits every island.
1 mark
- (d)
Write down the least cost of travelling between and .
1 mark
- (e)
Use the nearest neighbour algorithm, starting at , to find a better upper bound for the cost of the trip.
3 marks
- (f)(i)
By deleting vertex , find a lower bound for the cost of the trip.
3 marks
- (f)(ii)
By deleting vertex , find a second lower bound for the cost of the trip.
3 marks
- (g)
Let be the cost of Eleni's cheapest trip. Using your answers, write down the best inequality for .
2 marks
- (h)
Find a trip that starts and finishes at and costs less than the upper bound in part (e). State its cost.
2 marks
After a snowstorm, a plough must clear every road in a small town in Norway. The roads and their lengths, in km, are shown in the following graph. The plough is kept at the depot at junction .

- (a)
Write down the vertices of odd degree.
1 mark
- (b)
The plough must travel along every road at least once, starting and finishing at . Find the minimum distance it must travel.
3 marks
- (c)
Write down the roads that the plough travels along twice.
1 mark
- (d)
The plough travels at an average speed of . Find the time it takes to complete the route in part (b), in minutes.
2 marks
Practice all 36 in Augment
Free with an account. Every question has its markscheme, and Augment keeps the ones you got wrong so you can come back to them.
More questions in Geometry and trigonometry
- 3.1Volume and surface area in three dimensions
- 3.2Trigonometry in triangles
- 3.3Applications of trigonometry
- 3.4Arcs and sectors
- 3.5Perpendicular bisectors
- 3.6Voronoi diagrams
- 3.7Radian measure
- 3.8The unit circle and trigonometric equations
- 3.9Matrix transformations
- 3.10Vectors
- 3.11Vector equations of lines
- 3.12Vectors in kinematics
- 3.13Scalar and vector products
- 3.14Graph theory
- 3.15Adjacency matrices
- 3.16Tree and cycle algorithmsThis page
More on Tree and cycle algorithms
Check your answers in Augment
A free account opens all 36 questions on Tree and cycle algorithms with their markschemes, and keeps a record of what you have marked.