文章出處

鄰接表 鄰接矩陣 結構體定義使用鄰接表時候的結構體定義


#include#includeusing namespace std;#define MaxSize 100typedef int VertexType;typedef int EdgeType;//邊表結點typedef struct ArcNode {    int adjvex; //鄰接點域,存儲該頂點對應的下標    int weight;  //權值    struct ArcNode *nextarc;    //鄰域,指向下一個鄰接點}ArcNode;//頂點表typedef struct VNode{    VertexType data;    ArcNode *firstarc; //邊表頭結點}VNode;//鄰接表定義typedef struct{    VNode adjlist[MaxSize];    int n, e;}AGraph

使用鄰接矩陣時候的定義


#include#include#includeusing namespace std;#define INFINITY 65535  // 表示無窮大#define maxSize 50#define OK 1typedef int VertexType;typedef int EdgeType;typedef struct{    VertexType vexs[maxSize];   //頂點坐標    EdgeType arc[maxSize][maxSize];   //鄰接矩陣定義,儲存權值    int n, e;}MGraph;

就愛閱讀www.92to.com網友整理上傳,為您提供最全的知識大全,期待您的分享,轉載請注明出處。
歡迎轉載:http://www.kanwencang.com/bangong/20161116/54012.html

文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()