Apply Prim's algorithm (#709)

Apply Prim's algorithm (#709)

Find minimum spanning tree by growing a single tree.