intmain(void) { int i,j,k; int vertexLen, edgeLen; int len_S,len_U; int min,weight,sum=0; char initial_node,final_node; char node,mid; char startVertex, endVertex;
printf("please input vertex's number:"); scanf("%d",&vertexLen); printf("please input edge's number:"); scanf("%d",&edgeLen); int graph[vertexLen][vertexLen]; char route[vertexLen]; char S[vertexLen],U[vertexLen]; int node_min[vertexLen]; for(i=0;i<vertexLen;i++) for(j=0;j<vertexLen;j++){ if(i==j) graph[i][j] = 0; else graph[i][j] = MAX_INT; } for(i=0; i<edgeLen; i++){ printf("please input the %d edge's start vertex name (vertex name from a to %c):",i+1,'a'+vertexLen-1); scanf(" %c",&startVertex); printf("please input the %d edge's end vertex name (vertex name from a to %c):",i+1,'a'+vertexLen-1); scanf(" %c",&endVertex); printf("please input this edge's weight:"); scanf("%d",&weight); graph[startVertex-'a'][endVertex-'a'] = weight; }