Graph algorithm problem - cs postgraduate courses Northeastern University study notes

Adjacency list of data structures, most often test structure; adjacency matrix, orthogonal list, the adjacent multi-table test infrequently, defined on the end of the article

typedef struct ArcNode {
    int adjvex;
    struct ArcNode* next;
}ArcNode;

typedef struct {
    VertexType data;
    ArcNode* first;
}VexNode;

typedef struct {
    VexNode vexlist[MaxVexNum];
    int vexnum, arcnum;
}ALGraph;

Adjacency matrix

typedef struct {
    VertexType vexlist[MaxVexNum];
    ArcType arcTable[MaxVexNum][MaxVexNum];
    int vexnum, arcnum;
}MGraph;

Cross list, digraph

typedef struct ArcNode {
    int tailvex, headvex;
    struct ArcNode* tlink, * hlink;
}ArcNode;

typedef struct {
    VertexType data;
    ArcNode* firstin, * firstout;
}VexNode;

typedef struct {
    VexNode vexlist[MaxVexNum];
    int vexnum, arcnum;
}GLGraph;

The adjacent multi-table, undirected graph

typedef struct ArcNode {
    //int marked; 访问标记
    int ivex, jvex;
    struct ArcNode* ilink, * jlink;
}ArcNode;

typedef struct {
    VertexType data;
    ArcNode* first;
}VexNode;

typedef struct {
    VexNode vexlist[MaxVexNum];
    int vexnum, arcnum;
}AMLGraph;

Guess you like

Origin www.cnblogs.com/vergilwu/p/11669526.html