文件名称:Prim法则(运行100成功)
文件大小:990B
文件格式:CPP
更新时间:2014-07-04 07:21:03
Prim
PrimMinSpanTree(mgraph g,int k)
{
int i,j,min,p;
struct
{
int adjvex;
int lowcost;
}closedge[MAX_VERTEX_NUM];
for(j=1;j<=g.vexnum;j++)
if(j!=k)
{
closedge[j].adjvex=k;
closedge[j].lowcost=g.arcs[k][j];
}
closedge[k].lowcost=0;
for(i=1;i