CS 310 Unit 19 Minimum Spanning Trees

CS 310 Unit 19 Minimum Spanning Trees - CS 310 Unit 19...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 n-1 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

Page1 / 61

CS 310 Unit 19 Minimum Spanning Trees - CS 310 Unit 19...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online