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 `` edges (where `` 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.
- 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 hardQuestion 1
MediumPaper 1 · calculator13 marksA 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/To | R1 | R2 | R3 | R4 | R5 | R6 |
|---|---|---|---|---|---|---|
| R1 | - | 70 | 85 | 60 | 95 | 110 |
| R2 | 70 | - | 50 | 75 | 40 | 80 |
| R3 | 85 | 50 | - | 35 | 65 | 90 |
| R4 | 60 | 75 | 35 | - | 55 | 70 |
| R5 | 95 | 40 | 65 | 55 | - | 45 |
| R6 | 110 | 80 | 90 | 70 | 45 | - |
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.
Hence find a lower bound for the total cost needed to establish a full communication circuit visiting all outposts, starting and finishing at R1.
Describe how an improved lower bound might be found.
Remember to first remove R1 and all its incident edges from the graph. Then, apply Prim's algorithm starting from R2 on the remaining subgraph. Always choose the minimum weight edge that connects a vertex in the current tree to a vertex not yet in the tree.
To find a lower bound for the Travelling Salesperson Problem (TSP) using an MST, you need to add the two shortest edges connected to the deleted vertex (R1) back to the weight of the MST you found in part (a.i).
Consider the effect of which vertex is deleted when applying this method for finding a lower bound.
Question 2
HardPaper 1 · calculator5 marksA 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.

Write down the vertices with odd degree.
The total cost of all existing cables is 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 , 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 for which each expression is valid.
The degree of a vertex is the number of edges connected to it. A vertex has an odd degree if an odd number of edges connect to it.
To traverse all edges starting and ending at the same vertex, all vertices must have an even degree. Identify the odd-degree vertices from part (a). You need to add edges to the graph to make all degrees even. This involves finding the shortest paths between pairs of odd-degree vertices and choosing the pairing that minimizes the sum of these shortest paths. Consider different cases for the value of .
Question 3
HardPaper 2 · calculator17 marksThe 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.

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.
The shortest distance, in kilometres, between any two hubs is given in the table.
| V1 | V2 | V3 | V4 | V5 | V6 | V7 | |
|---|---|---|---|---|---|---|---|
| V1 | - | 10 | 15 | a | 24 | 25 | 20 |
| V2 | 10 | - | 8 | 15 | 14 | b | 24 |
| V3 | 15 | 8 | - | 7 | 16 | 11 | c |
| V4 | 22 | 15 | 7 | - | 9 | 15 | 13 |
| V5 | d | 14 | 16 | 9 | - | 6 | 11 |
| V6 | 25 | 19 | 11 | 15 | 6 | - | 5 |
| V7 | 20 | 24 | 16 | 13 | 11 | 5 | - |
Find the values of , , , and .
Use the nearest neighbour algorithm, starting at hub V7, to find an upper bound for the travelling salesman problem.
Sketch a minimum spanning tree for the subgraph formed by removing hub V7.
Write down the total weight of the minimum spanning tree.
Hence find a lower bound for the travelling salesman problem.
Explain one way in which an improved lower bound could be found.
The optimal solution for the travelling salesman problem, starting at V1, is . 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.
Consider the degrees of the vertices. For a graph to have an Eulerian path (starting and finishing at different vertices, using each edge exactly once), how many vertices must have an odd degree?
Use Dijkstra's algorithm or inspect the graph to find the shortest paths between the specified pairs of vertices. For example, to find the shortest path from V1 to V4, consider all possible routes and their total lengths.
Start at V7. At each step, move to the unvisited hub that is closest to your current hub. Once all hubs are visited, return to V7 from the last visited hub.
When removing V7, only consider the hubs V1, V2, V3, V4, V5, V6 and the routes connecting them. Use Kruskal's or Prim's algorithm to find the minimum spanning tree.
Sum the weights of the edges in your minimum spanning tree from part (d.i).
To find a lower bound for the TSP, add the weight of the minimum spanning tree (from the subgraph without the starting vertex) to the weights of the two shortest edges connected to the removed starting vertex.
The lower bound calculation involved removing a specific vertex. What if you chose a different vertex to remove?
The phrase 'given to the nearest kilometre' implies an uncertainty in each edge length. If a measurement is given to the nearest whole number, the actual value lies within of the stated value. Consider how this affects the total length of the route.
Question 4
HardPaper 2 · calculator17 marksThe 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.
| O1 | O2 | O3 | O4 | O5 | O6 | |
|---|---|---|---|---|---|---|
| O1 | - | 120 | 180 | - | - | - |
| O2 | 120 | - | - | 90 | 150 | - |
| O3 | 180 | - | - | 200 | - | 220 |
| O4 | - | 90 | 200 | - | 110 | 160 |
| O5 | - | 150 | - | 110 | - | 250 |
| O6 | - | - | 220 | 160 | 250 | - |
Show the direct data links between the observatories as a graph.
Write down the adjacency matrix for this graph, assuming the observatories are ordered O1, O2, O3, O4, O5, O6.
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.
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.
The following table shows the least transmission time (in ms) to travel between the observatories.
| O1 | O2 | O3 | O4 | O5 | O6 | |
|---|---|---|---|---|---|---|
| O1 | 0 | 120 | 180 | a | 270 | 370 |
| O2 | 120 | 0 | 300 | 90 | 150 | b |
| O3 | 180 | 300 | 0 | 200 | 310 | 220 |
| O4 | a | 90 | 200 | 0 | 110 | 160 |
| O5 | 270 | 150 | 310 | 110 | 0 | 250 |
| O6 | 370 | b | 220 | 160 | 250 | 0 |
Find the values of and .
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.
By deleting observatory O1, use the deleted vertex algorithm to find a lower bound for the total transmission time of the trip.
Represent each observatory as a vertex and each direct data link as an edge. Since transmission times are given, the graph should be weighted, but for showing direct links, you only need to draw the edges.
An adjacency matrix has elements if there is a direct link between vertex and vertex , and otherwise. For an undirected graph, the matrix is symmetric.
The entry of the -th power of the adjacency matrix gives the number of walks of length from vertex to vertex . You need to find the entry of .
Consider if a Hamiltonian cycle of length 6 exists in the graph, starting and ending at O1.
The values and represent the shortest paths between pairs of observatories. You can find these by tracing paths on the graph or using a shortest path algorithm.
Start at O1. At each step, move to the unvisited observatory that has the shortest direct transmission time from the current observatory. Continue until all observatories are visited, then return to O1.
Remove O1 and all its incident edges. Find the Minimum Spanning Tree (MST) for the remaining graph. Then, add the two shortest edges that connect O1 to any vertex in the MST.
No question on this page matches those filters. Try another difficulty or paper.
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"?