0% found this document useful (0 votes)
29 views19 pages

Minimum Cost Spanning Tree

The document discusses minimum cost spanning trees and their properties. It defines key terms like root, node, parent, child, leaf, siblings, degree of a node, depth of a node, height of a tree. It also explains different types of trees like binary trees, full binary trees, complete binary trees and heaps. Finally, it defines what a minimum cost spanning tree is and provides examples of its use cases.

Uploaded by

mhmdmfsr07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views19 pages

Minimum Cost Spanning Tree

The document discusses minimum cost spanning trees and their properties. It defines key terms like root, node, parent, child, leaf, siblings, degree of a node, depth of a node, height of a tree. It also explains different types of trees like binary trees, full binary trees, complete binary trees and heaps. Finally, it defines what a minimum cost spanning tree is and provides examples of its use cases.

Uploaded by

mhmdmfsr07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Minimum Cost Spanning

Tree

Dr. Samantha Rajapaksha


Head/Department of IT
Senior Lecturer(HG)
B.Sc. M.Sc. Ph.D.
04/20/2024 Dr. Samantha Rakapaksha 1
Tree
• A tree is a connected, acyclic, undirected graph and
• Has components named after natural trees
-root -branches -leaves
• Drawn with root at the top
Examples
Root

branch

leaf

DAA 214 2
Trees (Contd.)

DAA 214 3
Tree Terminology

1. Root
2. Node
3. Parent
4. Child
5. Leaf
6. Siblings
7. Degree of a node
8. Depth of a node
9. Height of a tree

DAA 214 4
Tree Terminology (Contd.)
• Root:It is node with no parent.
• Node: It is a vertex of the tree where a data element is stored.
• Parent : It is a single node that directly precedes a node.
• Child : It is a node that directly follows a node.
• Leaf : It is a node with no children,Items at the very bottom of a
hierarchical tree structure.
• Siblings: The nodes which share same parent
• Degree of an node:The number of children it has
• Depth:The depth of x in T is the length of the path from the root r to
a node x.
• Height:The largest depth of any node in a tree is the height.

DAA 214 5
Tree Terminology (Contd.)

DAA 214 6
Binary tree
• A binary tree is a tree structure in which each node has at most two
children.
• Each element in a Binary Tree has degree 2.
• Examples

DAA 214 7
Full Binary Tree

• A Binary tree of height h that contains exactly 2h+1-1


nodes

• Height, h= 2,  nodes = 22+1-1= 7

DAA 214 8
Complete Binary Tree
• It is a Binary tree where each node is either a leaf or has degree  2.
• Completely filled, except possibly for the bottom level and level above
• Each level is filled from left to right.
• All nodes at the lowest level are as far to the left as possible
• Full binary tree is also a complete binary tree.

DAA 214 9
Examples of Complete Binary Trees

• Followings are not CBTs

Degree > 2 Not Completely Filled from right to


filled left
DAA 214 10
Height of a complete binary tree
Height of a complete binary tree that contains n elements is
log2(n)
Example

• Above is a Complete Binary Tree with height = 3


• No of nodes: n = 10
• Height = log2(n) = log2(10) = 3
DAA 214 11
Heaps
• A Complete Binary Tree with the heap property.
• Heap Property: The value of each node is greater than or equal
to those of its children.
• Examples

14 14

12 7 12 7

10 8 6 10 8 6 5

4 3
DAA 214 12
DAA 214 13
Heap Tree.

DAA 214 14
DAA 214 15
What is a Spanning Tree?
• Tree : A connected undirected graph that contains no cycles is called a
tree.
• Spanning Tree : A spanning tree of a graph G is a subgraph of G that is a
tree and contains all the vertices of G.

A B
A B A B
C
C C
D
D D
E
E E

Undirected Graph some Spanning Trees

16
Properties of spanning Tree
• The spanning tree of a n –vertex undirected graph has exactly n-1 edges.
• Spanning tree has no cycles
• It Connects all vertexes in the graph.
• Input: A connected, undirected graph G = (V, E)
with weight function w : E → R.
• Output: A spanning tree T —a tree that connects
all vertices — of minimum weight:

w(T )   w(u, v)
( u , v )T

17
What is a Minimum Cost Spanning Tree?

• Minimum Cost Spanning Tree is the tree amongst all spanning trees
with the smallest cost

6 B A B
A
1 1 1
1
3 C 2 3 C 2
4 D
D
E
5 E

Weighted Undirected MCST


Graph
18
Where do we use MCST?
• Computer Networks
Minimum spanning trees are useful in constructing networks, by
describing the way to connect a set of sites using the smallest total
amount of wire.
• Ship/ Aero plane lines
we can connect all the cities using the MCST and using MCST, will reduce
amount of cost & time to travel.
• In the design of electronic circuitry
it is often necessary to make the pins of several components electrically
equivalent by wiring them together. To interconnect a set of n pins, we can
use an arrangement of n - 1 wires, each connecting two pins. Of all such
arrangements, the one that uses the least amount of wire is usually the
most desirable

19

You might also like