#include #include #define MAX_LEN 100#define INFINITE 1000typedef struct graph{
int nodenum;
int edgenum;
int matrix[MAX_LEN][MAX_LEN];}Graph;typedef struct stack{
intbottom;
inttop;
intprintout[MAX_LEN];}mstack;int in[MAX_LEN];int Len[MAX_LEN];int path[MAX_LEN];void InitStack(mstack *s){
s->bottom=0;
s->top=0;
memset(s->printout,0,sizeof(int)*MAX_LEN);}void push(mstack *s,int m){
s->printout[s->top++]=m;}int pop(mstack *s){ return s->printout[--s->top];}void InitGraph(Graph *g,int n){
int i,j;
for(i=1;imatrix[j]=0;
else g->matrix[j]=INFINITE;
}
for(i=1;i");
while(s.bottom!=s.top)
{
printf("%d-->",pop(&s));
}
printf("%dmin length is %d\n",i,Len);
}
}
return 0;} |