Prim algorithm tested