#include
using namespace std;
//邻接矩阵
#define MAXV
typedef int VertexType;
typedef struct VertexType; //头顶点
{
int no;
InfoType info;
};
typedef struct MGraph //邻接矩阵类型 适合存储图的稀疏矩阵
{
int edges[MAXV][MAXV];
int n,e;
VertexType vexs[MAXV];
}
//邻接表
typedef struct ANode
{
int adjvex; //终点编号
struct ANode *nextarc;
InfoType info; //权值
}ArcNode;
typedef struct Vnode
{
Vertex data; //顶点信息
ArcNode *firstarc; //指向第一条边
}VNode;
typedef struct
{
VNode adjlist[MAXV]; //邻接表
int n,e; //图中顶点数n和边数e
}ALGraph;
表的创建 邻接矩阵邻接表
最新推荐文章于 2023-08-27 23:38:05 发布