Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE) PDF Download

Spanning Tree and Minimum Spanning Tree

In this tutorial, you will learn about spanning tree and minimum spanning tree with help of examples and figures.
Before we learn about spanning trees, we need to understand two graphs: undirected graphs and connected graphs.
An undirected graph is a graph in which the edges do not point in any direction (ie. the edges are bidirectional).

Undirected GraphUndirected Graph

A connected graph is a graph in which there is always a path from a vertex to any other vertex.

Connected GraphConnected Graph

Spanning tree

A spanning tree is a sub-graph of an undirected connected graph, which includes all the vertices of the graph with a minimum possible number of edges. If a vertex is missed, then it is not a spanning tree.
The edges may or may not have weights assigned to them.
The total number of spanning trees with n vertices that can be created from a complete graph is equal to n(n-2).
If we have n = 4, the maximum number of possible spanning trees is equal to 44-2 = 16. Thus, 16 spanning trees can be formed from a complete graph with 4 vertices.

Example of a Spanning Tree
Let's understand the spanning tree with examples below:
Let the original graph be:
Normal graphNormal graphSome of the possible spanning trees that can be created from the above graph are:

A spanning treeA spanning tree

Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)

A spanning tree

Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)

A spanning tree

Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)

A spanning tree

Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)

A spanning tree

Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)

A spanning tree

Minimum Spanning Tree
A minimum spanning tree is a spanning tree in which the sum of the weight of the edges is as minimum as possible.

Example of a Spanning Tree
Let's understand the above definition with the help of the example below.
The initial graph is:

Weighted graphWeighted graphThe possible spanning trees from the above graph are:
Minimum spanning tree - 1Minimum spanning tree - 1

Minimum spanning tree - 2Minimum spanning tree - 2

Minimum spanning tree - 3Minimum spanning tree - 3

Minimum spanning tree - 4Minimum spanning tree - 4

The minimum spanning tree from the above spanning trees is:
Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)Minimum spanning tree

The minimum spanning tree from a graph is found using the following algorithms:

  1. Prim's Algorithm
  2. Kruskal's Algorithm

Spanning Tree Applications

  • Computer Network Routing Protocol
  • Cluster Analysis
  • Civil Network Planning

Minimum Spanning tree Applications

  • To find paths in the map
  • To design networks like telecommunication networks, water supply networks, and electrical grids.
The document Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Programming and Data Structures.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
Are you preparing for Computer Science Engineering (CSE) Exam? Then you should check out the best video lectures, notes, free mock test series, crash course and much more provided by EduRev. You also get your detailed analysis and report cards along with 24x7 doubt solving for you to excel in Computer Science Engineering (CSE) exam. So join EduRev now and revolutionise the way you learn!
Sign up for Free Download App for Free
124 docs|30 tests

Up next

124 docs|30 tests
Download as PDF

Up next

Explore Courses for Computer Science Engineering (CSE) exam
Related Searches

Important questions

,

shortcuts and tricks

,

Previous Year Questions with Solutions

,

MCQs

,

Semester Notes

,

study material

,

Free

,

video lectures

,

Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)

,

Summary

,

Objective type Questions

,

practice quizzes

,

Exam

,

Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)

,

Spanning Tree | Programming and Data Structures - Computer Science Engineering (CSE)

,

Viva Questions

,

Sample Paper

,

Extra Questions

,

past year papers

,

pdf

,

ppt

,

mock tests for examination

;