Prim's Minimum Spanning Tree


Algorithm

There is a set of nodes with edges that make up the graph, there is a set of nodes and edges E that are in the minimum spanning tree and a temporary set T of nodes. First put all edges from the source node into the temporary set of edges T. Pick the lowest cost edge in T, if it doesnt point to a node in E then add it to E and add all edges from it to T, if it does point to a node in E get rid of that edge. Repeat until T is empty.

Prim

Robert Prim was born in 1921 in Sweetwater Texax. He recived his BS in Eletrical Engineering and a PhD in Math from Princeton. He developed this algorithm in 1957 while working at Bell Labratories with Joseph Kruskal. The algorithm was originally discovered in 1930 by Czech mathematician Vojtech Jarnik, and was also rediscovered by Dijkstra in 1959 so sometimes it is called the DJP algorithm or the Jarnik algorithm.

Code
Prim.java
Node.java
Edge.java
Graph.java
MainApplet.java