Home › IB Maths AI HL › Exam practice › Graph Theory

IB Maths AI HL · Unit 3

Graph Theory: AI HL exam practice with markscheme

Covers graph theory: adjacency & weighted matrices; minimum spanning trees (Kruskal's & Prim's algorithms); travelling salesman problem: upper & lower bounds; route inspection & the Chinese postman problem; shortest-path (Dijkstra's) algorithm. Work through the 10 questions on paper as if it were the exam, then open each solution and mark your work against the markscheme.

10 questions · 31 marks · about 37 minutes · 5 Paper 1 style, 5 Paper 2 style

Download the PDF 5 pages, worked solutions after the questions

Question 1

2 marks · Paper 1 style · calculator allowed

A complete graph Kn has n vertices where every vertex is connected to every other vertex by exactly one edge. Calculate the exact number of edges in a complete graph K6.

[2]

Show solution

Each of the n vertices joins the other n−1 vertices and each edge is counted twice, so the number of edges is n(n−1)2. M1
For K6: 6×52=15 edges. A1
(Alternative: 5+4+3+2+1=15.)

Answer: 15

Question 2

3 marks · Paper 1 style · calculator allowed

The adjacency matrix A for a graph with 3 vertices is A=(011101110). Calculate the exact number of walks of length 3 that start and end at vertex 1.

[3]

Show solution

Walks of length 3 from vertex 1 to vertex 1 are given by the (1,1) entry of A3 M1
A2=(211121112); (1,1) entry of A3=A2A: (2)(0)+(1)(1)+(1)(1) (M1)
Number of walks =2 A1

Answer: 2

Question 3

2 marks · Paper 1 style · calculator allowed

A graph has vertices A, B, C, D with weighted adjacency: AB=3, AC=7, BC=2, BD=6, CD=1.

Find the shortest distance from A to D. [2]

Show solution

A→B→C→D M1

6 A1

Answer: 6

Question 4

2 marks · Paper 1 style · calculator allowed

A connected graph has vertex degrees 2,3,3,4,2.

State, with a reason, whether the graph has an Eulerian circuit, an Eulerian trail, or neither. [2]

Show solution

exactly two odd vertices R1

Eulerian trail (not a circuit) A1

Answer: an Eulerian trail

Question 5

3 marks · Paper 2 style · calculator allowed

Use Kruskal's algorithm to find the minimum spanning tree of the graph with edges PQ=7, PR=5, QR=4, QS=6, RS=9, RT=8, ST=3.

Find the total weight of the minimum spanning tree. [3]

Show solution

choose ST=3, QR=4, PR=5, QS=6 M1A1

18 A1

The road network (PQ 7, PR 5, QR 4, QS 6, RS 9, RT 8, ST 3) with the minimum spanning tree in red: ST 3, QR 4, PR 5 and QS 6, total weight 18.
Kruskal: ST, QR, PR, QS; total 18

Answer: 18

Question 6

4 marks · Paper 2 style · calculator allowed

A weighted graph has edges AB=4, AC=2, BC=1, BD=5, CD=8, CE=10, DE=2, DF=6, EF=3.

Use Dijkstra's algorithm to find the shortest route from A to F and its length. [4]

A weighted network with vertices A to F and edges AB 4, AC 2, BC 1, BD 5, CD 8, CE 10, DE 2, DF 6 and EF 3.
Find the shortest route from A to F
Show solution

labels C=2, B=3, D=8, E=10 M1A1

F=13 A1

A→C→B→D→E→F A1

The network (AB 4, AC 2, BC 1, BD 5, CD 8, CE 10, DE 2, DF 6, EF 3) with the shortest route in red: A to C (2), C to B (1), B to D (5), D to E (2), E to F (3), total 13.
Shortest route ACBDEF, length 13

Answer: 13, via ACBDEF

Question 7

4 marks · Paper 2 style · calculator allowed

A road network has edges (lengths in km) PQ=7, PR=5, QR=4, QS=6, RS=9, RT=8, ST=3. A gritter must drive along every road and return to the start.

Find the length of the shortest route. [4]

A road network with vertices P, Q, R, S, T and roads PQ 7, PR 5, QR 4, QS 6, RS 9, RT 8 and ST 3 km.
Road lengths in km
Show solution

odd vertices Q and S A1

shortest Q to S: QS=6 M1A1

42+6=48 km A1

The road network (PQ 7, PR 5, QR 4, QS 6, RS 9, RT 8, ST 3) with odd vertices Q and S. The road QS, 6 km, is driven twice (red): 42 + 6 = 48 km.
Repeat QS: 42 + 6 = 48 km

Answer: 48 km

Question 8

4 marks · Paper 2 style · calculator allowed

A complete graph on A, B, C, D has weights AB=5, AC=8, AD=6, BC=4, BD=7, CD=3.

Use the nearest-neighbour algorithm from A to find an upper bound for the travelling salesman problem, and find the optimal tour length. [4]

Show solution

A→B→C→D→A M1

5+4+3+6=18 A1

three distinct tours: 18, 22, 22 M1

optimal 18 A1

Answer: upper bound 18; optimal 18

Question 9

5 marks · Paper 2 style · calculator allowed

A courier must visit 5 locations: A, B, C, D, and E. The graph connecting these locations is fully connected. The lengths of the edges connected to vertex A are: AB=4, AC=5, AD=8, and AE=6. The minimum spanning tree for the subgraph containing only vertices B, C, D, and E has a total weight of 14.

Use the deleted vertex algorithm (deleting vertex A) to find a lower bound for the Travelling Salesman Problem for this network.

[5]

Show solution

Delete vertex A and all edges connected to it. M1
The weight of the Minimum Spanning Tree of the remaining vertices (B, C, D, E) is given as 14. A1
Identify the two edges with the lowest weight connecting vertex A to the remaining network. M1
These edges are AB (4) and AC (5). A1
Lower bound = Weight of MST + sum of two lowest edges = 14+4+5=23. A1

Answer: 23

Question 10

2 marks · Paper 1 style · calculator allowed

A water company's network has 11 junctions joined by 17 pipes, and every junction can be reached from every other. To save money, the company keeps open only the pipes of a minimum spanning tree.

  1. Write down the number of pipes that stay open. [1]

  2. Write down the number of pipes that are closed. [1]

Show solution
  1. a spanning tree on 11 vertices has 11−1=10 edges A1

  2. 17−10=7 A1

Answer: (a) 10; (b) 7

How the marks work: M marks are for a correct method, A marks for an accurate answer that follows it, R marks for a reason, and AG means the answer is given in the question. A mark in brackets, like (M1), can be implied by later correct work.

Notes, worked examples and more questions on this topic: AI HL Graph Theory. Previous topic: Coordinate Geometry. Next topic: Non-Right-Angled Trigonometry. Every AI HL topic.

Revise first with the AI HL revision notes, then finish on real papers: IB Maths AI HL past papers.