//使用并查集,基本操作略
Quick_sort(1,m); //对边按权值排序
For i:=1 to m do
Begin
X:=father(e[i].a);
Y:=father(e[i].b);
If x<>y then
Begin
Union(x,y);
Inc(k);
E[i].select:=true;
End;
If k=n-1 then break;
End;
原文:http://www.cnblogs.com/cxvdzxhb/p/4478826.html