This preview shows pages 1–11. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 310 Unit 19 Minimum Spanning Trees Furman Haddix Ph.D. Assistant Professor Minnesota State University, Mankato Spring 2008 Unit 19 Minimum Spanning Trees Objectives Minimum Spanning Tree Problem Minimum Spanning Tree Examples (After Kruskal) Kruskals Algorithm and Analysis Minimum Spanning Tree Example (After Jarnik) Jarniks Algorithm and Analysis Text Chapter 23.1, 23.2 Minimum Spanning Tree Problem A spanning tree is a tree which connects n vertices with n1 edges. In a graph with unweighted or equal weight edges, any spanning tree is a minimum spanning tree. In a graph with weighted edges a minimum spanning tree is the spanning tree with the minimum weight for the included edges totalWeight(MST) = (u, v) MST w(u, v) If an edge is added to a MST, a cycle will result. If an edge of the MST is replaced with another edge totalWeight(T) totalWeight(MST) A Greedy Minimum Spanning Tree Algorithm Sort edges in order of decreasing weight Assign each vertex to be its own leader Consider edges one by one in order If leader of one vertex is different from leader of other, add vertex to the spanning tree Else discard edge Minimum Spanning Tree Example 1 Initially, a forest of trees Sort edges by weight Ties dont matter 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 3 4 1 5 6 7 8 3 11 12 9 13 14 15 10 11 15 17 7 edge weight node ID leader Minimum Spanning Tree Example 1 Consider each edge, lowest weight edge first If edge does not connect to vertices with same leader, include in minimum spanning tree 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 3 4 1 5 6 7 8 3 11 12 9 13 14 15 10 11 15 17 7 edge weight node ID leader Minimum Spanning Tree Example 1 Consider each edge, lowest weight edge first If edge does not connect to vertices with same leader, include in minimum spanning tree 1 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 3 4 1 5 6 7 8 3 11 12 9 13 14 15 10 11 15 17 7 edge weight node ID leader Minimum Spanning Tree Example 1 Consider each edge, lowest weight edge first If edge does not connect to vertices with same leader, include in minimum spanning tree 1 2 3 4 4 5 5 6 6 7 7 8 8 9 9 3 4 1 5 6 7 8 3 11 12 9 13 14 15 10 11 15 17 7 edge weight node ID leader Minimum Spanning Tree Example 1 Consider each edge, lowest weight edge first If edge does not connect to vertices with same leader, include in minimum spanning tree 1 2 3 4 5 5 6 6 7 7 8 8 9 9 3 4 1 5 6 7 8 3 11 12 9 13 14 15 10 11 15 17 7 edge weight node ID leader Minimum Spanning Tree Example 1 Consider each edge, lowest weight edge first If edge does not connect to vertices with same leader,...
View
Full
Document
 Spring '08
 FurmanHaddix

Click to edit the document details