问题描述
【问题描述】
求有向图的单源最短路径。
ABCDEF#
0,4,30
0,2,10
0,5,100
1,2,5
2,3,50
3,5,10
4,3,20
4,5,60
-1,-1,-1
0
【样例输出】A->A:no
A->B:no
A->C:10(A--C)
A->D:50(A--E--D)
A->E:30(A--E)
A->F:60(A--E--D--F)
程序设计
#include <stdio.h>
#include <stdlib.h>
#define N 50
#define MAX 100
#define INF 32766
#define INFIN 32767
#define ERROR 0
#define OK 1
#define STACK_INT_STZE 10
#define STACKINCREMENT 5typedef struct{
int vexnum,arcnum;
char vexs[N];
int arcs[N][N];
}MGraph;typedef struct SqQueue
{
char data[MAX];
int rear,front;
}SqQueue;typedef int ElemType;
typedef str