Is it possible to create an MST by simply iterating through vertices in a graph and selecting the smallest edge from that vertex and taking the union of all these edges? It seems this does not contradict the cut property and would be more efficient than implementing Prim's algorithm.
0
votes
2 Answers
0
votes
Kruskal's Algorithm for building a MST
- Initialize H = ∅.
- Sort edges in increasing order of weights.
- Loop through edges in increasing order of weights.
- If endpoints of e are not connected in H.
- Add e to H.
- If endpoints of e are not connected in H.
Source: https://www.cc.gatech.edu/~rpeng/CS3510_F17/Notes/Sep27MST.pdf
If you simply iterate over all the edges w/o taking into consideration if they are part of the MST, then you cannot be sure that they will not form a cycle.