SlideShare a Scribd company logo
Minimal Spanning
Tree
Basic Terminology,
Applications and
Algorithms
 Introduction
 What is Minimal Spanning Tree (MST)
 Applications
 Where we can use MST
 Functions
 How to find MST
 Prim’s algorithm
 Kruskal’s algorithm
 Conclusions
Overview
Slide 2
 A Spanning Tree (ST) of a graph is a subgraph that contains all the
vertices and is a tree, i.e., no Cycle & Connected.
 A graph may have many spanning trees.
Introduction
16 ST
Slide 3
 A Spanning Tree (ST) of a graph is a subgraph that contains all the
vertices and is a tree, i.e., no Cycle & Connected.
 A graph may have many spanning trees.
 Let, the edges were weighted.
 Minimal Spanning Tree (MST) is spanning tree with the minimum sum
of edges,
Introduction Cont …
( , )
( ) ( , )
u v T
w T w u v

 
Slide 4
 Phone network design.
Applications of MST
Central office
The phone company charges different
amounts of money to connect different pairs of cities.
Expensive
Slide 5
 Phone network design.
Applications of MST Cont …
Central office
Better Approach
The phone company charges different
amounts of money to connect different pairs of cities.
Slide 6
 Electronic circuitry
 Set of pins wiring them together.
 We want to minimize the total length of the wires.
 Minimum Spanning Trees can be used to model this problem.
Applications of MST Cont …
Slide 7
How We Can Find a MST
Robert Clay Prim is an American mathematician and computer
scientist.
During the climax of World War II (1941–1944), Prim worked as an
engineer for General Electric. From 1944 until 1949, he was hired by the
United States Naval Ordnance Lab as an engineer and later a
mathematician. At Bell Laboratories, he served as director of
mathematics research from 1958 to 1961. There, Prim implimented the
Prim's algorithm.
Which is was originally discovered in 1930 by mathematician Vojtech
Jarnik and later later rediscovered by Edsger Dijkstra in 1959.
Vojtěch Jarník was a Czech mathematician.
His main area of work was in number theory and mathematical analysis;
he proved a number of results on lattice point problems. He also
developed the graph theory algorithm which is now known as Prim's
algorithm.
 Greedy
 Two Most Popular Algorithms
 Prime’s Algorithm
 Kruskal’s Algorithm
Slide 8
How We Can Find a MST Cont …
 Greedy
 Two Most Popular Algorithms
 Prime’s Algorithm
 Kruskal’s Algorithm
Joseph Bernard Kruskal, Jr. is an American mathematician.
His best known work is Kruskal's algorithm for computing the minimal
spanning tree. The algorithm first orders the edges by weight and then
proceeds through the ordered list adding an edge to the partial MST
provided that adding the new edge does not create a cycle.
Kruskal also applied his work in linguistics, in an experimental
lexicostatistical study of Indo-European languages, together with the
linguists Isidore Dyen and Paul Black.
Slide 9
Prime’s Algorithm
 Vertex based algorithm
 Grows one tree T, one vertex at a time
 Tree-vertices: in the tree constructed so far
 Non-tree vertices: rest of vertices
 Prim’s Selection rule “Select the minimum weight edge between a tree-
node and a non-tree node and add to the tree.”
Select a vertex to be a tree-node
while (there are non-tree vertices) {
if there is no edge connecting a tree
node with a non-tree node
return “no spanning tree”
select an edge of minimum weight
between a tree node and a non-tree node
add the selected edge and its new vertex
to the tree
}
return tree
Slide 10
Prime’s Algorithm Cont …
 Vertex based algorithm
 Grows one tree T, one vertex at a time
 Tree-vertices: in the tree constructed so far
 Non-tree vertices: rest of vertices
 Prim’s Selection rule “Select the minimum weight edge between a tree-
node and a non-tree node and add to the tree.”
Slide 11
Prime’s Algorithm Cont …
 Vertex based algorithm
 Grows one tree T, one vertex at a time
 Tree-vertices: in the tree constructed so far
 Non-tree vertices: rest of vertices
 Prim’s Selection rule “Select the minimum weight edge between a tree-
node and a non-tree node and add to the tree.”
Slide 12
Prime’s Algorithm Cont …
 Vertex based algorithm
 Grows one tree T, one vertex at a time
 Tree-vertices: in the tree constructed so far
 Non-tree vertices: rest of vertices
 Prim’s Selection rule “Select the minimum weight edge between a tree-
node and a non-tree node and add to the tree.”
Slide 13
Prime’s Algorithm Cont …
 Vertex based algorithm
 Grows one tree T, one vertex at a time
 Tree-vertices: in the tree constructed so far
 Non-tree vertices: rest of vertices
 Prim’s Selection rule “Select the minimum weight edge between a tree-
node and a non-tree node and add to the tree.”
Slide 14
Prime’s Algorithm Cont …
 Vertex based algorithm
 Grows one tree T, one vertex at a time
 Tree-vertices: in the tree constructed so far
 Non-tree vertices: rest of vertices
 Prim’s Selection rule “Select the minimum weight edge between a tree-
node and a non-tree node and add to the tree.”
Slide 15
Prime’s Algorithm Cont …
 Vertex based algorithm
 Grows one tree T, one vertex at a time
 Tree-vertices: in the tree constructed so far
 Non-tree vertices: rest of vertices
 Prim’s Selection rule “Select the minimum weight edge between a tree-
node and a non-tree node and add to the tree.”
Slide 16
Weight of the Spanning Tree
=23+29+31+32+47+54+66
=282
More Detail
 r : Grow the minimum spanning tree from the root vertex “r”.
 Q : is a priority queue, holding all vertices that are not in the tree
now.
 key[v] : is the minimum weight of any edge connecting v to a
vertex in the tree.
 p [v] : names the parent of v in the tree.
 T[v] – Vertex v is already included in MST if T[v]==1, otherwise, it
is not included yet.
Prime’s Algorithm Cont …
Slide 17
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
V a b c d e f g h i
T 1 0 0 0 0 0 0 0 0
Key 0 - - - - - - - -
p -1 - - - - - - - -
Prime’s Algorithm Cont …
Slide 18
root
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
V a b c d e f g h i
T 1 0 0 0 0 0 0 0 0
Key 0 4 - - - - - 8 -
p -1 a - - - - - a -
Prime’s Algorithm Cont …
Slide 19
root
V a b c d e f g h i
T 1 1 0 0 0 0 0 0 0
Key 0 4 8 - - - - 8 -
p -1 a b - - - - a -
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
Important: Update Key[v] only if T[v]==0
Prime’s Algorithm Cont …
Slide 20
root
V a b c d e f g h i
T 1 1 1 0 0 0 0 0 0
Key 0 4 8 7 - 4 - 8 2
p -1 a b c - c - a c
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
Prime’s Algorithm Cont …
Slide 21
root
V a b c d e f g h i
T 1 1 1 0 0 0 0 0 1
Key 0 4 8 7 - 4 6 7 2
p -1 a b c - c i i c
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
Prime’s Algorithm Cont …
Slide 22
root
V a b c d e f g h i
T 1 1 1 0 0 1 0 0 1
Key 0 4 8 7 10 4 2 7 2
p -1 a b c f c f i c
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
Prime’s Algorithm Cont …
Slide 23
root
V a b c d e f g h i
T 1 1 1 0 0 1 1 0 1
Key 0 4 8 7 10 4 2 1 2
p -1 a b c f c f g c
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
Prime’s Algorithm Cont …
Slide 24
root
V a b c d e f g h i
T 1 1 1 0 0 1 1 1 1
Key 0 4 8 7 10 4 2 1 2
p -1 a b c f c f g c
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
Prime’s Algorithm Cont …
Slide 25
root
V a b c d e f g h i
T 1 1 1 1 0 1 1 1 1
Key 0 4 8 7 9 4 2 1 2
p -1 a b c d c f g c
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
Prime’s Algorithm Cont …
Slide 26
root
V a b c d e f g h i
T 1 1 1 1 1 1 1 1 1
Key 0 4 8 7 9 4 2 1 2
p -1 a b c d c f g c
a
b
h
c d
e
f
g
i
4
8 7
9
10
14
4
2
2
6
1
7
11
8
All T[v] = 1
So Done
Prime’s Algorithm Cont …
Slide 27
root
Kruskal’s Algorithm
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
 Edge based algorithm
 Add the edges one at a time, in increasing weight order
 It maintains a forest of trees.
 An edge is accepted it if connects vertices of distinct trees
Slide 28
Kruskal’s Algorithm Cont …
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
Slide 29
Kruskal’s Algorithm Cont …
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
Slide 30
Kruskal’s Algorithm Cont …
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
Slide 31
Kruskal’s Algorithm Cont …
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
Slide 32
Kruskal’s Algorithm Cont …
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
Slide 33
Kruskal’s Algorithm Cont …
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
Slide 34
Kruskal’s Algorithm Cont …
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
Up to this point, we have simply
taken the edges in order of their
weight. But now we will have to
reject an edge since it forms a
cycle when added to those
already chosen.
Slide 35
Kruskal’s Algorithm Cont …
Basic Terminology
 Cut : Partition of V. Ex: (S, V-S)
 Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is
in S and the other is in V-S.
 Light edge : An edge crossing a cut if its weight is the minimum of
any edge crossing the cut.
 Kruskal’s Algorithm
Slide 36
Weight of the Spanning Tree
=23+29+31+32+47+54+66
=282
Prime’s Vs Kruskal’s
Slide 37
Conclusions
 MST  Still works are going on
 Boruvka's Algorithm
 Inventor of MST
 Prim’s algorithm “in parallel”
 Huge Number of Applications
 Networking
 Data mining
 Clustering, Classification etc.
Slide 38
Questions or Suggestions
Thank You!

More Related Content

PPTX
Minimum spanning tree
PDF
Algorithm chapter 9
PPT
Greedy Approach in Design Analysis and Algorithms
PPTX
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
PPTX
Minimum Spanning Tree (Data Structure and Algorithm)
PPT
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
PDF
Ijciras1101
Minimum spanning tree
Algorithm chapter 9
Greedy Approach in Design Analysis and Algorithms
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
Minimum Spanning Tree (Data Structure and Algorithm)
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
Ijciras1101

Similar to 8_MST_pptx.pptx (20)

PPT
Weighted graphs
PPTX
Minimum spanning tree.pptx data structure programming
PDF
Slides10 - Minimum Spanning Tree jdh.pdf
PPT
test pre
PPTX
Ram minimum spanning tree
PPT
17 prims-kruskals (1)
PDF
Daa chapter13
PPTX
DYNAMIC PROGRAMMING AND GREEDY TECHNIQUE
PPT
Chapter 24 aoa
PDF
Shortest path by using suitable algorithm.pdf
PDF
lecture 23 algorithm design and analysis
PPTX
DATA STRUCTURE AND ALGORITHM LMS MST KRUSKAL'S ALGORITHM
PPT
5.1 greedy 03
PPT
Greedy Algorithms Chapter for new students 4.ppt
PPT
ch09-04-14-14.ppt design and analysis of algorithms
PPTX
uva-201026072839.pptxvcvczcvzvcxbxcvbcxvbvcxbcx
PPT
Graph Theory PPT presentation created by Selvam.
PPTX
Presentation.pptx
PPTX
Greedy Strategy.pptxbfasjbjfn asnfn anjn
PDF
Minimum Spanning Tree in design and analysis
Weighted graphs
Minimum spanning tree.pptx data structure programming
Slides10 - Minimum Spanning Tree jdh.pdf
test pre
Ram minimum spanning tree
17 prims-kruskals (1)
Daa chapter13
DYNAMIC PROGRAMMING AND GREEDY TECHNIQUE
Chapter 24 aoa
Shortest path by using suitable algorithm.pdf
lecture 23 algorithm design and analysis
DATA STRUCTURE AND ALGORITHM LMS MST KRUSKAL'S ALGORITHM
5.1 greedy 03
Greedy Algorithms Chapter for new students 4.ppt
ch09-04-14-14.ppt design and analysis of algorithms
uva-201026072839.pptxvcvczcvzvcxbxcvbcxvbvcxbcx
Graph Theory PPT presentation created by Selvam.
Presentation.pptx
Greedy Strategy.pptxbfasjbjfn asnfn anjn
Minimum Spanning Tree in design and analysis
Ad

Recently uploaded (20)

PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Complications of Minimal Access Surgery at WLH
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
1_English_Language_Set_2.pdf probationary
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
Cell Types and Its function , kingdom of life
PDF
Hazard Identification & Risk Assessment .pdf
PDF
Indian roads congress 037 - 2012 Flexible pavement
PPTX
Unit 4 Skeletal System.ppt.pptxopresentatiom
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
PPTX
Introduction to Building Materials
PDF
IGGE1 Understanding the Self1234567891011
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
Weekly quiz Compilation Jan -July 25.pdf
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Complications of Minimal Access Surgery at WLH
History, Philosophy and sociology of education (1).pptx
What if we spent less time fighting change, and more time building what’s rig...
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
1_English_Language_Set_2.pdf probationary
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Cell Types and Its function , kingdom of life
Hazard Identification & Risk Assessment .pdf
Indian roads congress 037 - 2012 Flexible pavement
Unit 4 Skeletal System.ppt.pptxopresentatiom
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
Introduction to Building Materials
IGGE1 Understanding the Self1234567891011
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Orientation - ARALprogram of Deped to the Parents.pptx
Weekly quiz Compilation Jan -July 25.pdf
Ad

8_MST_pptx.pptx

  • 2.  Introduction  What is Minimal Spanning Tree (MST)  Applications  Where we can use MST  Functions  How to find MST  Prim’s algorithm  Kruskal’s algorithm  Conclusions Overview Slide 2
  • 3.  A Spanning Tree (ST) of a graph is a subgraph that contains all the vertices and is a tree, i.e., no Cycle & Connected.  A graph may have many spanning trees. Introduction 16 ST Slide 3
  • 4.  A Spanning Tree (ST) of a graph is a subgraph that contains all the vertices and is a tree, i.e., no Cycle & Connected.  A graph may have many spanning trees.  Let, the edges were weighted.  Minimal Spanning Tree (MST) is spanning tree with the minimum sum of edges, Introduction Cont … ( , ) ( ) ( , ) u v T w T w u v    Slide 4
  • 5.  Phone network design. Applications of MST Central office The phone company charges different amounts of money to connect different pairs of cities. Expensive Slide 5
  • 6.  Phone network design. Applications of MST Cont … Central office Better Approach The phone company charges different amounts of money to connect different pairs of cities. Slide 6
  • 7.  Electronic circuitry  Set of pins wiring them together.  We want to minimize the total length of the wires.  Minimum Spanning Trees can be used to model this problem. Applications of MST Cont … Slide 7
  • 8. How We Can Find a MST Robert Clay Prim is an American mathematician and computer scientist. During the climax of World War II (1941–1944), Prim worked as an engineer for General Electric. From 1944 until 1949, he was hired by the United States Naval Ordnance Lab as an engineer and later a mathematician. At Bell Laboratories, he served as director of mathematics research from 1958 to 1961. There, Prim implimented the Prim's algorithm. Which is was originally discovered in 1930 by mathematician Vojtech Jarnik and later later rediscovered by Edsger Dijkstra in 1959. Vojtěch Jarník was a Czech mathematician. His main area of work was in number theory and mathematical analysis; he proved a number of results on lattice point problems. He also developed the graph theory algorithm which is now known as Prim's algorithm.  Greedy  Two Most Popular Algorithms  Prime’s Algorithm  Kruskal’s Algorithm Slide 8
  • 9. How We Can Find a MST Cont …  Greedy  Two Most Popular Algorithms  Prime’s Algorithm  Kruskal’s Algorithm Joseph Bernard Kruskal, Jr. is an American mathematician. His best known work is Kruskal's algorithm for computing the minimal spanning tree. The algorithm first orders the edges by weight and then proceeds through the ordered list adding an edge to the partial MST provided that adding the new edge does not create a cycle. Kruskal also applied his work in linguistics, in an experimental lexicostatistical study of Indo-European languages, together with the linguists Isidore Dyen and Paul Black. Slide 9
  • 10. Prime’s Algorithm  Vertex based algorithm  Grows one tree T, one vertex at a time  Tree-vertices: in the tree constructed so far  Non-tree vertices: rest of vertices  Prim’s Selection rule “Select the minimum weight edge between a tree- node and a non-tree node and add to the tree.” Select a vertex to be a tree-node while (there are non-tree vertices) { if there is no edge connecting a tree node with a non-tree node return “no spanning tree” select an edge of minimum weight between a tree node and a non-tree node add the selected edge and its new vertex to the tree } return tree Slide 10
  • 11. Prime’s Algorithm Cont …  Vertex based algorithm  Grows one tree T, one vertex at a time  Tree-vertices: in the tree constructed so far  Non-tree vertices: rest of vertices  Prim’s Selection rule “Select the minimum weight edge between a tree- node and a non-tree node and add to the tree.” Slide 11
  • 12. Prime’s Algorithm Cont …  Vertex based algorithm  Grows one tree T, one vertex at a time  Tree-vertices: in the tree constructed so far  Non-tree vertices: rest of vertices  Prim’s Selection rule “Select the minimum weight edge between a tree- node and a non-tree node and add to the tree.” Slide 12
  • 13. Prime’s Algorithm Cont …  Vertex based algorithm  Grows one tree T, one vertex at a time  Tree-vertices: in the tree constructed so far  Non-tree vertices: rest of vertices  Prim’s Selection rule “Select the minimum weight edge between a tree- node and a non-tree node and add to the tree.” Slide 13
  • 14. Prime’s Algorithm Cont …  Vertex based algorithm  Grows one tree T, one vertex at a time  Tree-vertices: in the tree constructed so far  Non-tree vertices: rest of vertices  Prim’s Selection rule “Select the minimum weight edge between a tree- node and a non-tree node and add to the tree.” Slide 14
  • 15. Prime’s Algorithm Cont …  Vertex based algorithm  Grows one tree T, one vertex at a time  Tree-vertices: in the tree constructed so far  Non-tree vertices: rest of vertices  Prim’s Selection rule “Select the minimum weight edge between a tree- node and a non-tree node and add to the tree.” Slide 15
  • 16. Prime’s Algorithm Cont …  Vertex based algorithm  Grows one tree T, one vertex at a time  Tree-vertices: in the tree constructed so far  Non-tree vertices: rest of vertices  Prim’s Selection rule “Select the minimum weight edge between a tree- node and a non-tree node and add to the tree.” Slide 16 Weight of the Spanning Tree =23+29+31+32+47+54+66 =282
  • 17. More Detail  r : Grow the minimum spanning tree from the root vertex “r”.  Q : is a priority queue, holding all vertices that are not in the tree now.  key[v] : is the minimum weight of any edge connecting v to a vertex in the tree.  p [v] : names the parent of v in the tree.  T[v] – Vertex v is already included in MST if T[v]==1, otherwise, it is not included yet. Prime’s Algorithm Cont … Slide 17
  • 18. a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 V a b c d e f g h i T 1 0 0 0 0 0 0 0 0 Key 0 - - - - - - - - p -1 - - - - - - - - Prime’s Algorithm Cont … Slide 18 root
  • 19. a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 V a b c d e f g h i T 1 0 0 0 0 0 0 0 0 Key 0 4 - - - - - 8 - p -1 a - - - - - a - Prime’s Algorithm Cont … Slide 19 root
  • 20. V a b c d e f g h i T 1 1 0 0 0 0 0 0 0 Key 0 4 8 - - - - 8 - p -1 a b - - - - a - a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 Important: Update Key[v] only if T[v]==0 Prime’s Algorithm Cont … Slide 20 root
  • 21. V a b c d e f g h i T 1 1 1 0 0 0 0 0 0 Key 0 4 8 7 - 4 - 8 2 p -1 a b c - c - a c a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 Prime’s Algorithm Cont … Slide 21 root
  • 22. V a b c d e f g h i T 1 1 1 0 0 0 0 0 1 Key 0 4 8 7 - 4 6 7 2 p -1 a b c - c i i c a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 Prime’s Algorithm Cont … Slide 22 root
  • 23. V a b c d e f g h i T 1 1 1 0 0 1 0 0 1 Key 0 4 8 7 10 4 2 7 2 p -1 a b c f c f i c a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 Prime’s Algorithm Cont … Slide 23 root
  • 24. V a b c d e f g h i T 1 1 1 0 0 1 1 0 1 Key 0 4 8 7 10 4 2 1 2 p -1 a b c f c f g c a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 Prime’s Algorithm Cont … Slide 24 root
  • 25. V a b c d e f g h i T 1 1 1 0 0 1 1 1 1 Key 0 4 8 7 10 4 2 1 2 p -1 a b c f c f g c a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 Prime’s Algorithm Cont … Slide 25 root
  • 26. V a b c d e f g h i T 1 1 1 1 0 1 1 1 1 Key 0 4 8 7 9 4 2 1 2 p -1 a b c d c f g c a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 Prime’s Algorithm Cont … Slide 26 root
  • 27. V a b c d e f g h i T 1 1 1 1 1 1 1 1 1 Key 0 4 8 7 9 4 2 1 2 p -1 a b c d c f g c a b h c d e f g i 4 8 7 9 10 14 4 2 2 6 1 7 11 8 All T[v] = 1 So Done Prime’s Algorithm Cont … Slide 27 root
  • 28. Kruskal’s Algorithm Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm  Edge based algorithm  Add the edges one at a time, in increasing weight order  It maintains a forest of trees.  An edge is accepted it if connects vertices of distinct trees Slide 28
  • 29. Kruskal’s Algorithm Cont … Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm Slide 29
  • 30. Kruskal’s Algorithm Cont … Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm Slide 30
  • 31. Kruskal’s Algorithm Cont … Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm Slide 31
  • 32. Kruskal’s Algorithm Cont … Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm Slide 32
  • 33. Kruskal’s Algorithm Cont … Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm Slide 33
  • 34. Kruskal’s Algorithm Cont … Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm Slide 34
  • 35. Kruskal’s Algorithm Cont … Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm Up to this point, we have simply taken the edges in order of their weight. But now we will have to reject an edge since it forms a cycle when added to those already chosen. Slide 35
  • 36. Kruskal’s Algorithm Cont … Basic Terminology  Cut : Partition of V. Ex: (S, V-S)  Cross : Edge (u,v) crosses the cut (S, V-S) if one of its endpoints is in S and the other is in V-S.  Light edge : An edge crossing a cut if its weight is the minimum of any edge crossing the cut.  Kruskal’s Algorithm Slide 36 Weight of the Spanning Tree =23+29+31+32+47+54+66 =282
  • 38. Conclusions  MST  Still works are going on  Boruvka's Algorithm  Inventor of MST  Prim’s algorithm “in parallel”  Huge Number of Applications  Networking  Data mining  Clustering, Classification etc. Slide 38