好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

C++图的数组表示法和深度优先遍历.txt

2页
  • 卖家[上传人]:野鹰
  • 文档编号:1088292
  • 上传时间:2017-05-27
  • 文档格式:TXT
  • 文档大小:1.79KB
  • / 2 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • define OK 1#define ERROR -1#define OVERFLOW 0#define INFINITY 10000#define MAX_VERTEX_NUM 100typedef int Status;typedef char VRType;typedef enum{DG,DN,UDG,UDN} GraphKind;#include #include using namespace std;typedef struct{int arcs[MAX_VERTEX_NUM][MAX_VERTEX_NUM];int vexnum,arcnum;GraphKind kind;VRType verx[MAX_VERTEX_NUM];}MGraph;int visited[MAX_VERTEX_NUM]={0};Status findlocate(MGraph G,VRType ch){int i=0;for(i=0;i>G.vexnum>>G.arcnum;if(G.vexnum!=0)cout>G.verx[i];}for(i=0;i>ch1>>ch2>>weight;location1=findlocate(G,ch1);location2=findlocate(G,ch2);G.arcs[location1][location2]=weight;G.arcs[location2][location1]=weight;}return OK;}void DFS(MGraph &G,int v){int i;cout<

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.