图的存储—矩阵,邻接表

矩阵:

typedef vertex
{
    int no;
    int info;
}vertextype;
typedef struct
{
    int edges[maxn][maxn];
    int n,e;
    vertextype vexs[maxn];
}matgraph;

邻接表:

typedef struct anode
{
    int adjvex;
    int weight;
    node *nextarc;
}arcnode;
typedef struct
{
    int info;
    arcnode *firstarc;
}vnode;
typedef struct
{
    int adjlist[maxn];
    int n,e;
}adjgraph;

猜你喜欢

转载自www.cnblogs.com/shenyuling/p/9991054.html
今日推荐