Prim && Kruskal 算法--最小生成树 -PTA 公路村村通

/*普利姆*/
# include 
# include 
# include 
# include 
# include 
# define MAXN 3005
# define INFI 9999999
using namespace std;

typedef struct Node
{
    int v;
    int len;
}Node;

int n,m,sum=0;
vector vt[MAXN];
int lowcost[MAXN];
int vis[MAXN];
void Prim(int x)
{
    for(int i=1; i<=n;++i)
    {
        lowcost[i] = INFI;
    }
    for(int i=0; i1] = 0; 
    

你可能感兴趣的:(Prim && Kruskal 算法--最小生成树 -PTA 公路村村通)