2080 11

BIT201 ยท 2080 ยท 5 marks

Define spanning tree. Explain minimum spanning tree with example.

Define spanning tree. Explain minimum spanning tree with example. [5]

Data Structures and AlgorithmsChapter 9: Graphs and Graph AlgorithmsSpanning tree definition

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:

EdgeWeight
A-B2
A-C3
B-C4
A-D6
D-C5

Finding MST (using Kruskal's approach - pick minimum weight edges without forming cycle):

StepEdge SelectedWeightCycle?
1A - B2No
2A - C3No
3B - C4Yes (skip)
4D - C5No

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.