]){?charch;intj;?printf("\n******************Dijkstra算法**************\n");?printf("输入一个城市:");?fflush(stdin);?scanf("%c",&ch);?j=DFStrave(T,ch);?printf("到第一个城市的最短路程为:%d\n",D[j]);while(path[j]!=-1)?{?printf("%d---%d\n",j,path[j]);?j=path[j];?}}voidDijkstrapath(TuT)//dijkstra算法{?intD[max];intpath[max];intv0=0,S[max],min=200,k,j,i;for(i=0;i<T.v;i++){S[i]=0;?D[i]=T.bian[v0][i];?if(D[i]==0) path[i]=-1;?else path[i]=0;}S[v0]=1;D[v0]=0;for(i=1;i<T.v;i++){for(j=0;j<T.v;j++)?{?if(!S[j]&&D[j]<min) { min=D[j]; k=j; }?} S[k]=1;?for(j=0;j<T.v;j++)?{?if(!S[j]&&D[k]+T.bian[k][j]<D[j]) { D[j]=D[k]+T.bian[k][j]; path[j]=k; }?}}visit(T,D,path);}voidmain(){TuT;?intD[max][max];?intpath[max][max];charch1,ch2;inti,j;creattu(T);fflush(stdin);printf("请选择两个城市(输入格式为:A,B)");scanf("%c,%c",&ch1,&ch2);i=DFStrave(T,ch1);