《计算机网络课程设计报告》
{........................................................................................................................................................................18
printf("\n
路由
[%d]
到路由
[%d]
的最短路径长度为
:%3d " ,v0+1,j+1,D[j]);..............................................18
n=j;...................................................................................................................................................................18
if(D[j]!=10000)//
判断是不是有可达路径
......................................................................................................18
for(k=0;k<i;k++).............................................................................................................................................18
{........................................................................................................................................................................18
temp[k]=pre[n];...............................................................................................................................................18
if(temp[k]!=v0)//
判断是不是源点自身
..........................................................................................................18
n=temp[k];.......................................................................................................................................................18
else....................................................................................................................................................................18
//(temp[k]==v0)//
是源点跳出
.........................................................................................................................18
break;................................................................................................................................................................18
}........................................................................................................................................................................18
if( k==0&&D[j]!=10000&&D[j]!=0 )//
当是源点时
.....................................................................................18
{........................................................................................................................................................................18
printf("
路由
[%d]->
路由
[%d]",v0+1,j+1);....................................................................................................18
}........................................................................................................................................................................18
if( k!=0 &&D[j]!=10000&&D[j]!=0)//
不是源点时
......................................................................................18
{........................................................................................................................................................................18
for(m=k;m>=0;m--).........................................................................................................................................18
{........................................................................................................................................................................18
printf("
路由
[%d]->",temp[m]+1);..................................................................................................................19
}........................................................................................................................................................................19
printf("
路由
[%d]",j+1);..................................................................................................................................19
}........................................................................................................................................................................19
if(D[j]==10000)//
没有路径
............................................................................................................................19
{........................................................................................................................................................................19
printf("
从路由
[%d]
出发没有最短路径到路由
[%d]!",v0+1,j+1);...............................................................19
}........................................................................................................................................................................19
if(D[j]==0)......................................................................................................................................................19
{........................................................................................................................................................................19
printf("
路由
[%d]",v0);....................................................................................................................................19
}........................................................................................................................................................................19