SlideShare a Scribd company logo
GRAPH
APPLICATION - MST
o Prim’s
o Kruskal’s
1
WHAT IS SPANNING TREE
 A spanning tree of a graph is a tree that has all the
vertices of the graph connected by some edge
 A graph can have one or more number of spanning
trees.
 If the graph has N vertices then the spanning tree
will have n-1 edges
2
SPANNING TREE EXAMPLE
3
SPANNING TREE - CREATION
 Either DFS or BFS can be used to create a spanning
tree
 When DFS is used, the resulting spanning tree is
known as a depth first spanning tree
 When BFS is used, the resulting spanning tree is
known as a breadth first spanning tree
 While adding a non-tree edge into any spanning tree,
this will create a cycle
4
MINIMUM SPANNING TREE
 A minimum spanning tree is a spanning tree that has
the minimum weight than all other spanning trees of a
graph
 Three different algorithms can be used
 Prim’s algorithm
 Kruskal’s algorithm 5
PRIM’S ALGORITHM - INTRODUCTION
 Prim's algorithm is a greedy algorithm.
 It finds a minimum spanning tree for a weighted
undirected graph.
 This means it finds a subset of the edges that forms a
tree that includes every vertex, where the total weight of
all the edges in the tree is minimized.
6
PRIM’S STEPS
1.Select any vertex
2.Select the shortest edge connected to that vertex
3.Select the shortest edge connected to any vertex
already connected
4.Repeat step 3 until all vertices have been
connected
7
PRIM’S ALGORITHM
8
Initialization:
 Pick a vertex r to be the root
 Set D(r) = 0, parent(r) = null
 For all vertices v  V, v  r, set D(v) = 
 Insert all vertices into priority queue P, using
distances as the keys
PRIM’S ALGORITHM (CONT..)
9
a
c
e
d
b
2
45
9
6
4
5
5
e a b c d
0    
Vertex Parent
e -
Vertex
Distance
PRIM’S ALGORITHM (CONT..)
While P is not empty:
 Select the next vertex u to add to the tree
u = P.deleteMin()
 Update the weight of each vertex w adjacent to u
which is not in the tree (i.e., w  P)
If weight(u,w) < D(w),
a. parent(w) = u
b. D(w) = weight(u,w)
c. Update the priority queue to
reflect new distance for w
10
PRIM’S ALGORITHM (CONT..)
11
d b c a
4 5 5 
Vertex Parent
e -
b e
c e
d e
Vertex Parent
e -
b -
c -
d -
d b c a
   
e
0
PRIM’S ALGORITHM (CONT..)
12
a c b
2 4 5
Vertex Parent
e -
b e
c d
d e
a d
d b c a
4 5 5 
Vertex Parent
e -
b e
c e
d e
PRIM’S ALGORITHM (CONT..)
13
c b
4 5
Vertex Parent
e -
b e
c d
d e
a d
a c b
2 4 5
Vertex Parent
e -
b e
c d
d e
a d
PRIM’S ALGORITHM (CONT..)
14
b
5
Vertex Parent
e -
b e
c d
d e
a d
c b
4 5
Vertex Parent
e -
b e
c d
d e
a d
PRIM’S ALGORITHM (CONT..)
15
Vertex Parent
e -
b e
c d
d e
a d
b
5
Vertex Parent
e -
b e
c d
d e
a d
MST- USING PRIM’S ALGORITHM
16
a
c
e
d
b
2
45
9
6
4
5
5
RUNNING TIME OF PRIM’S ALGORITHM
 Initialization of priority queue (array): O(|V|)
 Update loop:
• Choosing vertex with minimum cost edge: O(|V|)
• Updating distance values of unconnected vertices:
each edge is considered only once during entire
execution, for a total of O(|E|) updates
 Overall cost :
17
O(|E| + |V| 2)
KRUSKAL’S ALGORITHM - INTRODUCTION
 Create a forest of trees from the vertices
 Repeatedly merge trees by adding “safe edges”
until only one tree remains
 A “safe edge” is an edge of minimum weight which
does not create a cycle
18
19
a
c
e
d
b
2
45
9
6
4
5
5
forest: {a}, {b}, {c}, {d}, {e}
DEFINING FOREST
1. Select the shortest edge in a network
2. Select the next shortest edge which does not
create a cycle
3. Repeat step 2 until all vertices have been
connected
20
KRUSKAL’S STEPS
21
Initialization
 a. Create a set for each vertex v  V
 b. Initialize the set of “safe edges” A comprising
the MST to the empty set
 c. Sort edges by increasing weight
KRUSKAL’S ALGORITHM
22
a
c
e
d
b
2
45
9
6
4
5
5
F = {a}, {b}, {c}, {d}, {e}
A = 
E = {(a,d), (c,d), (d,e), (a,c),
(b,e), (c,e), (b,d), (a,b)}
KRUSKAL’S ALGORITHM (CONT.)
23
 For each edge (u,v)  E in increasing order
while more than one set remains:
 If u and v, belong to different sets U and V
a. add edge (u,v) to the safe edge set
A = A  {(u,v)}
b. merge the sets U and V
F = F - U - V + (U  V)
 Return A
KRUSKAL’S ALGORITHM (CONT.)
24
E = {(a,d), (c,d), (d,e), (a,c),
(b,e), (c,e), (b,d), (a,b)}
Forest
{a}, {b}, {c}, {d}, {e}
{a,d}, {b}, {c}, {e}
{a,d,c}, {b}, {e}
{a,d,c,e}, {b}
{a,d,c,e,b}
A

{(a,d)}
{(a,d), (c,d)}
{(a,d), (c,d), (d,e)}
{(a,d), (c,d), (d,e), (b,e)}
KRUSKAL’S ALGORITHM (CONT.)
25
 Running time bounded by sorting (or findMin)
O(|E|log|E|) , or equivalently, O(|E|log|V|)
RUNNING TIME OF KRUSKAL’S ALGORITHM
26
APPLICATION OF MST
 Any time you want to visit all vertices in a graph at
minimum cost (e.g., wire routing on printed circuit boards,
sewer pipe layout, road planning…)
 Internet content distribution
 Idea: publisher produces web pages, content
distribution network replicates web pages to many
locations so consumers can access at higher speed
 MST may not be good enough!
content distribution on minimum cost tree may take a
long time!
27

More Related Content

What's hot (20)

PDF
Approximation Algorithms
Nicolas Bettenburg
 
PPT
Backtracking Algorithm.ppt
SalmIbrahimIlyas
 
PPTX
Prim's algorithm
Pankaj Thakur
 
PPT
Spanning trees
Shareb Ismaeel
 
PPTX
Dijkstra's Algorithm
Tamzida_Azad
 
PPT
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
Sahil Kumar
 
PPTX
Dijkstra s algorithm
mansab MIRZA
 
PPT
Graph traversal-BFS & DFS
Rajandeep Gill
 
PPTX
Dijkstra’S Algorithm
ami_01
 
PDF
Minimum spanning tree
Amit Kumar Rathi
 
PPTX
Graph Traversal Algorithm
jyothimonc
 
PPT
Dijkstra.ppt
Ruchika Sinha
 
PDF
Dijkstra's Algorithm
ArijitDhali
 
PPT
Prim Algorithm and kruskal algorithm
Acad
 
PPTX
Minimum spanning Tree
Narendra Singh Patel
 
PPT
Backtracking
Vikas Sharma
 
PPTX
Bellman ford Algorithm
taimurkhan803
 
PPT
minimum spanning tree
Melaku Bayih Demessie
 
PPT
Graph coloring problem
V.V.Vanniaperumal College for Women
 
PDF
Optimal binary search tree dynamic programming
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Approximation Algorithms
Nicolas Bettenburg
 
Backtracking Algorithm.ppt
SalmIbrahimIlyas
 
Prim's algorithm
Pankaj Thakur
 
Spanning trees
Shareb Ismaeel
 
Dijkstra's Algorithm
Tamzida_Azad
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
Sahil Kumar
 
Dijkstra s algorithm
mansab MIRZA
 
Graph traversal-BFS & DFS
Rajandeep Gill
 
Dijkstra’S Algorithm
ami_01
 
Minimum spanning tree
Amit Kumar Rathi
 
Graph Traversal Algorithm
jyothimonc
 
Dijkstra.ppt
Ruchika Sinha
 
Dijkstra's Algorithm
ArijitDhali
 
Prim Algorithm and kruskal algorithm
Acad
 
Minimum spanning Tree
Narendra Singh Patel
 
Backtracking
Vikas Sharma
 
Bellman ford Algorithm
taimurkhan803
 
minimum spanning tree
Melaku Bayih Demessie
 
Graph coloring problem
V.V.Vanniaperumal College for Women
 

Viewers also liked (20)

PPTX
Minimum Spanning Tree
zhaokatherine
 
PPT
Prim's Algorithm on minimum spanning tree
oneous
 
PPTX
Android based application for graph analysis final report
Pallab Sarkar
 
PPT
Kruskals prims shared by: geekssay.com
Hemant Gautam
 
PDF
Greedy minimum spanning tree- prim's algorithm
Department of Information Management Ming Chuan University, Taiwan
 
PPTX
A presentation on prim's and kruskal's algorithm
Gaurav Kolekar
 
PPTX
Static Spatial Graph Features
Niklas Elmqvist
 
PDF
Prims Algorithm
Sriram Raj
 
PPTX
Kruskal & Prim's Algorithm
Ifad Rahman
 
PPT
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
PPT
9 cm402.18
myrajendra
 
PPT
Minimum spanning tree
Tanmay Baranwal
 
PDF
Prim algorithm
University of Potsdam
 
PPT
Minimum spanning tree
Hinal Lunagariya
 
PPTX
Application of greedy method prim
Tech_MX
 
PPTX
Smoothing Filters in Spatial Domain
Madhu Bala
 
PPTX
Prim's algorithm
Maher Alshammari
 
PPTX
Kruskal Algorithm
Snehasis Panigrahi
 
PPT
2.4 mst prim’s algorithm
Krish_ver2
 
PPTX
Graph theory and life
Milan Joshi
 
Minimum Spanning Tree
zhaokatherine
 
Prim's Algorithm on minimum spanning tree
oneous
 
Android based application for graph analysis final report
Pallab Sarkar
 
Kruskals prims shared by: geekssay.com
Hemant Gautam
 
Greedy minimum spanning tree- prim's algorithm
Department of Information Management Ming Chuan University, Taiwan
 
A presentation on prim's and kruskal's algorithm
Gaurav Kolekar
 
Static Spatial Graph Features
Niklas Elmqvist
 
Prims Algorithm
Sriram Raj
 
Kruskal & Prim's Algorithm
Ifad Rahman
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
9 cm402.18
myrajendra
 
Minimum spanning tree
Tanmay Baranwal
 
Prim algorithm
University of Potsdam
 
Minimum spanning tree
Hinal Lunagariya
 
Application of greedy method prim
Tech_MX
 
Smoothing Filters in Spatial Domain
Madhu Bala
 
Prim's algorithm
Maher Alshammari
 
Kruskal Algorithm
Snehasis Panigrahi
 
2.4 mst prim’s algorithm
Krish_ver2
 
Graph theory and life
Milan Joshi
 
Ad

Similar to GRAPH APPLICATION - MINIMUM SPANNING TREE (MST) (20)

PPTX
Minimum spanning tree
AhmedMalik74
 
PDF
Algorithms explained
PIYUSH Dubey
 
PPT
Greedy Approach in Design Analysis and Algorithms
NikunjGoyal20
 
PDF
lecture 23 algorithm design and analysis
bluebirdrish666
 
PPTX
Minimum spanning tree
STEFFY D
 
PDF
Daa chpater14
B.Kirron Reddi
 
PDF
Skiena algorithm 2007 lecture13 minimum spanning trees
zukun
 
PDF
Topological Sort
Dr Sandeep Kumar Poonia
 
PPT
Weighted graphs
Core Condor
 
PDF
19 Minimum Spanning Trees
Andres Mendez-Vazquez
 
PPTX
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
KUSHDHIRRA2111026030
 
PDF
Daa chapter13
B.Kirron Reddi
 
PPTX
uva-201026072839.pptxvcvczcvzvcxbxcvbcxvbvcxbcx
avishekpradhan24
 
PPT
Dijkstra algorithm ds 57612334t4t44.ppt
ssuser7b9bda1
 
PPT
Dijkstra Shortest Path Algorithm in Network.ppt
RAJASEKARAN G
 
PPTX
Secure Domination in graphs
Mahesh Gadhwal
 
PDF
Algorithm chapter 9
chidabdu
 
PPT
Graph Theory PPT presentation created by Selvam.
selfcinima
 
PPTX
11L_2024_DSCS_EN_Trees2_Prim_Kraskal.pptx
RavanGulmetov
 
Minimum spanning tree
AhmedMalik74
 
Algorithms explained
PIYUSH Dubey
 
Greedy Approach in Design Analysis and Algorithms
NikunjGoyal20
 
lecture 23 algorithm design and analysis
bluebirdrish666
 
Minimum spanning tree
STEFFY D
 
Daa chpater14
B.Kirron Reddi
 
Skiena algorithm 2007 lecture13 minimum spanning trees
zukun
 
Topological Sort
Dr Sandeep Kumar Poonia
 
Weighted graphs
Core Condor
 
19 Minimum Spanning Trees
Andres Mendez-Vazquez
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
KUSHDHIRRA2111026030
 
Daa chapter13
B.Kirron Reddi
 
uva-201026072839.pptxvcvczcvzvcxbxcvbcxvbvcxbcx
avishekpradhan24
 
Dijkstra algorithm ds 57612334t4t44.ppt
ssuser7b9bda1
 
Dijkstra Shortest Path Algorithm in Network.ppt
RAJASEKARAN G
 
Secure Domination in graphs
Mahesh Gadhwal
 
Algorithm chapter 9
chidabdu
 
Graph Theory PPT presentation created by Selvam.
selfcinima
 
11L_2024_DSCS_EN_Trees2_Prim_Kraskal.pptx
RavanGulmetov
 
Ad

More from Madhu Bala (9)

PPTX
Internet of Things (IoT)
Madhu Bala
 
PPTX
Digital logic
Madhu Bala
 
PPTX
Operating system
Madhu Bala
 
PPTX
Greedy Algorithm - Knapsack Problem
Madhu Bala
 
PPTX
Divide and conquer - Quick sort
Madhu Bala
 
PPTX
GPRS Technology
Madhu Bala
 
PPTX
Algorithm - Introduction
Madhu Bala
 
PPTX
4G technology
Madhu Bala
 
PPTX
Data structure - Graph
Madhu Bala
 
Internet of Things (IoT)
Madhu Bala
 
Digital logic
Madhu Bala
 
Operating system
Madhu Bala
 
Greedy Algorithm - Knapsack Problem
Madhu Bala
 
Divide and conquer - Quick sort
Madhu Bala
 
GPRS Technology
Madhu Bala
 
Algorithm - Introduction
Madhu Bala
 
4G technology
Madhu Bala
 
Data structure - Graph
Madhu Bala
 

Recently uploaded (20)

PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PDF
PRIZ Academy - Change Flow Thinking Master Change with Confidence.pdf
PRIZ Guru
 
PPTX
Electron Beam Machining for Production Process
Rajshahi University of Engineering & Technology(RUET), Bangladesh
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PPTX
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PDF
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PPTX
Benefits_^0_Challigi😙🏡💐8fenges[1].pptx
akghostmaker
 
PPTX
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
Innowell Capability B0425 - Commercial Buildings.pptx
regobertroza
 
PPT
inherently safer design for engineering.ppt
DhavalShah616893
 
PPTX
Structural Functiona theory this important for the theorist
cagumaydanny26
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PRIZ Academy - Change Flow Thinking Master Change with Confidence.pdf
PRIZ Guru
 
Electron Beam Machining for Production Process
Rajshahi University of Engineering & Technology(RUET), Bangladesh
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
Hashing Introduction , hash functions and techniques
sailajam21
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
Benefits_^0_Challigi😙🏡💐8fenges[1].pptx
akghostmaker
 
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Thermal runway and thermal stability.pptx
godow93766
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Innowell Capability B0425 - Commercial Buildings.pptx
regobertroza
 
inherently safer design for engineering.ppt
DhavalShah616893
 
Structural Functiona theory this important for the theorist
cagumaydanny26
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 

GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)

  • 1. GRAPH APPLICATION - MST o Prim’s o Kruskal’s 1
  • 2. WHAT IS SPANNING TREE  A spanning tree of a graph is a tree that has all the vertices of the graph connected by some edge  A graph can have one or more number of spanning trees.  If the graph has N vertices then the spanning tree will have n-1 edges 2
  • 4. SPANNING TREE - CREATION  Either DFS or BFS can be used to create a spanning tree  When DFS is used, the resulting spanning tree is known as a depth first spanning tree  When BFS is used, the resulting spanning tree is known as a breadth first spanning tree  While adding a non-tree edge into any spanning tree, this will create a cycle 4
  • 5. MINIMUM SPANNING TREE  A minimum spanning tree is a spanning tree that has the minimum weight than all other spanning trees of a graph  Three different algorithms can be used  Prim’s algorithm  Kruskal’s algorithm 5
  • 6. PRIM’S ALGORITHM - INTRODUCTION  Prim's algorithm is a greedy algorithm.  It finds a minimum spanning tree for a weighted undirected graph.  This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized. 6
  • 7. PRIM’S STEPS 1.Select any vertex 2.Select the shortest edge connected to that vertex 3.Select the shortest edge connected to any vertex already connected 4.Repeat step 3 until all vertices have been connected 7
  • 8. PRIM’S ALGORITHM 8 Initialization:  Pick a vertex r to be the root  Set D(r) = 0, parent(r) = null  For all vertices v  V, v  r, set D(v) =   Insert all vertices into priority queue P, using distances as the keys
  • 9. PRIM’S ALGORITHM (CONT..) 9 a c e d b 2 45 9 6 4 5 5 e a b c d 0     Vertex Parent e - Vertex Distance
  • 10. PRIM’S ALGORITHM (CONT..) While P is not empty:  Select the next vertex u to add to the tree u = P.deleteMin()  Update the weight of each vertex w adjacent to u which is not in the tree (i.e., w  P) If weight(u,w) < D(w), a. parent(w) = u b. D(w) = weight(u,w) c. Update the priority queue to reflect new distance for w 10
  • 11. PRIM’S ALGORITHM (CONT..) 11 d b c a 4 5 5  Vertex Parent e - b e c e d e Vertex Parent e - b - c - d - d b c a     e 0
  • 12. PRIM’S ALGORITHM (CONT..) 12 a c b 2 4 5 Vertex Parent e - b e c d d e a d d b c a 4 5 5  Vertex Parent e - b e c e d e
  • 13. PRIM’S ALGORITHM (CONT..) 13 c b 4 5 Vertex Parent e - b e c d d e a d a c b 2 4 5 Vertex Parent e - b e c d d e a d
  • 14. PRIM’S ALGORITHM (CONT..) 14 b 5 Vertex Parent e - b e c d d e a d c b 4 5 Vertex Parent e - b e c d d e a d
  • 15. PRIM’S ALGORITHM (CONT..) 15 Vertex Parent e - b e c d d e a d b 5 Vertex Parent e - b e c d d e a d
  • 16. MST- USING PRIM’S ALGORITHM 16 a c e d b 2 45 9 6 4 5 5
  • 17. RUNNING TIME OF PRIM’S ALGORITHM  Initialization of priority queue (array): O(|V|)  Update loop: • Choosing vertex with minimum cost edge: O(|V|) • Updating distance values of unconnected vertices: each edge is considered only once during entire execution, for a total of O(|E|) updates  Overall cost : 17 O(|E| + |V| 2)
  • 18. KRUSKAL’S ALGORITHM - INTRODUCTION  Create a forest of trees from the vertices  Repeatedly merge trees by adding “safe edges” until only one tree remains  A “safe edge” is an edge of minimum weight which does not create a cycle 18
  • 19. 19 a c e d b 2 45 9 6 4 5 5 forest: {a}, {b}, {c}, {d}, {e} DEFINING FOREST
  • 20. 1. Select the shortest edge in a network 2. Select the next shortest edge which does not create a cycle 3. Repeat step 2 until all vertices have been connected 20 KRUSKAL’S STEPS
  • 21. 21 Initialization  a. Create a set for each vertex v  V  b. Initialize the set of “safe edges” A comprising the MST to the empty set  c. Sort edges by increasing weight KRUSKAL’S ALGORITHM
  • 22. 22 a c e d b 2 45 9 6 4 5 5 F = {a}, {b}, {c}, {d}, {e} A =  E = {(a,d), (c,d), (d,e), (a,c), (b,e), (c,e), (b,d), (a,b)} KRUSKAL’S ALGORITHM (CONT.)
  • 23. 23  For each edge (u,v)  E in increasing order while more than one set remains:  If u and v, belong to different sets U and V a. add edge (u,v) to the safe edge set A = A  {(u,v)} b. merge the sets U and V F = F - U - V + (U  V)  Return A KRUSKAL’S ALGORITHM (CONT.)
  • 24. 24 E = {(a,d), (c,d), (d,e), (a,c), (b,e), (c,e), (b,d), (a,b)} Forest {a}, {b}, {c}, {d}, {e} {a,d}, {b}, {c}, {e} {a,d,c}, {b}, {e} {a,d,c,e}, {b} {a,d,c,e,b} A  {(a,d)} {(a,d), (c,d)} {(a,d), (c,d), (d,e)} {(a,d), (c,d), (d,e), (b,e)} KRUSKAL’S ALGORITHM (CONT.)
  • 25. 25  Running time bounded by sorting (or findMin) O(|E|log|E|) , or equivalently, O(|E|log|V|) RUNNING TIME OF KRUSKAL’S ALGORITHM
  • 26. 26
  • 27. APPLICATION OF MST  Any time you want to visit all vertices in a graph at minimum cost (e.g., wire routing on printed circuit boards, sewer pipe layout, road planning…)  Internet content distribution  Idea: publisher produces web pages, content distribution network replicates web pages to many locations so consumers can access at higher speed  MST may not be good enough! content distribution on minimum cost tree may take a long time! 27