在这里插入代码片
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
typedef struct linkNode
{
int data;
struct linkNode* next;
}Node;
int vNum=0;
Node* nodes[30];
int status[30];
int queue[30];
int queLen = 0;
int front = 0;
int tail = 0;
void push(int element) {
queue[tail] = element;
tail++;
queLen++;
}
int pop() {
int res = queue[front];
front++;
queLen--;
return res;
}
void insert(int v1, int v2) {
if (nodes[v1]== NULL) {
nodes[v1]= (Node*)malloc(sizeof(Node));
nodes[v1]->data = v2;
nodes[v1]->next = NULL;
}
else {
Node* tmp = nodes[v1];
while (tmp->next != NULL) {
tmp = tmp->next;
}
tmp->next = (Node*)malloc(sizeof(Node));
tmp = tmp->next;
tmp->data = v2;
tmp->next = NULL;
}
}
void graphCreat() {
cout << "城市的数量:" << endl;
vNum=16;
cout<<vNum<<endl;
cout << "请输入高速路的数量:" << endl;
int m = 0;
cin >> m;
int x = 0;
int y = 0;
int i;
cout<<"请录入高速公路信息:"<<endl;
for (i = 1; i <=m; i++) {
cout << "Line "<<i<<": ";
cin >> x >> y;