#include "stdafx.h"
#include"malloc.h"
#define MAX_VERTEX_NUM 20
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
#define OVERFLOW -2
#define OK 1
#define ERROR -1
#define FALSE 0
typedef int VertexType ;
typedef int InfoType;
typedef int Status;
typedef int SElemType;
typedef int Status;
int indegree[20];
typedef struct{
SElemType *base;
SElemType *top;
int stacksize;
}SqStack;
typedef struct ArcNode{
int adjvex;
struct ArcNode *nextarc;
InfoType *info;
}ArcNode;
typedef struct VNode{
VertexType data;
ArcNode *finrstarc;
}VNode,AdjList[MAX_VERTEX_NUM];
typedef struct{
AdjList vertices;
int vexnum,arcnum;
int kind;
}ALGraph;
ALGraph G;
Status LocateVex(int v){
for(int i=0;i<G.vexnum;i++)
{
if(G.vertices[i].data==v)
return i;
}
return ERROR;
}
Status InitStack(SqStack &S){
S.base=(SElemTy
#include"malloc.h"
#define MAX_VERTEX_NUM 20
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
#define OVERFLOW -2
#define OK 1
#define ERROR -1
#define FALSE 0
typedef int VertexType ;
typedef int InfoType;
typedef int Status;
typedef int SElemType;
typedef int Status;
int indegree[20];
typedef struct{
SElemType *base;
SElemType *top;
int stacksize;
}SqStack;
typedef struct ArcNode{
int adjvex;
struct ArcNode *nextarc;
InfoType *info;
}ArcNode;
typedef struct VNode{
VertexType data;
ArcNode *finrstarc;
}VNode,AdjList[MAX_VERTEX_NUM];
typedef struct{
AdjList vertices;
int vexnum,arcnum;
int kind;
}ALGraph;
ALGraph G;
Status LocateVex(int v){
for(int i=0;i<G.vexnum;i++)
{
if(G.vertices[i].data==v)
return i;
}
return ERROR;
}
Status InitStack(SqStack &S){
S.base=(SElemTy