//kruskal算法
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
typedef struct edge
{
int v,w,value;
}edge;
edge edges[101];
int father[101];
int childcounts[101];
int cmp(edge a,edge b)
{
return a.value<b.value;
}
int findfather(int x)
{
return father[x]==x?x:findfather(father[x]);
}
int unions(int x,int y)
{
int rootx=findfather(x);
int rooty=findfather(y);
if(rootx==rooty) return 0;
else if(childcounts[x]>=childcounts[y])
{
......
阅读全文