Added prim algorithm