algraph.h

来自「GraphPath 采用邻接矩阵存储图」· C头文件 代码 · 共 56 行

H
56
字号
//ALGraph.h
//uuhorse
//2008.05.31
#ifndef  _MG_ALGRAPH_ADJLIST_
#define  _MG_ALGRAPH_ADJLIST_

////////////////////////////////////////////////////////////////////



#define MAX_VERTEX_NUM 20

typedef int InfoType;
typedef char VertexType;

typedef struct ArcNode		//表节点
{
	int		adjvex;					//该弧所指向的顶点位置
	struct	ArcNode *nextarc;		//指向下一条弧的指针
	InfoType *info;					//该弧相关信息的指针
}ArcNode;


typedef struct VNode		//头节点
{
	VertexType data;		//顶点信息
	ArcNode *firstarc;		//指向第一条依附该顶点的弧的指针
}VNode, AdjList[MAX_VERTEX_NUM];


typedef struct 
{
	//AdjList vertices;		//
	VNode  *vertices;		//顶点指针
	int vexnum, arcnum;		//图当前的顶点树与弧数
	int kind;				//图的类型标记
}ALGraph;



int CreatGraph (ALGraph &G);//采用 邻接表 表示法,构造图G
int CreatG(ALGraph &G); //构造图G
int CreatN(ALGraph &G); //构造网G
int SearchPath(ALGraph &G, VertexType i ,VertexType s); 
//在图G中求一条从顶点i到顶点s 的简单路径。


int LocateVex (ALGraph G, VertexType v);	//返回v在G中的位置





//////////////////////////////////////////////////////////////////////

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?