implemented naive prim's mst