SlideShare a Scribd company logo
Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 23
Minimum Spanning Tree We then wish to find an acyclic subset  T  є   E  that connects all of the vertices and whose total weight is minimized.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Minimum Spanning Tree Assume that we have a connected, undirected graph  G  = ( V, E ) with a weight function  w  :  E  ->  R , and we wish to find a minimum spanning tree for  G . At each step, we determine an edge ( u, v ) that can be added to  A  without violating this invariant, in the sense that  A U  {( u, v )} is also a subset of a minimum spanning tree.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Minimum Spanning Tree A  cut  ( S, V  -  S ) of an undirected graph  G  = ( V ,  E ) is a partition of  V . We say that an edge ( u ,  v )  ε   E  crosses  the cut ( S ,  V  -  S ) if one of its endpoints is in  S  and the other is in  V  -  S .
Minimum Spanning Tree We say that a cut  respects  a set  A  of edges if no edge in  A  crosses the cut.  An edge is a  light edge  crossing a cut if its weight is the minimum of any edge crossing the cut.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Minimum Spanning Tree It finds a safe edge to add to the growing forest by finding, of all the edges that connect any two trees in the forest, an edge ( u ,  v ) of least weight.
Kruskal’s Algorithm It uses a disjoint-set data structure to maintain several disjoint sets of elements. Each set contains the vertices in a tree of the current forest. The operation FIND-SET( u ) returns a representative element from the set that contains  u . Thus, we can determine whether two vertices  u  and  v  belong to the same tree by testing whether FIND-SET( u ) equals FIND-SET( v ). The combining of trees is accomplished by the UNION procedure.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright  © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Ad

More Related Content

What's hot (19)

Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
meisamstar
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
Rashik Ishrak Nahian
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
sakthibalabalamuruga
 
d
dd
d
jagdeeparora86
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
STEFFY D
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
Tech_MX
 
Shortest path algorithm
Shortest  path algorithmShortest  path algorithm
Shortest path algorithm
Subrata Kumer Paul
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
ArijitDhali
 
Discrete Mathematics Presentation
Discrete Mathematics PresentationDiscrete Mathematics Presentation
Discrete Mathematics Presentation
Salman Elahi
 
Aplicaciones de la derivada
Aplicaciones de la derivadaAplicaciones de la derivada
Aplicaciones de la derivada
JOELSEBASTIANANDRADE
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
Subid Biswas
 
KRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitraKRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitra
guest1f4fb3
 
Aplicaciones de la derivada
Aplicaciones de la derivadaAplicaciones de la derivada
Aplicaciones de la derivada
JOELSEBASTIANANDRADE
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
Srikrishnan Suresh
 
Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsr
Linawati Adiman
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithm
mansab MIRZA
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
faisal2204
 
Performance of the Viterbi Algorithm on a Polya ChannelExample
Performance of the Viterbi Algorithm on a Polya ChannelExamplePerformance of the Viterbi Algorithm on a Polya ChannelExample
Performance of the Viterbi Algorithm on a Polya ChannelExample
Nestor Barraza
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)
Akshay soni
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
meisamstar
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
STEFFY D
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
Tech_MX
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
ArijitDhali
 
Discrete Mathematics Presentation
Discrete Mathematics PresentationDiscrete Mathematics Presentation
Discrete Mathematics Presentation
Salman Elahi
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
Subid Biswas
 
KRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitraKRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitra
guest1f4fb3
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
Srikrishnan Suresh
 
Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsr
Linawati Adiman
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithm
mansab MIRZA
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
faisal2204
 
Performance of the Viterbi Algorithm on a Polya ChannelExample
Performance of the Viterbi Algorithm on a Polya ChannelExamplePerformance of the Viterbi Algorithm on a Polya ChannelExample
Performance of the Viterbi Algorithm on a Polya ChannelExample
Nestor Barraza
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)
Akshay soni
 

Similar to chapter23.ppt (10)

Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9
Traian Rebedea
 
lecture 16
lecture 16lecture 16
lecture 16
sajinsc
 
19 Minimum Spanning Trees
19 Minimum Spanning Trees19 Minimum Spanning Trees
19 Minimum Spanning Trees
Andres Mendez-Vazquez
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm
sachin varun
 
Daa chapter13
Daa chapter13Daa chapter13
Daa chapter13
B.Kirron Reddi
 
Chapter 24 aoa
Chapter 24 aoaChapter 24 aoa
Chapter 24 aoa
Hanif Durad
 
Graph algorithms
Graph algorithmsGraph algorithms
Graph algorithms
University of Haripur
 
Weighted graphs
Weighted graphsWeighted graphs
Weighted graphs
Core Condor
 
spanningtreesapplications-120903115339-phpapp02 (1).pdf
spanningtreesapplications-120903115339-phpapp02 (1).pdfspanningtreesapplications-120903115339-phpapp02 (1).pdf
spanningtreesapplications-120903115339-phpapp02 (1).pdf
YasirAli74993
 
lecture 23 algorithm design and analysis
lecture 23 algorithm design and analysislecture 23 algorithm design and analysis
lecture 23 algorithm design and analysis
bluebirdrish666
 
Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9
Traian Rebedea
 
lecture 16
lecture 16lecture 16
lecture 16
sajinsc
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm
sachin varun
 
spanningtreesapplications-120903115339-phpapp02 (1).pdf
spanningtreesapplications-120903115339-phpapp02 (1).pdfspanningtreesapplications-120903115339-phpapp02 (1).pdf
spanningtreesapplications-120903115339-phpapp02 (1).pdf
YasirAli74993
 
lecture 23 algorithm design and analysis
lecture 23 algorithm design and analysislecture 23 algorithm design and analysis
lecture 23 algorithm design and analysis
bluebirdrish666
 
Ad

More from Tareq Hasan (20)

Grow Your Career with WordPress
Grow Your Career with WordPressGrow Your Career with WordPress
Grow Your Career with WordPress
Tareq Hasan
 
Caching in WordPress
Caching in WordPressCaching in WordPress
Caching in WordPress
Tareq Hasan
 
How to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org RepositoryHow to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org Repository
Tareq Hasan
 
Composer - The missing package manager for PHP
Composer - The missing package manager for PHPComposer - The missing package manager for PHP
Composer - The missing package manager for PHP
Tareq Hasan
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
Tareq Hasan
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
Tareq Hasan
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array Pointer
Tareq Hasan
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
Tareq Hasan
 
chapter - 6.ppt
chapter - 6.pptchapter - 6.ppt
chapter - 6.ppt
Tareq Hasan
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
Tareq Hasan
 
chapter-8.ppt
chapter-8.pptchapter-8.ppt
chapter-8.ppt
Tareq Hasan
 
Algorithm: priority queue
Algorithm: priority queueAlgorithm: priority queue
Algorithm: priority queue
Tareq Hasan
 
Algorithm: Quick-Sort
Algorithm: Quick-SortAlgorithm: Quick-Sort
Algorithm: Quick-Sort
Tareq Hasan
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
Tareq Hasan
 
Java: Inheritance
Java: InheritanceJava: Inheritance
Java: Inheritance
Tareq Hasan
 
Java: Exception
Java: ExceptionJava: Exception
Java: Exception
Tareq Hasan
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to Arrays
Tareq Hasan
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design Examples
Tareq Hasan
 
Java: Objects and Object References
Java: Objects and Object ReferencesJava: Objects and Object References
Java: Objects and Object References
Tareq Hasan
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
Tareq Hasan
 
Grow Your Career with WordPress
Grow Your Career with WordPressGrow Your Career with WordPress
Grow Your Career with WordPress
Tareq Hasan
 
Caching in WordPress
Caching in WordPressCaching in WordPress
Caching in WordPress
Tareq Hasan
 
How to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org RepositoryHow to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org Repository
Tareq Hasan
 
Composer - The missing package manager for PHP
Composer - The missing package manager for PHPComposer - The missing package manager for PHP
Composer - The missing package manager for PHP
Tareq Hasan
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
Tareq Hasan
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
Tareq Hasan
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array Pointer
Tareq Hasan
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
Tareq Hasan
 
Algorithm: priority queue
Algorithm: priority queueAlgorithm: priority queue
Algorithm: priority queue
Tareq Hasan
 
Algorithm: Quick-Sort
Algorithm: Quick-SortAlgorithm: Quick-Sort
Algorithm: Quick-Sort
Tareq Hasan
 
Java: Inheritance
Java: InheritanceJava: Inheritance
Java: Inheritance
Tareq Hasan
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to Arrays
Tareq Hasan
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design Examples
Tareq Hasan
 
Java: Objects and Object References
Java: Objects and Object ReferencesJava: Objects and Object References
Java: Objects and Object References
Tareq Hasan
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
Tareq Hasan
 
Ad

chapter23.ppt

  • 1. Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 23
  • 2. Minimum Spanning Tree We then wish to find an acyclic subset T є E that connects all of the vertices and whose total weight is minimized.
  • 3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 4. Minimum Spanning Tree Assume that we have a connected, undirected graph G = ( V, E ) with a weight function w : E -> R , and we wish to find a minimum spanning tree for G . At each step, we determine an edge ( u, v ) that can be added to A without violating this invariant, in the sense that A U {( u, v )} is also a subset of a minimum spanning tree.
  • 5. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 6. Minimum Spanning Tree A cut ( S, V - S ) of an undirected graph G = ( V , E ) is a partition of V . We say that an edge ( u , v ) ε E crosses the cut ( S , V - S ) if one of its endpoints is in S and the other is in V - S .
  • 7. Minimum Spanning Tree We say that a cut respects a set A of edges if no edge in A crosses the cut. An edge is a light edge crossing a cut if its weight is the minimum of any edge crossing the cut.
  • 8. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 9. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 10. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 11. Minimum Spanning Tree It finds a safe edge to add to the growing forest by finding, of all the edges that connect any two trees in the forest, an edge ( u , v ) of least weight.
  • 12. Kruskal’s Algorithm It uses a disjoint-set data structure to maintain several disjoint sets of elements. Each set contains the vertices in a tree of the current forest. The operation FIND-SET( u ) returns a representative element from the set that contains u . Thus, we can determine whether two vertices u and v belong to the same tree by testing whether FIND-SET( u ) equals FIND-SET( v ). The combining of trees is accomplished by the UNION procedure.
  • 13. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 14. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 15. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 16. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.