next up previous
Next: Definitions: Up: CSE 2320: Algorithms and Previous: Minimum Spanning Trees

Growing a Minimal Spanning Tree

Greedy approach

Given A $\subseteq$ T = MST(G), determine a (u,v) to add to A such that A $\cup$ {(u,v)} $\subseteq$ T

Greedy-MST(G,w)
$\;\;\;\;\;$A = {}
$\;\;\;\;\;$while A is not a spanning tree $\;\;\;\;\;$ $\;\;\;\;\;$; includes all vertices of G
$\;\;\;\;\;$ $\;\;\;\;\;$find a safe edge (u,v) for A
$\;\;\;\;\;$ $\;\;\;\;\;$A = A $\cup$ {(u,v)}
$\;\;\;\;\;$return A



What is a ``safe'' edge?

A safe edge is an edge connecting a vertex in A $\subseteq$ T to a vertex in G that is not in A such that A $\cup$ safe edge $\subseteq$ MST.



Copyright © 1998 The University of Texas at Arlington