.
实验名称:数据结构实验五
实验内容:1.使用邻接矩阵建立一个图,深度遍历。2.使用
邻接表建立一个图,广度遍历。3.建立一个图,存储结构自
己确定,并进行拓扑排序。
实验代码:
1.#include "stdio.h"
#define Infinity 100
#define MaxVertexNum 20
typedef enum {DG,DN,UDG,UDN} GraphKind;
typedef int VRType;
typedef char VertexType;
bool Visit[MaxVertexNum];
typedef struct ArcCell
{
VRType adj;
}ArcCell,AdjMatrix[MaxVertexNum][MaxVertexNum];
typedef struct
{
VertexType vexs[MaxVertexNum];
AdjMatrix arcs; //邻接矩阵
int vexnum,arcnum; //图的当前顶
Word 资料
评论0
最新资源