图的存储—矩阵,邻接表C++

矩阵:

struct vertextype
{
    int no;
    int info;
};
struct matgraph
{
    int edges[maxn][maxn];//weight
    int n,e;             //n is vertex's number    e is edges's number
    vertextype vexs[maxn];//information
};

邻接表:

struct arcnode
{
int adjvex;
int weight;
arcnode *nextarc;
};
struct vnode
{
int info;
arcnode *firstarc;
};
struct adjgraph
{
vnode adjlist[maxn];
int n;
}adjgraph;

原文地址:https://www.cnblogs.com/shenyuling/p/9991054.html