![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法-图论
he1533
这个作者很懒,什么都没留下…
展开
-
最小树形图--朱刘算法
描述:最小树形图—-一个有向图的有根生成树中权最小的图。 原理:朱刘算法及相关定理。 代码 :#include<bits\stdc++.h> using namespace std; typedef int CostType;struct Edge{ int u; int v; CostType cost; Edge(){}; Edge(int x,in原创 2017-03-29 15:04:38 · 394 阅读 · 0 评论 -
最小生成树kruskal算法
描述:无。 原理:最小生成树的相关定理。代码:#include<bits\stdc++.h>using namespace std;typedef int CostType;class Edge{public: int u; int v; CostType cost; Edge(){} Edge(int x,int y,CostType c):u(x),原创 2017-03-29 20:29:19 · 217 阅读 · 0 评论 -
dijkstra求最小生成树
代码:#include<bits\stdc++.h>using namespace std;#define LEN 1002#define MAX INT_MAXint edge[LEN][LEN];int dijkstra(int n){ /*求最小生成树,edge是一个n*n数组, edge[i][j]表示i,j间的权值。为MAX表示无边。 */ in原创 2017-03-29 22:42:46 · 2423 阅读 · 0 评论 -
flod求最小通路算法
代码:#include<bits/stdc++.h>using namespace std;#define MAX INT_MAXtypedef int CostType;struct Edge{ int v; int u; CostType cost; Edge(){} Edge(int x,int y,int c):v(x),u(y),cost(c){}原创 2017-03-29 22:43:45 · 694 阅读 · 0 评论 -
floyd最短路径算法
代码:#include<bits/stdc++.h>using namespace std;#define LEN 1001#define MAX INT_MAXint node[LEN][LEN];void floyd(int n){ /* 求一个图中任意一个点到另一个点的最短路径。 允许存在负权值,但不能存在负回路。 */ for(int k=0;k<n原创 2017-03-29 22:44:38 · 209 阅读 · 0 评论 -
dijkstra最短路径算法
代码:#include<bits/stdc++.h>using namespace std;#define LEN 100005#define MAX INT_MAXint n;int node[LEN];int next[LEN];int cost[LEN];int dijkstra(int start,int end){ /*求一个图中从start到end的最短路径。原创 2017-03-29 22:45:30 · 257 阅读 · 0 评论