BIT201 ยท 2080 ยท 5 marks
Define spanning tree. Explain minimum spanning tree with example.
Define spanning tree. Explain minimum spanning tree with example. [5]
Quick answer
A spanning tree of a connected, undirected graph G = (V, E) is a subgraph that: Includes all vertices of the graph; Is a tree (connected and acyclic); Has exactly V - 1 edges.
Spanning Tree and Minimum Spanning Tree
Spanning Tree
A spanning tree of a connected, undirected graph G = (V, E) is a subgraph that:
- Includes all vertices of the graph
- Is a tree (connected and acyclic)
- Has exactly |V| - 1 edges
A graph with n vertices will have a spanning tree with exactly n - 1 edges.
Minimum Spanning Tree (MST)
A Minimum Spanning Tree is a spanning tree of a weighted, connected, undirected graph in which the total sum of edge weights is minimum among all possible spanning trees.
Key Properties:
- Contains all V vertices and exactly V - 1 edges
- No cycles are present
- The total edge weight is minimized
Example
Consider the following weighted graph with 4 vertices:
2
A -------- B
| \ |
6| \ 3 | 4
| \ |
D -------- C
5
Edges and weights:
| Edge | Weight |
|---|---|
| A-B | 2 |
| A-C | 3 |
| B-C | 4 |
| A-D | 6 |
| D-C | 5 |
Finding MST (using Kruskal's approach - pick minimum weight edges without forming cycle):
| Step | Edge Selected | Weight | Cycle? |
|---|---|---|---|
| 1 | A - B | 2 | No |
| 2 | A - C | 3 | No |
| 3 | B - C | 4 | Yes (skip) |
| 4 | D - C | 5 | No |
MST Edges: A-B, A-C, D-C
2
A -------- B
\
3 \
\
C -------- D
5
Total MST Weight = 2 + 3 + 5 = 10
This is the minimum possible weight to connect all 4 vertices, using exactly 4 - 1 = 3 edges.
Common Algorithms to find MST:
- Kruskal's Algorithm - sorts edges by weight and adds them greedily
- Prim's Algorithm - grows the MST one vertex at a time from a starting vertex
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.