notes39 - Minimum Spanning Tree - it is the tree of a graph...

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

View Full Document Right Arrow Icon
Minimum Spanning Tree - it is the tree of a graph with minimum total weight Examples: - connect all computers in a building with the least cable - connect locations on a map with the least amound of road Minimum Spanning Tree : Let V’ and V’’ be partitions of the vertices of graph G. Let (v’, v’’) be an edge across the partitions such that v’ is in V’ and v’’ is in V’’, then Then the edge with minimum weight across the partition is in the minimum spanning tree Example: => minimum spanning tree contains edge with weight 8. Prim Jarnick Algorithm Input: A weighted graph G Output: A Minimum Spanning Tree (MST) T of G pick a vertex v of G T = {v} //add initial vertex to MST D[v] = 0 //Distance from v to the MST E[v] = {} //edge that links v to MST D[u] = infinity for all u != v Q = {all vertices in G}
Background image of page 1

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

View Full DocumentRight Arrow Icon
while Q is not empty choose the minimum D[u] such that u is in Q remove u from Q add E[u] to T for each vertex z adjacent to u if weight(u, z) < D[z]
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/02/2012 for the course CS 251 taught by Professor Staff during the Fall '08 term at Purdue University-West Lafayette.

Page1 / 4

notes39 - Minimum Spanning Tree - it is the tree of a graph...

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

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