编辑: 学冬欧巴么么哒 | 2018-01-18 |
scanf("%d",&GV[i]);
} } for(i=0;
in-1;
j+调整mst[i+1]到mst[n-1] */ vy=mst[j].stop_vex;
weight = pgraph->arcs[vx][vy];
if (weight < mst[j].weight) { mst[j].weight = weight;
mst[j].start_vex = vx;
} } } } void prim //prim算法生成最小生成树 { int i,j,t,k,w,min,m;
struct edgeElem x;
for(i=0;
i0)//从0点连接其余顶点 { MST[i-1].fromvex=0;
MST[i-1].endvex=i;
MST[i-1].weight=GA[0][i];
} for(k=1;
k