KS Maths
Year 11 Extended · Unit 7 Networks and vectors · Lesson 3 of 8

Shortest paths and minimum spanning trees

What is the cheapest way to connect everything, and the quickest way to get there?

A weighted graph puts a number on every edge. Two questions follow: what is the shortest route between two vertices, and what is the cheapest set of edges that joins every vertex. They sound alike, and this lesson asks whether they have the same answer.

Geometry and TrigonometryNo calculator

Words you need (10 key words in this lesson)

The maths words this lesson uses, in plain English. Open this before you start if English is not your first language.

minimum
The smallest value.The minimum of 4, 9 and 2 is 2.
vertex
A corner of a shape. Also, the turning point of a parabola.A triangle has three vertices.
edge
A line where two faces meet. In graph theory, a line joining two points.A cube has twelve edges.
length
How long something is.The length of the table is 2 metres.
degree
The highest power of x in a polynomial. Also, the unit for measuring angles.The degree of x cubed plus x is 3.
add
Put numbers together to find the total.Add 3 and 4 to get 7.
odd
A whole number that leaves remainder 1 when divided by 2.7 is an odd number.
distance
How far it is from one place to another.The distance is 5 kilometres.
compare
Say how things are the same and how they are different.Compare the two sets of data.
round
Change a number to a nearby simpler number.Round 47 to the nearest ten: 50.

Preview You are reading the start of this lesson. The rest opens with a plan. See plans Already paid? Sign in

Warm-up

Three quick ones from earlier work. Try each in your head or on paper before you open the answer.

  1. From Lesson 1: a graph has 11 edges. What do its degrees add to?
    Answer22. Each edge is counted at both ends.
  2. From Year 7: work out 4 + 6 + 2 + 5 + 1.
    Answer18.
  3. From Lesson 2: a connected graph has four vertices of odd degree. Does it have an Euler route?
    AnswerNo. A route needs 0 or 2 odd vertices.
Words used in this lesson
weighted graph
a graph with a number on each edge. For example: road lengths in kilometres.
tree
a connected graph with no cycle. For example: a branching river system.
spanning tree
a tree that includes every vertex. For example: pipes to every house.
shortest path
the route with the least total weight between two vertices. For example: the quickest drive.
cycle
a route that returns to its starting vertex. For example: a ring road.

Is the cheapest way to join every village the same as the quickest road to one of them?

A water board in the hills above Kathmandu must lay pipes to six villages, A to F. The map gives the length in kilometres of each path along which a pipe could be laid. A courier also wants the shortest way from village A to the others along the same paths. Both questions use the same weighted graph. A weighted graph puts a number, the weight or length, on every edge.

Predict first: will the least total length of pipe that connects all six villages equal the length of the shortest route from A to the farthest village? Then use the figure to compare a shortest route with a minimum spanning tree.

4216810243ABCDEFroute A to E: 11
11shortest distance from A to the chosen vertex
14weight of a minimum spanning tree

Shortest route from A to E: A, C, B, D, E with length 11.

Show me the steps
  1. Destination E, route: A, C, B, D, E has length 2 + 1 + 6 + 2 = 11, which is shorter than going A, C, E directly (2 + 10 = 12).
  2. Destination F, route: A, C, B, D, F has length 2 + 1 + 6 + 4 = 13, which beats A, C, B, D, E, F (14).
  3. Spanning tree: take BC 1, AC 2, DE 2 and EF 3 in order of weight, skip AB 4 and DF 4 because each would close a cycle, then take BD 6. Five edges join six vertices, total weight 14.
  4. The route to F (13) and the tree (14) are different numbers: the tree must reach every vertex, but the route only has to reach F.

Shortest path. Work outwards from the start, fixing the vertex that is currently closest, and update the distance to its neighbours. The route to a vertex may go the long way round if the extra steps are short: the fewest edges is not the least total length.

Minimum spanning tree. A tree is a connected graph with no cycle, and a spanning tree joins every vertex. A tree on n vertices has n − 1 edges. To find the cheapest one, take the edges in order of weight and keep each one that does not close a cycle.

Two common slips. Stopping at the first route you find: compare every route before choosing. And adding every cheap edge in a spanning tree without testing for a cycle: an edge whose ends are already joined by the edges chosen so far is skipped.

The rest of this lesson is in the full course

Still to come in this lesson:

  • Worked examples
  • Check before you go on
  • Your turn

In the full lesson every figure moves as you drag it, and every answer you type is checked, with a note on what each wrong answer means.

Years 7 to 11 plan$59Every lesson from Year 7 to Year 11, so the refresher links always open, and every Year 7 to 11 revision pack, for the whole family. $59 for 12 months or $99 for 2 years.
IB Diploma plan$99Every lesson from Year 7 to the IB Diploma, AA and AI, SL and HL, for the whole family. $99 for 12 months or $149 for 2 years.

One plan opens every Diploma lesson, AA and AI, SL and HL, for the whole family.

One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Pay by card on Gumroad, then come back here and type the email you paid with: we email you a sign-in link. For a refund, reply to your Gumroad receipt or email hello@ksmaths.com.

Try a free sample lesson in every unit, and the whole Skill Tree. See this unit.

Already have a revision pack or the Years 7 to 11 plan? Move up and the unused part of what you paid comes off.

Teaching students who need extra support? Student codes for 5, 10 or 30 students.

Year 11 revision pack, $19BuyPlan $59