- 博客(6)
- 收藏
- 关注
原创 最短路径Dijkstra
void Dijkstra() { int map[19][19]={0}; cout<<endl; int path[19],dis[19],book[19]; map[1][3]=3; map[2][3]=5;map[2][5]=6; map[3][1]=3;map[3][2]=5;map[3][4]=2;map[3][6]=8;map[3][12]=10; map[4][3].
2021-11-22 21:46:33
213
原创 关键路径代码
#include<iostream> using namespace std; #include<queue> #include<vector> #include<stack> typedef int vertype ; #define max 100 int book[max]; int path[max][max]={0}; struct ArcNode { int adjvex;//记录一条边的右顶点的下标 int weight; ArcNod..
2021-11-22 14:48:27
643
原创 邻接表拓扑排序
#include<iostream> using namespace std; #include<queue> #include<stack> typedef int vertype ; #define max 100 int book[max]; struct ArcNode { int adjvex;//记录一条边的右顶点的下标 int weight; ArcNode *next;//下一条边 }; struct VNode { vertype data;.
2021-11-20 09:07:19
132
原创 图邻接表BFS
#include<iostream> using namespace std; #include<queue> typedef int vertype ; #define max 100 int book[max]; struct ArcNode { int adjvex;//记录一条边的右顶点的下标 int weight; ArcNode *next;//下一条边 }; struct VNode { vertype data;//顶点的类型 ArcNode *fir.
2021-11-20 08:42:56
110
原创 图邻接表存储+DFS
#include<iostream> using namespace std; typedef int vertype ; #define max 100 int book[max]; struct ArcNode { int adjvex;//记录一条边的右顶点的下标 int weight; ArcNode *next;//下一条边 }; struct VNode { vertype data;//顶点的类型 ArcNode *firstarc;//顶点的第一条边,是连接顶点数.
2021-11-18 21:37:01
337
原创 邻接表存图(头插和尾插,无向和有向图)
/*邻接表存储 1.首先,我们知道一个图它包含:顶点和边 那我们要存储一个图的话就要存储他的顶点和边。 2.首先是图的顶点:它是用一个数组来存储图的顶点 图的边呢:它是用一个单链表的形式来存储 那么是怎么样把这个数组和单链表连接为一个图的呢 3.这里我们需要三个结构体 第一个结构体:顶点集 第二个:边集 第三个:就是图 边集: 特别重要的第一个元素:顶点的下标(用来标识是那个顶点的边) 邻接的下一条边(用指针)(因为一个顶点可能链接不止一条边.
2021-11-18 20:15:46
353
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人