CSC211 ยท 2081 ยท 5 marks
What is the application of spanning tree? Draw a MST of a graph containing any 8 vertices and 11 edges with arbitrary edge costs.
What is the application of spanning tree? Draw a MST of a graph containing any 8 vertices and 11 edges with arbitrary edge costs. [5]
Quick answer
Spanning trees have several important practical applications: Network Design; Routing Algorithms; Cluster Analysis.
Application of Spanning Tree and MST Construction
Applications of Spanning Tree
Spanning trees have several important practical applications:
-
Network Design: Used in designing minimum cost communication networks, electrical grids, and computer networks where all nodes must be connected with minimum wiring/cabling cost.
-
Routing Algorithms: Network routing protocols (like OSPF, STP in Ethernet) use spanning trees to avoid loops and ensure packets reach every node.
-
Cluster Analysis: Used in machine learning and data mining to group similar data points.
-
Circuit Design: Used in designing electronic circuits to minimize the total wire length connecting components.
-
Transportation Networks: Used to find the minimum cost road/rail network connecting all cities.
Minimum Spanning Tree (MST) - Example with 8 Vertices and 11 Edges
Graph Definition
Consider a graph G = (V, E) with:
- Vertices: V = {A, B, C, D, E, F, G, H}
- Edges with weights (11 edges):
| Edge | Weight |
|---|---|
| A-B | 4 |
| A-C | 3 |
| B-C | 2 |
| B-D | 5 |
| C-E | 6 |
| D-E | 7 |
| D-F | 4 |
| E-G | 3 |
| F-G | 8 |
| F-H | 5 |
| G-H | 2 |
Constructing MST using Kruskal's Algorithm
Step 1: Sort all edges in non-decreasing order of weight:
| Edge | Weight |
|---|---|
| B-C | 2 |
| G-H | 2 |
| A-C | 3 |
| E-G | 3 |
| A-B | 4 |
| D-F | 4 |
| B-D | 5 |
| F-H | 5 |
| C-E | 6 |
| D-E | 7 |
| F-G | 8 |
Step 2: Select edges one by one, avoiding cycles:
| Step | Edge Selected | Weight | Reason |
|---|---|---|---|
| 1 | B-C | 2 | No cycle, add |
| 2 | G-H | 2 | No cycle, add |
| 3 | A-C | 3 | No cycle, add |
| 4 | E-G | 3 | No cycle, add |
| 5 | A-B | 4 | Skip - A,B,C already connected (cycle) |
| 6 | D-F | 4 | No cycle, add |
| 7 | B-D | 5 | No cycle, connects {A,B,C} with {D,F} |
| 8 | F-H | 5 | No cycle, connects {D,F} with {G,H,E} |
At this point we have 7 edges connecting all 8 vertices -- MST is complete.
Total MST Cost = 2 + 2 + 3 + 3 + 4 + 5 + 5 = 24
MST Diagram
A
| \
3 2
| \
C ---- B
|
5
|
D
|
4
|
F
|
5
|
H
|
2
|
G
|
3
|
E
MST Edges:
A ---3--- C ---2--- B ---5--- D ---4--- F ---5--- H ---2--- G ---3--- E
| MST Edge | Weight |
|---|---|
| B - C | 2 |
| G - H | 2 |
| A - C | 3 |
| E - G | 3 |
| D - F | 4 |
| B - D | 5 |
| F - H | 5 |
Total Minimum Cost = 2 + 2 + 3 + 3 + 4 + 5 + 5 = 24
The MST contains exactly n - 1 = 7 edges for 8 vertices, which satisfies the spanning tree property.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.