MST-KRUSKAL(G,w)
- A ← {}
- for each vertex v ∈ G.V
- MAKE-SET(v)
- Sort the edges of G.E smallest to largest
- for each edge e=(u,v) ∈ G.E smallest to largest
- S = FIND-SET(u), T= FIND-SET(v)
- if S ≠ T
- A = A ∪{(u,v)} // add the edge to the tree
- UNION(S, T)
- return A