after implementing prim algorithm