add prim algorithm