
图论
文章平均质量分 90
横济沧海
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Floyd最短路
用邻接矩阵实现floyd找最短路算法 测试所用图如下: #include #include #include #include #include #include #include #define inf 65535 using namespace std; struct Graph//用邻接矩阵来保存图 { int arc[100][100]; int vertex[100]; in原创 2017-08-14 14:52:38 · 231 阅读 · 0 评论 -
图论 邻接表建图+dfs
上一篇用的是邻接矩阵建图:点击打开链接 所以dfs(&G,0)结果为0 2 3 4 1 dfs(&G,1)结果为1 2 3 4 dfs(&G,2)结果为2 3 4 dfs(&G,3)结果为 3 4 dfs(&G,4)结果为4 #include #include #include #include using namespace std;原创 2017-07-28 21:49:22 · 495 阅读 · 0 评论 -
图论 用广搜搜邻接矩阵
用广搜搜邻接矩阵 只是从某一点开始搜,如果是遍历全图的话就每个顶点挨个搜一遍 #include #include #include #include #include #include #define inf 65535 using namespace std; typedef struct mygraph { int ver[1000]; int arc[100][100];原创 2017-07-28 23:55:04 · 237 阅读 · 0 评论 -
图论 关键路径
#include #include #include #include #include #include using namespace std; typedef struct NODE{ int adjvex; int weight ; NODE *next; }Node; typedef struct { int im; int data; NODE *first; }nodeList;原创 2017-08-17 11:13:55 · 1000 阅读 · 0 评论 -
图论 用prim法求最小生成树
我用的是邻接矩阵保存的图 测试数据二所用的图如下: 具体说明都在下面这段代码里(如果不嫌弃可以仔细阅读) #include #include #include #include #define inf 65535 #include typedef struct Graph { int vertex[100]; int arc[100][100];原创 2017-07-29 16:46:24 · 370 阅读 · 0 评论 -
图论 邻接表广搜
上一篇是邻接表dfs:点击打开链接 所以bfs(&G,0)结果为0 2 1 3 4 bfs(&G,1)结果为1 2 3 4 bfs(&G,2)结果为2 3 4 bfs(&G,3)结果为 3 4 bfs(&G,4)结果为4 #include #include #include #include #include using namespace std;原创 2017-07-29 00:12:37 · 316 阅读 · 0 评论 -
图论 迪杰斯特拉dijkstra求最短路径
这个测试用的是下面这个图: 9 16 0 1 2 3 4 5 6 7 8 0 1 1 0 2 5 1 2 3 1 4 5 1 3 7 2 4 1 2 5 7 3 4 2 3 6 3 4 6 9 4 5 3 4 7 9 5 7 5 6 7 2 6 8 7 7 8 4 运行结果如下: #include #inc原创 2017-07-30 20:36:22 · 720 阅读 · 0 评论