finished a prim algo that works