グラフアルゴリズムの問題 - CSの大学院コースノースイースタン大学の研究ノート

データ構造、最も頻繁にテスト構造の隣接リスト、隣接行列、直交リストは、隣接するマルチテーブル試験はまれに、記事の最後に定義され

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;

隣接行列

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

クロスリスト、有向グラフ

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;

隣接するマルチテーブル、無向グラフ

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;

おすすめ

転載: www.cnblogs.com/vergilwu/p/11669526.html