There are two minimum spanning tree algorithms available: Prim and
Kruskal[CLR90]. Prim grows a tree from one node, while
Kruskal starts with a forest of trees and combines them into a single
tree. Prim's algorithm was chosen as it is more space efficient and
time efficient than Kruskal. For
servers, Kruskal requires
initial sets, with each one having some fixed overhead. In contrast
Prim requires just two sets of nodes: servers that are in the tree and
servers that are not yet in the tree.
Prim's algorithm will examine the same number of edges as
Kruskal, but because it only adds edges to the priority queue as they
are required (i.e. when it adds a new node to the tree it only adds to
the priority queue those edges that go from that node to other nodes
not already in the tree) it will require less lookups into the table
to extract the edge information. These intuitions are supported by the
analysis in [CLR90] which demonstrates that Prim has running
time
and Kruskal
. While these are
asymptotically equal, in this program the total interconnect between
nodes means that the number of edges,
, making Prim
just a little quicker.