2081 6

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]

Data Structures and AlgorithmsChapter 8: Trees and GraphsDefinition and Representation of Graphs, Graph Traversal, Mi

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:

  1. 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.

  2. Routing Algorithms: Network routing protocols (like OSPF, STP in Ethernet) use spanning trees to avoid loops and ensure packets reach every node.

  3. Cluster Analysis: Used in machine learning and data mining to group similar data points.

  4. Circuit Design: Used in designing electronic circuits to minimize the total wire length connecting components.

  5. 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):
EdgeWeight
A-B4
A-C3
B-C2
B-D5
C-E6
D-E7
D-F4
E-G3
F-G8
F-H5
G-H2

Constructing MST using Kruskal's Algorithm

Step 1: Sort all edges in non-decreasing order of weight:

EdgeWeight
B-C2
G-H2
A-C3
E-G3
A-B4
D-F4
B-D5
F-H5
C-E6
D-E7
F-G8

Step 2: Select edges one by one, avoiding cycles:

StepEdge SelectedWeightReason
1B-C2No cycle, add
2G-H2No cycle, add
3A-C3No cycle, add
4E-G3No cycle, add
5A-B4Skip - A,B,C already connected (cycle)
6D-F4No cycle, add
7B-D5No cycle, connects {A,B,C} with {D,F}
8F-H5No 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 EdgeWeight
B - C2
G - H2
A - C3
E - G3
D - F4
B - D5
F - H5

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.