{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

notes39

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

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

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}

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

View Full Document
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] D[z] = weight (u, z) E[z] = (u, z) end if end loop end loop Ex: Step 1: Choose any vertex
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online