Skip to content
M
hscscienceMaths Std · Y12
0/100daily goal
0
0
0 due
0
L1 · 0 XP
KJ
Your weak spots
Insights load after your first practice round.
Module 6 · L4 of 12 ~25 min MS12-7 ⚡ +50 XP available

Trees and Spanning Trees

NBN Co engineers design fibre rollouts for regional NSW towns by finding spanning trees — connecting all premises with the fewest possible cables to minimise cost. A tree is a connected graph with no cycles, and exactly n−1 edges. This elegant property makes trees the foundation of network optimisation.

Today's hook — A network connects 6 offices. What is the minimum number of cable connections needed so every office can communicate? Predict before reading on.
0/5QUESTS
Worksheets

Practise this lesson

Three printable worksheets that build from foundations to mastery — or build your own from any module’s questions.

01
Recall — your gut answer first
+5 XP warm-up

A network connects 6 offices. What is the minimum number of connections (edges) needed so every office can communicate with every other office?

Before reading on — write your prediction.

auto-saved
02
The big idea — trees connect with minimum edges
reference

A tree is a connected graph with no cycles. A tree with $n$ vertices has exactly $n-1$ edges. A spanning tree of a network is a tree that includes every vertex — it connects everything with no redundant edges.

Tree: connected graph with no cycles. $n$ vertices → exactly $n-1$ edges.

Spanning tree: a subgraph that is a tree AND includes all vertices of the original network.

Leaf vertex: a vertex with degree 1 in a tree — attached by only one edge.

Key insight: removing any edge from a tree disconnects it. Adding any edge creates a cycle.

TREE PROPERTIES n vertices → n−1 edges Connected + no cycles Remove any edge → disconnected Add any edge → creates a cycle 6 offices → minimum 5 connections
For 6 offices: minimum connections = $6 - 1 = 5$. A spanning tree gives exactly this minimum.
n−1 is the magic number
A tree with n vertices always has exactly n−1 edges. One fewer edge disconnects; one more creates a cycle.
Spanning tree ≠ unique
A network can have many different spanning trees. All will have the same number of edges (n−1), but different structures.
Leaf = degree 1
Every tree (with ≥2 vertices) has at least two leaf vertices (degree 1). Leaves are the "tips" of the tree structure.
03
What you will master
Know

Key facts

  • Tree: connected, no cycles, n−1 edges
  • Spanning tree includes all vertices
  • Leaf vertex has degree 1
Understand

Concepts

  • Why n−1 is the minimum
  • Why spanning trees are not unique
  • Why trees avoid redundancy
Can do

Skills

  • Verify a subgraph is a tree
  • Count edges in a tree from n
  • Identify spanning trees of a network
04
Key terms
TreeA connected graph with no cycles. Has exactly n−1 edges for n vertices.
Spanning treeA subgraph of a network that is a tree and includes every vertex.
CycleA closed path that returns to the starting vertex without repeating any other vertex.
Connected graphA graph where every vertex can be reached from every other vertex by following edges.
Leaf vertexA vertex with degree 1 in a tree — connected by exactly one edge.
n−1 edges ruleA tree with n vertices has exactly n−1 edges. This is both necessary and sufficient for a tree.
05
Properties of trees — connected, no cycles, n−1 edges
core concept

A tree satisfies three equivalent conditions — any two imply the third:

  1. Connected + no cycles.
  2. Connected + exactly $n-1$ edges.
  3. No cycles + exactly $n-1$ edges.

A leaf vertex has degree 1. Every tree with at least 2 vertices has at least 2 leaves.

Example check: A graph with 5 vertices and edges A–B, B–C, C–D, D–E. Is it a tree? Connected: yes (all reachable from A). Cycles: none. Edges: 4 = 5−1 ✓. It is a tree.

To check if a subgraph is a spanning tree: (1) It must include every vertex. (2) It must have exactly n−1 edges. (3) It must be connected (no isolated vertices or disconnected components).
What to write in your book
  • Tree: connected + no cycles + n−1 edges.
  • Leaf: degree 1. Every tree has at least 2 leaves.
  • Check: correct number of vertices, n−1 edges, connected, no cycles.
Quick check: A tree with 9 vertices has how many edges?
06
Identifying spanning trees — not unique
core concept

A spanning tree of a network G is any tree that:

  • Uses all vertices of G.
  • Uses only edges from G.
  • Is connected with no cycles.

A network can have many spanning trees. To find one: start with all vertices, then add edges one at a time from the network, skipping any edge that would create a cycle. Stop when you have n−1 edges.

Example: A 4-vertex square network (A–B–C–D–A plus diagonal A–C). Spanning trees include: {A–B, B–C, C–D}, {A–B, A–C, C–D}, {A–B, A–D, A–C}, etc. Each has 3 edges (4−1=3).

How many spanning trees? A complete graph with n vertices has $n^{n-2}$ spanning trees (Cayley's formula). For n=4: $4^2 = 16$ spanning trees. You don't need to count them — just find one or verify that a given subgraph is one.
What to write in your book
  • Spanning tree: uses all vertices, only edges from original network, connected, no cycles.
  • To find one: add edges one at a time, skip any that create a cycle.
  • Multiple spanning trees exist — find any one that satisfies the conditions.
Which is NOT a property of a tree?
07
Applications of spanning trees — minimising connections
core concept

Spanning trees are used whenever you need to connect all nodes with the fewest edges (or minimum total cost). Real-world applications:

  • Telecommunications: connect all buildings with minimum cable.
  • Electrical grids: connect all substations without redundant lines.
  • Road design: connect all towns with minimum road length.

In Lesson 5, we extend this to weighted networks and find the minimum spanning tree (lowest total weight). The structure here is the foundation.

Why no cycles? A cycle means there are two different paths between some pair of vertices — redundant connection. In a cable network, redundancy wastes money. A spanning tree removes all redundancy while keeping all vertices connected.
What to write in your book
  • Spanning tree = minimum connections to link all vertices.
  • No cycles = no redundant connections.
  • Next step: add weights → minimum spanning tree (Lessons 5).
Complete: A spanning tree of a network with 7 vertices contains exactly _______ edges.
PROBLEM 1 · VERIFY A TREE

A subgraph has 8 vertices and edges A–B, B–C, C–D, D–E, E–F, F–G, G–H. Is it a tree?

1
Count edges: 7 edges. Count vertices: 8.
Check n−1 rule: 8−1 = 7 ✓
PROBLEM 2 · COUNT EDGES IN A TREE

A tree has 12 vertices. How many edges does it have? What is the degree sequence if it is a path (chain)?

1
Edges = n − 1 = 12 − 1 = 11 edges
Apply the n−1 rule for trees
PROBLEM 3 · FIND A SPANNING TREE

Network: 4 vertices A, B, C, D with edges A–B, B–C, C–D, D–A, B–D (a 4-cycle plus diagonal). Find a spanning tree.

1
Need: 4 vertices, 3 edges (4−1=3), connected, no cycles
State the requirements first
09
Practice activity
+10 XP
  1. A tree has 15 vertices. How many edges does it have?
  2. A subgraph has 6 vertices and 6 edges and is connected. Is it a tree? Why or why not?
  3. For the network A–B, A–C, B–C, B–D, C–D, D–E: find two different spanning trees.
  4. Explain why adding any edge to a spanning tree creates a cycle.
auto-saved
10
Revisit your thinking

For 6 offices: minimum connections = $6 - 1 = 5$. A spanning tree gives exactly this minimum — connecting everything with no redundant links. Your initial guess of 5 was correct if you applied n−1 instinctively!

auto-saved
01
Multiple choice
+5 XP per correct

Q1. A tree with n vertices has:

Q2. A connected graph with 7 vertices and 7 edges:

Q3. A spanning tree of a network with 10 vertices has how many edges?

Q4. Which of the following is TRUE about spanning trees?

Q5. A leaf vertex in a tree has degree:

02
Short answer
ApplyBand 42 marks

SA 1. A tree has 20 vertices. (a) How many edges? (b) What is the sum of all vertex degrees? (2 marks)

auto-saved
ApplyBand 42 marks

SA 2. A network has 5 vertices and edges A–B, A–C, B–C, B–D, C–D. Find a spanning tree and state the edges you selected. (2 marks)

auto-saved
AnalyseBand 53 marks

SA 3. Explain why a connected graph with n vertices and exactly n−1 edges must be a tree. What happens if you remove one edge? (3 marks)

auto-saved
Answers (click to reveal)

MC 1 — C: n−1 edges.

MC 2 — B: 7 vertices needs 6 edges for a tree; 7 edges means one extra → one cycle.

MC 3 — D: 10−1 = 9.

MC 4 — A: Multiple spanning trees exist.

MC 5 — B: Leaf = degree 1.

SA 1: (a) 19 edges [1]. (b) Sum = 38 [1].

SA 2: Any connected 4-edge subgraph with no cycles scores full marks, e.g. {A–B, A–C, B–D, B–C} — wait: verify no cycle. A–B, A–C, B–D, C–D: path A–C–D–B–A? Only if A–B is included. Check carefully [2].

SA 3: No cycles (n−1 edges insufficient for cycle) [1]; connected [1]; removing one edge disconnects [1].

01
Boss battle · The Tree Verifier
earn bronze · silver · gold

Timed questions on trees, spanning trees and the n−1 edges rule.

⚔ Enter the arena

Mark lesson as complete

Tick when you've finished the practice and review.