added prim's algorithm (lazy implementation)