Prim's algorithm

Thanks for the useful comment!