SlideShare a Scribd company logo
2
Most read
4
Most read
6
Most read
KUVEMPU UNIVERSITY  Department of Computer Science Jnana Sahyadri Shankarghatta Seminar on “ Kruskal’s Algorithm ” Presented by,  Chaitra.M.S  3 rd   sem , M.Sc, Dept. Of Computer Science, Shankarghatta. Under the guidance of, Suresh.M,   Dept. Of Computer Science, Shankarghatta.
Contents Spanning trees Finding a spanning tree Minimum-cost spanning trees Kruskal’s algorithm And example
Spanning Trees
Spanning trees Suppose you have a connected undirected graph Connected: every node is reachable from every other node Undirected: edges do not have an associated direction ...then a  spanning tree  of the graph is a connected subgraph in which there are no cycles A connected, undirected graph Four of the spanning trees of the graph
Finding a spanning tree To find a spanning tree of a graph, pick an initial node and call it part of the spanning tree do a search from the initial node: each time you find a node that is not in the spanning tree, add to the spanning tree both the new node  and  the edge you followed to get to it An undirected graph
Minimizing costs Suppose you want to supply a set of houses (say, in a new subdivision) with: electric power water sewage lines telephone lines To keep costs down, you could connect these houses with a spanning tree (of, for example, power lines) However, the houses are not all equal distances apart To reduce costs even further, you could connect the houses with a  minimum-cost  spanning tree
Minimum-cost spanning trees Suppose you have a connected undirected graph with a  weight  (or  cost ) associated with each edge The cost of a spanning tree would be the sum of the costs of its edges A  minimum-cost spanning tree  is a spanning tree that has the lowest cost A B E D F C 16 19 21 11 33 14 18 10 6 5 A connected, undirected graph A B E D F C 16 11 18 6 5 A minimum-cost spanning tree A B E D F C 16 19 21 11 33 14 18 10 6 5 A connected, undirected graph
Kruskal algorithm(E,cost,n,t) //E is set of  edges in G .G has n vertices.Cost[u,v] is //cost of edge(u,v).t is the set of edges in minimum-cost //spanning tree.the final cost is returned.  { //construct a heap out of the edge costs using heapify For i=:1 to n do parent[i]:=-1; //each vertex is in a different set. i:=0;mincost:=0.0; While((i<n-1) and  (heap not empty)) do { //delete a minimum cost edje(u,v) from the heap and reheapify  using Adjust; j:=Find(u); k:=Find(v);
If  (j!=k) then {  i:=i+1; t[i,1]:=u; t[i,2]:=v; mincost:=mincost+cost[u,v]; union(j,k); } } if(i!=n-1) then write(“no spanning tree”); else return mincost; }
Example graph
 
 
 
 
 
 
 
 
Minimum cost spanning tree we obtained finally
  Any queries???????????
Thank U………………

More Related Content

PPTX
Minimum Spanning Tree
PPT
minimum spanning trees Algorithm
PPTX
Kruskal Algorithm
PPTX
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
PPT
minimum spanning tree
PPTX
My presentation minimum spanning tree
PPTX
Kruskal & Prim's Algorithm
PPT
Prim Algorithm and kruskal algorithm
Minimum Spanning Tree
minimum spanning trees Algorithm
Kruskal Algorithm
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
minimum spanning tree
My presentation minimum spanning tree
Kruskal & Prim's Algorithm
Prim Algorithm and kruskal algorithm

What's hot (20)

PPTX
PRIM'S ALGORITHM
PPTX
Minimum spanning Tree
PPTX
Kruskal Algorithm
PPTX
Dijkstra’s algorithm
PDF
Minimum spanning tree
PPT
Single source stortest path bellman ford and dijkstra
PPTX
Kruskal's algorithm
PDF
Shortest Path in Graph
PPTX
Minimum spanning tree
PPTX
Kruskal’s algorithm
PPTX
Shortest path algorithm
PPTX
Prims & kruskal algorithms
PPT
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
PDF
Prims Algorithm
PPTX
Dijkstra's Algorithm
PPTX
Bellman ford algorithm
PDF
All pairs shortest path algorithm
PPT
Prim's Algorithm on minimum spanning tree
PPT
Backtracking
PPTX
PRIM’S AND KRUSKAL’S ALGORITHM
PRIM'S ALGORITHM
Minimum spanning Tree
Kruskal Algorithm
Dijkstra’s algorithm
Minimum spanning tree
Single source stortest path bellman ford and dijkstra
Kruskal's algorithm
Shortest Path in Graph
Minimum spanning tree
Kruskal’s algorithm
Shortest path algorithm
Prims & kruskal algorithms
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
Prims Algorithm
Dijkstra's Algorithm
Bellman ford algorithm
All pairs shortest path algorithm
Prim's Algorithm on minimum spanning tree
Backtracking
PRIM’S AND KRUSKAL’S ALGORITHM
Ad

Viewers also liked (16)

PPTX
Spanning trees & applications
PPTX
A presentation on prim's and kruskal's algorithm
PPTX
Kruskal’s Algorithm
PPTX
Minimum spanning tree algorithms by ibrahim_alfayoumi
PPT
Minimum spanning tree
PPTX
Prims and kruskal algorithms
PDF
articulation points in graph
PDF
04 greedyalgorithmsii
PPTX
Introduction to Graph Theory
PPT
1535 graph algorithms
PDF
Algorithms explained
PDF
CG simple openGL point & line-course 2
PPS
Greedy Algorithms with examples' b-18298
PPTX
Introduction to graph theory (All chapter)
PPT
Minimum spanning tree
PDF
Graph theory narsingh deo
Spanning trees & applications
A presentation on prim's and kruskal's algorithm
Kruskal’s Algorithm
Minimum spanning tree algorithms by ibrahim_alfayoumi
Minimum spanning tree
Prims and kruskal algorithms
articulation points in graph
04 greedyalgorithmsii
Introduction to Graph Theory
1535 graph algorithms
Algorithms explained
CG simple openGL point & line-course 2
Greedy Algorithms with examples' b-18298
Introduction to graph theory (All chapter)
Minimum spanning tree
Graph theory narsingh deo
Ad

Similar to KRUSKAL'S algorithm from chaitra (20)

PPT
Spanning trees
PPT
33 spanning-trees
PPTX
Data structure
PPTX
Data Structures and Algorithms Kruskals algorithm
PPTX
Minimum Spanning Tree (Data Structure and Algorithm)
PDF
Skiena algorithm 2007 lecture13 minimum spanning trees
PPTX
Data structure
PPT
17 prims-kruskals (1)
PPTX
kruskal and prims algorithm _
PPTX
uva-201026072839.pptxvcvczcvzvcxbxcvbcxvbvcxbcx
PPTX
Minimum Spanning Tree
PPT
Graph Theory PPT presentation created by Selvam.
PPTX
DM Min SPan Tree Minimum spanning tree .pptx
PPTX
Bfs dfs mst
PPTX
prim's and kruskal's algorithm
PPT
chapter23.ppt
PDF
Slides10 - Minimum Spanning Tree jdh.pdf
PPTX
11L_2024_DSCS_EN_Trees2_Prim_Kraskal.pptx
PPTX
GRAPH - DISCRETE STRUCTURE AND ALGORITHM
Spanning trees
33 spanning-trees
Data structure
Data Structures and Algorithms Kruskals algorithm
Minimum Spanning Tree (Data Structure and Algorithm)
Skiena algorithm 2007 lecture13 minimum spanning trees
Data structure
17 prims-kruskals (1)
kruskal and prims algorithm _
uva-201026072839.pptxvcvczcvzvcxbxcvbcxvbvcxbcx
Minimum Spanning Tree
Graph Theory PPT presentation created by Selvam.
DM Min SPan Tree Minimum spanning tree .pptx
Bfs dfs mst
prim's and kruskal's algorithm
chapter23.ppt
Slides10 - Minimum Spanning Tree jdh.pdf
11L_2024_DSCS_EN_Trees2_Prim_Kraskal.pptx
GRAPH - DISCRETE STRUCTURE AND ALGORITHM

Recently uploaded (20)

PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Classroom Observation Tools for Teachers
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Cell Types and Its function , kingdom of life
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Complications of Minimal Access Surgery at WLH
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Pharma ospi slides which help in ospi learning
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Microbial disease of the cardiovascular and lymphatic systems
2.FourierTransform-ShortQuestionswithAnswers.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Final Presentation General Medicine 03-08-2024.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Final Presentation General Medicine 03-08-2024.pptx
Classroom Observation Tools for Teachers
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
VCE English Exam - Section C Student Revision Booklet
Cell Types and Its function , kingdom of life
Supply Chain Operations Speaking Notes -ICLT Program
Complications of Minimal Access Surgery at WLH

KRUSKAL'S algorithm from chaitra

  • 1. KUVEMPU UNIVERSITY Department of Computer Science Jnana Sahyadri Shankarghatta Seminar on “ Kruskal’s Algorithm ” Presented by, Chaitra.M.S 3 rd sem , M.Sc, Dept. Of Computer Science, Shankarghatta. Under the guidance of, Suresh.M, Dept. Of Computer Science, Shankarghatta.
  • 2. Contents Spanning trees Finding a spanning tree Minimum-cost spanning trees Kruskal’s algorithm And example
  • 4. Spanning trees Suppose you have a connected undirected graph Connected: every node is reachable from every other node Undirected: edges do not have an associated direction ...then a spanning tree of the graph is a connected subgraph in which there are no cycles A connected, undirected graph Four of the spanning trees of the graph
  • 5. Finding a spanning tree To find a spanning tree of a graph, pick an initial node and call it part of the spanning tree do a search from the initial node: each time you find a node that is not in the spanning tree, add to the spanning tree both the new node and the edge you followed to get to it An undirected graph
  • 6. Minimizing costs Suppose you want to supply a set of houses (say, in a new subdivision) with: electric power water sewage lines telephone lines To keep costs down, you could connect these houses with a spanning tree (of, for example, power lines) However, the houses are not all equal distances apart To reduce costs even further, you could connect the houses with a minimum-cost spanning tree
  • 7. Minimum-cost spanning trees Suppose you have a connected undirected graph with a weight (or cost ) associated with each edge The cost of a spanning tree would be the sum of the costs of its edges A minimum-cost spanning tree is a spanning tree that has the lowest cost A B E D F C 16 19 21 11 33 14 18 10 6 5 A connected, undirected graph A B E D F C 16 11 18 6 5 A minimum-cost spanning tree A B E D F C 16 19 21 11 33 14 18 10 6 5 A connected, undirected graph
  • 8. Kruskal algorithm(E,cost,n,t) //E is set of edges in G .G has n vertices.Cost[u,v] is //cost of edge(u,v).t is the set of edges in minimum-cost //spanning tree.the final cost is returned. { //construct a heap out of the edge costs using heapify For i=:1 to n do parent[i]:=-1; //each vertex is in a different set. i:=0;mincost:=0.0; While((i<n-1) and (heap not empty)) do { //delete a minimum cost edje(u,v) from the heap and reheapify using Adjust; j:=Find(u); k:=Find(v);
  • 9. If (j!=k) then { i:=i+1; t[i,1]:=u; t[i,2]:=v; mincost:=mincost+cost[u,v]; union(j,k); } } if(i!=n-1) then write(“no spanning tree”); else return mincost; }
  • 11.  
  • 12.  
  • 13.  
  • 14.  
  • 15.  
  • 16.  
  • 17.  
  • 18.  
  • 19. Minimum cost spanning tree we obtained finally
  • 20. Any queries???????????