|
|
@ -13,6 +13,36 @@
|
|
|
|
typedef struct {
|
|
|
|
typedef struct {
|
|
|
|
vexnode adjust[7];
|
|
|
|
vexnode adjust[7];
|
|
|
|
int e, n;
|
|
|
|
int e, n;
|
|
|
|
|
|
|
|
}list;
|
|
|
|
|
|
|
|
list nm;
|
|
|
|
|
|
|
|
void creatnode() {//对节点进行初始化
|
|
|
|
|
|
|
|
nm.e = 7;//边数
|
|
|
|
|
|
|
|
nm.n = 7;//站点数
|
|
|
|
|
|
|
|
strcpy(nm.adjust[0].name, "肇嘉浜路");
|
|
|
|
|
|
|
|
strcpy(nm.adjust[1].name, "东安路");
|
|
|
|
|
|
|
|
strcpy(nm.adjust[2].name, "上海体育场");
|
|
|
|
|
|
|
|
strcpy(nm.adjust[3].name, "嘉善路");
|
|
|
|
|
|
|
|
strcpy(nm.adjust[4].name, "大木桥路");
|
|
|
|
|
|
|
|
strcpy(nm.adjust[5].name, "徐家汇");
|
|
|
|
|
|
|
|
strcpy(nm.adjust[6].name, "上海体育馆");
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < nm.n; i++) {
|
|
|
|
|
|
|
|
nm.adjust[i].firstnode = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void createlist() {
|
|
|
|
|
|
|
|
edgenode *p;
|
|
|
|
|
|
|
|
//下面是肇嘉浜路的邻接表
|
|
|
|
|
|
|
|
//...
|
|
|
|
|
|
|
|
//下面是上海体育馆的邻接表
|
|
|
|
|
|
|
|
//...
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int cont[100][100];//邻接矩阵
|
|
|
|
|
|
|
|
void aaa(){
|
|
|
|
|
|
|
|
int i,j;
|
|
|
|
|
|
|
|
for(i=0;i<nm.n;i++){
|
|
|
|
|
|
|
|
for(j=0;j<nm.n;j++) cont[i][j]=MAX;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void createjz(){//创建邻接矩阵函数
|
|
|
|
void createjz(){//创建邻接矩阵函数
|
|
|
|
edgenode *p;
|
|
|
|
edgenode *p;
|
|
|
|