Fixed the bug in the minimumSpanningTree function. Now the newly added edges are starting from the correct vertex instead of just starting from the vertex that was seen last