![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图的遍历
孟德轩
这个作者很懒,什么都没留下…
展开
-
数据结构——图的深度优先遍历(邻接矩阵法)
#include<stdio.h> #include<stdlib.h> #define MaxVerexNum 100 typedef struct { int Vex[MaxVerexNum];//顶点的数目 int Edge[MaxVerexNum][MaxVerexNum];//邻接矩阵 int vexnum,arcnum;//图当前的顶点数和弧数 }MGraph;//图的邻接矩阵定义 int visited[5];//访问标记数组 void DFS(MGraph.原创 2021-08-09 16:48:00 · 428 阅读 · 0 评论 -
数据结构——图的广度优先遍历(邻接矩阵法)
#include<stdio.h> #include<stdlib.h> #include<queue> #define INFINITY 65535 typedef int Status; using namespace std; #define MaxVerexNum 100 queue<int>q; typedef struct { int Vex[MaxVerexNum];//顶点的数目 int Edge[MaxVerexNum][MaxVer.原创 2021-08-09 16:46:30 · 802 阅读 · 0 评论