-
#ifndef DMAP_H #define DMAP_H #include <vector> #include "Node.h" using namespace std; class DMap { public: DMap(int capacity); ~DMap(void); bool AddNode(Node* pNode);//向圖中增加結點(頂點) void ResetNode(); //重置頂點 bool SetValuetoMatricForDGraph(int row,int col,int val=1);//有向圖設置 bool SetValuetoMatricForUGraph(int row,int col,int val=1);//無向圖設置 void printMatrix();//打印鄰接矩陣 void depthFirstTravers(int nodeindex);//深度優先遍歷 void breadFirstTravers(int nodeindex);//廣度優先遍歷 private: bool getValueFromMatrix(int row,int col, int &val);//從矩陣獲取權值 void breadFirstrTraversImpl(vector <int> prevect);//廣度優先遍歷實現 private: int m_iCapacity; //圖中頂點數容量 int m_iNodeCount; //已添加頂點個數 Node* m_pNodeArray; //存放頂點數組 int* m_pMatrix; //存放鄰接矩陣 }; #endif查看全部
-
完全圖邊數=n(n-1)/2 生成樹邊數=n-1查看全部
-
鄰接多重表查看全部
-
十字鏈表查看全部
-
Node Map查看全部
-
頂點和弧的表示查看全部
-
廣度優先搜索:丟棄了兩條邊查看全部
-
深度優先遍歷:成環時終止搜索,換路查看全部
-
無向圖存儲查看全部
-
十字鏈表存儲查看全部
-
鏈式存儲(三)查看全部
-
鏈式存儲(二)查看全部
-
鏈式存儲(一)查看全部
-
圖的存儲結構:鄰接矩陣,鄰接表,十字鏈表,鄰接多重表查看全部
-
menset函數的功能就是進行內存的設定,不僅要計算數量的大小,還要計算每一個所占的內存的大小 memset(m_pMatrix, 0 , m_iCapacity * m_iCapacity * sizeof(int))查看全部
舉報
0/150
提交
取消