嘻嘻,好高兴,自己一个人咬着牙挺到了现在,我已走了这么远的路
#include "stdio.h"
#include "stdlib.h"
#include "stdbool.h"
#define MVN 20
#define Maxint 32767
#define MAXSIZE 20
typedef int QElemTypes;
typedef char VerTexType;
typedef int ArcType;
typedef struct
{
QElemTypes* base;
int front;
int rear;
int length;
}SqQueue,SQueue;
typedef struct
{
VerTexType Vexs[MVN];
ArcType Arcs[MVN][MVN];
int Vexnum,Arcnum;
_Bool visited[MVN];
}AMGraph;
int get_first(AMGraph* G, VerTexType* v);
int GetVertex(AMGraph* G);
int LocateVex(AMGraph* G,VerTexType v);
int Create_visited(AMGraph* G);
int FirstAdjVex(AMGraph* G, int u);
int NextAdjVex(AMGraph* G, int u, int w);
int InitQueue(SqQueue* Q);
int InitQueue(SqQueue* Q)
{
Q->base = (QElemTypes*)malloc(sizeof(QElemTypes)*MAXSIZE);
if(!Q->base) return 0;
Q->front = Q->rear = 0;
return 1;
}
int EnQueue(SqQueue* Q, QElemTypes e)
{
if(!Q->base || (Q->rear + 1)%MAXSIZE ==Q->front)
return 0;
Q->base[Q->rear] = e;
Q->rear = (Q->rear + 1)%MAXSIZE;
Q->length