single-source shortest path in directed graph

翻译 2018年04月16日 16:04:24

two common operations vertex initialisation and relax

vertex initialisation -> set key of each vertex to max value; set precedence to null; set key of s (start vertex) to 0;

relax(u,v,w) -> set key of vertex v to lower value u.key + w(u,v) if any. If yes, set v.precedence to u

- Bellman-Ford, O(VE)

  • take n-1 rounds of relaxes of each edge.
  • can be used to detect negative weight loop which doesn't has shorted path

- topological sort for PERT (Program Execute and Review Technique),  O(V + E)

  • sort vertices in topological order
  • for each vertex, relax on its all adjacent vertices.
  • find key path of PERT

- Dijkstra, O((V + E)lgv), only for non-negative weight graph

  • sort vertex in non-decreasing order on key of vertex (put vertices in priority queue)
  • take vertex from the queue and relax on its all adjacent vertices. order is updated in the queue.

- shortest path on directed graph for System of Difference Constraints

  • constraints, xj-xi <= w. (i,j belong to V), the number of constraints should exceed |V|
  • n = |V|, is number of vertices for xi.
  • w is weight of edge (vi, vj)
  • add one more node v0 and edges (v0, vi) with weight of 0
  • shortest path (v0, v1), (v0, v2)... is solution of xi.



Graph: Single Source Shortest Path(TODO)

Single Source Shortest Path(SSSP) 问题定义:最短路径问题有很多种类,一般最开始都是从SSSP问题开始研究,它最基本最简单,而且很多问题可以化归为SSSP,这个问题的...
  • whb923
  • whb923
  • 2015-01-08 13:18:48
  • 633

zoj 2760 How Many Shortest Path 【最短路 + 最大流】 【求边不重复最短路径条数】

How Many Shortest Path Time Limit: 10 Seconds      Memory Limit: 32768 KB Given a weighted direc...
  • chenzhenyu123456
  • chenzhenyu123456
  • 2015-07-31 11:59:50
  • 634

DIJKSTRA’S ALGORITHM

  • 2014年04月20日 22:17
  • 1.13MB
  • 下载

单源最短路径(Single Source Shortest Path)--《算法导论》

关于最短路径的描述请参考维基百科Shortest Path简单总结一下算法导论上描述的计算从单一节点源到图中每一节点的最短路径算法,Bellman-Ford算法及其优化版本spfa,以及对权重非负的图...
  • Dylan_Frank
  • Dylan_Frank
  • 2016-08-28 21:12:44
  • 726

2016/11/24 1002.shortest path in unweighted graph

本质上是需要做一个分层的广度优先搜索,只需要对每一个从队列中取出来的节点进行广度优先前用一个数记录接下来的多少个节点是属于同一层的,给相应的变量赋值即可。 #include #include u...
  • Azure10dai
  • Azure10dai
  • 2016-12-01 16:15:25
  • 349

Sicily Shortest path in unweighted graph

Source:http://soj.sysu.edu.cn/show_problem.php?pid=1003&cid=2104Description输入一个无向图,指定一个顶点s开始bfs遍历,求出...
  • sinat_21644713
  • sinat_21644713
  • 2015-12-19 07:58:40
  • 511

hdu 4725 The Shortest Path in Nya Graph(最短路)

The Shortest Path in Nya Graph Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 ...
  • acm_BaiHuzi
  • acm_BaiHuzi
  • 2015-07-27 23:48:21
  • 950

HDU-4725-The Shortest Path in Nya Graph

参考了下别人的建图方式,自己的建图怎么都不对,还是不太懂为什么非要3层,2层却错 还要注意的就是要用优先队列优化 代码: #include #include #include #incl...
  • z309241990
  • z309241990
  • 2013-09-12 20:33:33
  • 990

Shortest path in multistage graphs 图的最短路径问题

Shortest path in multistage graphs.Find the shortest path from 0 to 15 for the following graph. A ...
  • chenguibao
  • chenguibao
  • 2015-07-01 14:41:37
  • 1125

CUGB图论专场:K - The Shortest Path in Nya Graph(dijkstra优先队列优化+线性构图入边)

K - The Shortest Path in Nya Graph Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%...
  • u011466175
  • u011466175
  • 2014-02-04 19:16:25
  • 1106
收藏助手
不良信息举报
您举报文章:single-source shortest path in directed graph
举报原因:
原因补充:

(最多只允许输入30个字)