有向图的深度优先遍历的n-s图

来源:百度知道 编辑:UC知道 时间:2024/09/24 13:48:07
有向图的深度优先遍历的n-s图..........

我也学数据结构,这也是我的作业,我是做关键路径,但是要先实现拓扑排序,这个是我编的程序。里面的因为暂时不用关键路径权值随便输(或者把权值那段代码注释调)
直接可以运行。今天才变通。

需要的文件,topo.c,stack.c,stack.h,graph.c,graph.h
****************************************************
stack.h:
#define STACK_INIT_SIZE 100

#define STACKINCREMENT 10
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define NULL 0

typedef int TET;
/*
typedef struct BiTNode
{
TET data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
*/
typedef int SET;

typedef int Status;
typedef struct
{
SET *base;
SET *top;
int stacksize;
}SqStack;

Status InitStack(SqStack *S);
Status DestroyStack(SqStack *S);
Status ClearStack(SqStack *S);
Status StackEmpty(SqStack S);
Status StackLength(SqStack S);
Status GetTop(SqStack S,S