資源簡(jiǎn)介
有圖的遍歷,排序,最短路徑的代碼,創(chuàng)建圖的鄰接矩陣,圖的鄰接矩陣轉(zhuǎn)換為鄰接表
代碼片段和文件信息
#include?
#include?
#include?
#define?MaxStr?20
typedef?int?Status;
typedef?int?ElemType;
typedef?struct{????
????ElemType?VNode;
????int?indgree;
????}VexType;
typedef?struct?Arc{
????VexType?Adj;
????unsigned?int?Weight;
????struct?Arc?*NextArc;
????}ArcType;
typedef?struct{????????????????????????????????????
????VexType?*Vex;
????ArcType?**FirstArc;??????????????????//鄰接表;
//????ArcType?**InvertArc;???????????????//逆鄰接表;
????int?VexNums;?????????????????????????//頂點(diǎn)總數(shù);
????}DLGraph;????????????????????????????//圖的鄰接表結(jié)構(gòu)定義;
typedef?struct{
????ElemType?*Vex;
????unsigned?int?**Arc;????????????????????????????????
????int?VexNums;
????}DMGraph;????????????????????????????//圖的鄰接矩陣結(jié)構(gòu)定義;
//================================================
評(píng)論
共有 條評(píng)論