Added the graph construction to Prim MST