{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

07 - Minimum Spanning Trees and Prim's Algorithm

07 - Minimum Spanning Trees and Prim's Algorithm - Part II...

This preview shows pages 1–12. Sign up to view the full content.

Part II: Graph Algorithms Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Objective and Outline Objective : Introduce a second problem on graphs, i.e. MST, and discuss one solution. Reference : Chapter 23 of CLRS Spanning trees and minimum spanning trees (MST). Strategy for solving the MST problem. Prim’s algorithm for the MST problem. The idea The algorithm Analysis Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms
Spanning Trees Definition A subgraph T of a undirected graph G = ( V , E ) is a spanning tree of G if it is a tree and contains every vertex of G Example Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Spanning Trees Theorem Every connected graph has a spanning tree. Question Why is this true? Question Given a connected graph G , how can you find a spanning tree of G ? Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms
Weighted Graphs Definition A weighted graph is a graph, in which each edge has a weight (some real number) Example Definition Weight of a graph : The sum of the weights of all edges Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Minimum Spanning Trees Definition A Minimum spanning tree in an undirected connected weighted graph is a spanning tree of minimum weight (among all spanning trees). Example Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms
Remark The minimum spanning tree may not be unique Example 1 2 67 24 1 2 67 24 MST1 MST2 weighted graph 1 2 2 100 67 24 However, if the weights of all the edges are pairwise distinct, it is indeed unique (we won’t prove this now) Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Minimum Spanning Tree Problem Definition (MST Problem) Given a connected weighted undirected graph G , design an algorithm that outputs a minimum spanning tree (MST) of G . Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms
Outline Spanning trees and minimum spanning trees (MST). Strategy for solving the MST problem. Prim’s algorithm for the MST problem. The idea The algorithm Analysis Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
General strategy for solving the MST Problem A tree is an acyclic graph start with an empty graph try to add edges one at a time, always making sure that what is built remains acyclic. if we are sure every time the resulting graph is always a subset of some minimum spanning tree, we are done. Lecture 7: Minimum Spanning Trees and Prim’s Algorithm Part II: Graph Algorithms
Generic Algorithm for MST problem Definition Let A be a set of edges such that A T , where T is a MST. An edge ( u , v ) is a safe edge for A , if A ∪ { ( u , v ) } is also a subset of some MST If at each step, we can find a safe edge ( u , v ), we can grow a MST Generic-MST(G, w) begin A= EMPTY; while A does not form a spanning tree do

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 38

07 - Minimum Spanning Trees and Prim's Algorithm - Part II...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online