Minimum Spanning Tree Algorithms MST-Kruskal(G,w) T <- Ø for each vertex v in V[G] do Make-Set(v) Initialize Q to priority queue using weights as keys while T has < n-1 edges do (u,v) <- Q.removeMin() a <- FindSet(u) b <- FindSet(v) if a ‚ b then // if no cycle add edge T <- T union {(u,v)} Union(a,b) MST-Prim(G,w,r) // r is root/starting vertex in graph T <- Ø for each vertex u do key[u] <- infinity key[r] <- 0 // key[u] is distance from u to T pi[r] <- Nil // pi[u] is node in Q-V that u closest to Initialize Q to priority queue using key array values while Q ‚ Ø do u <- Q.removeMin() if pi[u] ‚ Nil then T <- T union {(u,pi[u])} for each v in Adj[u] do // update key of u's nbrs if v in Q and w(u,v) < key[v] then pi[v] <- u key[v] <- w(u,v) adjust Q for new key[v]