Prim's Algorithm with Adjacency matrix