|
|
Line 1: |
Line 1: |
| {{multiple issues|
| |
| {{More footnotes|date=June 2009}}
| |
| {{external links|date=April 2012|reason=urls, not even clickable, sprinkled throughout the text-->verify and refify}}
| |
| {{expert-subject|graph theory|date=April 2012|reason=large chunk of scaffolding needs filling in}}
| |
| }}
| |
|
| |
|
| [[Image:6n-graf.svg|thumb|(6, 4, 5, 1) and (6, 4, 3, 2, 1) are both paths between vertices 6 and 1.]]
| |
| [[Image:Shortest path with direct weights.svg|thumb|250px|Shortest path (A, C, E, D, F) between vertices A and F in the weighted directed graph.]]
| |
| In [[graph theory]], the '''shortest path problem''' is the problem of finding a [[path (graph theory)|path]] between two [[vertex (graph theory)|vertices]] (or nodes) in a [[graph (mathematics)|graph]] such that the sum of the [[Glossary of graph theory#Weighted graphs and networks|weights]] of its constituent edges is minimized.
| |
|
| |
|
| This is analogous to the problem of finding the shortest path between two intersections on a road map: the graph's vertices correspond to intersections and the edges correspond to road segments, each weighted by the length of its road segment.
| | Additionally, [http://www.Helplivemusic.org/index.php?title=Gay_Men_Know_The_Secret_Of_Great_Sex_With_Honeywell_Video_Systems_Rapid_Eye Direc -] TV DVR by Tivo allows the consumer to pause a live feed, something considered impossible in the past. So the RG59 will connect to best cctv dvr card the DVR and also the stability digicam by way of on board BNC connections. Cctv dvr lock box You are capable to control cameras remotely along with the DVR can [http://Wakei.bigwave.mobi/mediawiki/index.php?title=Erotic_Cctv_Dvr_16_Channel_Uses detect motion] to change cameras on / off, thus saving disk space and power.<br><br>Generally camera could possibly be easily seen by anyone however the latest types of are covert CCTV which means that they may be hidden. There are so many different brand, quality Car dvr in the market, as a customer may not easy to find a best one among so many different dash camera.<br><br>Sales of e - Books have rocketed in the last few video surveillance software mac years and so are set to continue to explode even further and faster inside the coming years. Create a directory of 100 products inside best home security dvr a Notepad or even an Excel sheet. [http://www.meccahosting.co.uk/goodbye.php?url=http://cctvdvrreviews.com cctv dvr software linux] xenta wired camera and dvr cctv Write down what at happened with your games session at school today. Let me explain why writing samsung security monitor articles is so important on the success of the online and also line business advertising efforts. |
| | |
| ==Definition==
| |
| The shortest path problem can be defined for [[Graph (mathematics)|graphs]] whether [[Graph_(mathematics)#Undirected_graph|undirected]], [[Graph_(mathematics)#Directed_graph|directed]], or [[Graph_(mathematics)#Mixed_graph|mixed]].
| |
| It is defined here for undirected graphs; for directed graphs the definition of path
| |
| requires that consecutive vertices be connected by an appropriate directed edge.
| |
| | |
| Two vertices are adjacent when they are both incident to a common edge.
| |
| A [[Path (graph theory)|path]] in an undirected graph is a [[sequence]] of vertices <math>P = ( v_1, v_2, \ldots, v_n ) \in V \times V \times \ldots \times V</math>
| |
| such that <math>v_i</math> is adjacent to <math>v_{i+1}</math> for <math>1 \leq i < n</math>.
| |
| Such a path <math>P</math> is called a path of length <math>n</math>
| |
| from <math>v_1</math> to <math>v_n</math>.
| |
| (The <math>v_i</math> are variables; their numbering here relates to their position in the sequence and needs not to relate to any canonical labeling of the vertices.)
| |
| | |
| Let <math>e_{i, j}</math> be the edge incident to both <math>v_i</math> and <math>v_j</math>.
| |
| Given a [[Function (mathematics)#Real-valued functions|real-valued]] weight function <math>f: E \rightarrow \mathbb{R}</math>,
| |
| and an undirected (simple) graph <math>G</math>, the shortest path from <math>v</math> to <math>v'</math>
| |
| is the path <math>P = ( v_1, v_2, \ldots, v_n )</math> (where <math>v_1 = v</math> and <math>v_n = v'</math>)
| |
| that over all possible <math>n</math> minimizes the sum <math>\sum_{i =1}^{n-1} f(e_{i, i+1}).</math>
| |
| When each edge in the graph has unit weight or <math>f: E \rightarrow \{1\}</math>, this is equivalent to finding the path with fewest edges.
| |
| | |
| The problem is also sometimes called the '''single-pair shortest path problem''', to distinguish it from the following variations:
| |
| * The '''single-source shortest path problem''', in which we have to find shortest paths from a source vertex ''v'' to all other vertices in the graph.
| |
| * The '''single-destination shortest path problem''', in which we have to find shortest paths from all vertices in the directed graph to a single destination vertex ''v''. This can be reduced to the single-source shortest path problem by reversing the arcs in the directed graph.
| |
| * The '''all-pairs shortest path problem''', in which we have to find shortest paths between every pair of vertices ''v'', ''v' '' in the graph.
| |
| | |
| These generalizations have significantly more efficient algorithms than the simplistic approach of running a single-pair shortest path algorithm on all relevant pairs of vertices.
| |
| | |
| ==Algorithms==
| |
| The most important algorithms for solving this problem are:
| |
| * [[Dijkstra's algorithm]] solves the single-source shortest path problems.
| |
| * [[Bellman–Ford algorithm]] solves the single-source problem if edge weights may be negative.
| |
| * [[A* search algorithm]] solves for single pair shortest path using heuristics to try to speed up the search.
| |
| * [[Floyd–Warshall algorithm]] solves all pairs shortest paths.
| |
| * [[Johnson's algorithm]] solves all pairs shortest paths, and may be faster than Floyd–Warshall on [[sparse graph]]s.
| |
| * [[Viterbi algorithm]] solves the shortest stochastic path problem with an additional probabilistic weight on each node.
| |
| | |
| Additional algorithms and associated evaluations may be found in Cherkassky et al.<ref>{{Cite journal
| |
| | last1 = Cherkassky | first1 = Boris V.
| |
| | last2 = Goldberg | first2 = Andrew V. | author2-link = Andrew V. Goldberg
| |
| | last3 = Radzik | first3 = Tomasz
| |
| | doi = 10.1016/0025-5610(95)00021-6 | |
| | issue = 2
| |
| | journal = Mathematical Programming | series = Ser. A
| |
| | mr = 1392160
| |
| | pages = 129–174
| |
| | title = Shortest paths algorithms: theory and experimental evaluation
| |
| | url = http://ftp.cs.stanford.edu/cs/theory/pub/goldberg/sp-alg.ps.Z
| |
| | volume = 73
| |
| | year = 1996
| |
| | ref = harv
| |
| | postscript = <!-- Bot inserted parameter. Either remove it; or change its value to "." for the cite to end in a "." -->{{inconsistent citations}}}}.</ref>
| |
| | |
| ==Road networks==
| |
| A road network can be considered as a graph with positive weights. The nodes represent road junctions and each edge of the graph is associated with a road segment between two junctions. The weight of an edge may correspond to the length of the associated road segment, the time needed to traverse the segment or the cost of traversing the segment. Using directed edges it is also possible to model one-way streets. Such graphs are special in the sense that some edges are more important than others for long distance travel (e.g. highways). This property has been formalized using the notion of highway dimension.<ref>Abraham, Ittai; Fiat, Amos; [[Andrew V. Goldberg|Goldberg, Andrew V.]]; Werneck, Renato F. [http://research.microsoft.com/pubs/115272/soda10.pdf%20research.microsoft.com/pubs/115272/soda10.pdf "Highway Dimension, Shortest Paths, and Provably Efficient Algorithms"]. ACM-SIAM Symposium on Discrete Algorithms, pages 782-793, 2010.</ref> There are a great number of algorithms that exploit this property and are therefore able to compute the shortest path a lot quicker than would be possible on general graphs.
| |
| | |
| All of these algorithms work in two phases. In the first phase, the graph is preprocessed without knowing the source or target node. This phase may take several days for realistic data and some techniques. The second phase is the query phase. In this phase, source and target node are known. The running time of the second phase is generally less than a second. The idea is that the road network is static, so the preprocessing phase can be done once and used for a large number of queries on the same road network.
| |
| | |
| The algorithm with the fastest known query time is called hub labeling and is able to compute shortest path on the road networks of Europe or the USA in a fraction of a microsecond.<ref>Abraham, Ittai; Delling, Daniel; [[Andrew V. Goldberg|Goldberg, Andrew V.]]; Werneck, Renato F. [http://research.microsoft.com/pubs/142356/HL-TR.pdf research.microsoft.com/pubs/142356/HL-TR.pdf "A Hub-Based Labeling Algorithm for Shortest Paths on Road Networks"]. Symposium on Experimental Algorithms, pages 230-241, 2011.</ref> Other techniques that have been used are:
| |
| | |
| * ALT
| |
| * Arc Flags
| |
| * [[Contraction hierarchies]]
| |
| * Transit Node Routing
| |
| * Reach based Pruning
| |
| * Labeling
| |
| | |
| ==Single-source shortest paths==
| |
| | |
| ===Directed unweighted graphs===
| |
| {| class=wikitable
| |
| ! Algorithm !! Time complexity !! Author
| |
| |-
| |
| | [[Breadth-first search]] || ''O''(''E'') ||
| |
| |}
| |
| {{expand list|date=December 2012}}
| |
| | |
| ===Directed acyclic graphs===
| |
| | |
| ===Directed graphs with nonnegative weights===
| |
| <!-- From Schrijver, Combinatorial Optimization, Volume A, p. 103 -->
| |
| {| class=wikitable
| |
| ! Algorithm !! Time complexity !! Author
| |
| |-
| |
| | || ''O''(''V''<sup>2</sup>''EL'') || {{harvnb|Ford|1956}}
| |
| |-
| |
| | [[Bellman–Ford algorithm]] || ''O''(''VE'') || {{harvnb|Bellman|1958}}, {{harvnb|Moore|1959}}
| |
| |-
| |
| | || ''O''(''V''<sup>2</sup> log ''V'') || {{harvnb|Dantzig|1958}}, {{harvnb|Dantzig|1960}}, Minty (cf. {{harvnb|Pollack|Wiebenson|1960}}), {{harvnb|Whiting|Hillier|1960}}
| |
| |-
| |
| | [[Dijkstra's algorithm]] with list || ''O''(''V''<sup>2</sup>) || {{harvnb|Leyzorek|Gray|Johnson|Ladew|1957}}, {{harvnb|Dijkstra|1959}}
| |
| |-
| |
| | [[Dijkstra's algorithm]] with modified binary heap || ''O''((''E'' + ''V'') log ''V'') ||
| |
| |-
| |
| | . . . || . . . || . . .
| |
| |- style="background: #90ff90"
| |
| | Dijkstra's algorithm with Fibonacci heap || ''O''(''E'' + ''V'' log ''V'') || {{harvnb|Fredman|Tarjan|1984}}, {{harvnb|Fredman|Tarjan|1987}}
| |
| |- style="background: #90ff90"
| |
| | || ''O''(''E'' log log ''L'') || {{harvnb|Johnson|1982}}, {{harvnb|Karlsson|Poblete|1983}}
| |
| |-
| |
| | [[Gabow's algorithm (single-source shortest paths)|Gabow's algorithm]] || ''O''(''E'' log<sub>''E''/''V''</sub> ''L'') || {{harvnb|Gabow|1983b}}, {{harvnb|Gabow|1985b}}
| |
| |- style="background: #90ff90"
| |
| | || ''O''(''E'' + ''V''√log ''L'') || {{harvnb|Ahuja|Mehlhorn|Orlin|Tarjan|1990}}
| |
| |}
| |
| {{expand list|date=February 2011}}
| |
| | |
| ===Planar directed graphs with nonnegative weights===
| |
| | |
| ===Directed graphs with arbitrary weights===
| |
| {| class=wikitable
| |
| ! Algorithm !! Time complexity !! Author
| |
| |-
| |
| | [[Bellman–Ford algorithm]] || ''O''(''VE'') || {{harvnb|Bellman|1958}}, {{harvnb|Moore|1959}}
| |
| |}
| |
| {{expand list|date=December 2012}}
| |
| | |
| ===Planar directed graphs with arbitrary weights===
| |
| | |
| ==All-pairs shortest paths==
| |
| {{expand section|date=August 2013}}
| |
| | |
| The all-pairs shortest paths problem for unweighted directed graphs was introduced by {{harvtxt|Shimbel|1953}}, who observed that it could be solved by a linear number of matrix multiplications,
| |
| taking a total time of ''O''(''V''<sup>4</sup>).
| |
| | |
| Subsequent algorithms handle edge weights (which may possibly be negative), and are faster. The [[Floyd–Warshall algorithm]] takes ''O''(''V''<sup>3</sup>) time, and
| |
| [[Johnson's algorithm]] (a combination of the Bellman–Ford and Dijkstra algorithms) takes ''O''(''VE'' + ''V''<sup>2</sup> log ''V'').
| |
| | |
| ==Applications==
| |
| Shortest path algorithms are applied to automatically find directions between physical locations, such as driving directions on [[web mapping]] websites like [[Mapquest]] or [[Google Maps]]. For this application fast specialized algorithms are available.<ref>{{Cite journal|title=Fast route planning|first=Peter|last=Sanders|publisher=Google Tech Talk|date=March 23, 2009|url=http://www.youtube.com/watch?v=-0ErpE8tQbw|ref=harv|postscript=<!-- Bot inserted parameter. Either remove it; or change its value to "." for the cite to end in a ".", as necessary. -->{{inconsistent citations}}}}.</ref>
| |
| | |
| If one represents a nondeterministic [[abstract machine]] as a graph where vertices describe states and edges describe possible transitions, shortest path algorithms can be used to find an optimal sequence of choices to reach a certain goal state, or to establish lower bounds on the time needed to reach a given state. For example, if vertices represents the states of a puzzle like a [[Rubik's Cube]] and each directed edge corresponds to a single move or turn, shortest path algorithms can be used to find a solution that uses the minimum possible number of moves.
| |
| | |
| In a networking or telecommunications mindset, this shortest path problem is sometimes called the min-delay path problem and usually tied with a [[widest path problem]]. For example, the algorithm may seek the shortest (min-delay) widest path, or widest shortest (min-delay) path.
| |
| | |
| A more lighthearted application is the games of "[[six degrees of separation]]" that try to find the shortest path in graphs like movie stars appearing in the same film.
| |
| | |
| Other applications, often studied in [[operations research]], include plant and facility layout, [[robotics]], [[transportation]], and [[Very-large-scale integration|VLSI]] design".<ref>{{cite journal |doi=10.1145/242224.242246 |title=Developing algorithms and software for geometric path planning problems |date=December 1996 |first=Danny Z. |last=Chen |journal=ACM Computing Surveys |volume=28 |issue=4es |pages=18 |ref=harv}}</ref>
| |
| | |
| ==Related problems==
| |
| For shortest path problems in [[computational geometry]], see [[Euclidean shortest path]].
| |
| | |
| The [[traveling salesman problem|travelling salesman problem]] is the problem of finding the shortest path that goes through every vertex exactly once, and returns to the start. Unlike the shortest path problem, which can be solved in polynomial time in graphs without negative cycles, the travelling salesman problem is [[NP-complete]] and, as such, is believed not to be efficiently solvable for large sets of data (see [[P = NP problem]]). The problem of [[Longest path problem|finding the longest path]] in a graph is also NP-complete.
| |
| | |
| The [[Canadian traveller problem]] and the stochastic shortest path problem are generalizations where either the graph isn't completely known to the mover, changes over time, or where actions (traversals) are probabilistic.
| |
| | |
| The shortest multiple disconnected path <ref>{{cite journal |doi=10.1016/j.cpc.2005.01.020 |title=Shortest multiple disconnected path for the analysis of entanglements in two- and three-dimensional polymeric systems |year=2005 |first=Martin |last=Kroger |journal=Computer Physics Communications |volume=168 |issue=168 |pages=209–232 |ref=harv}}</ref> is a representation of the primitive path network within the framework of [[Reptation theory]].
| |
| | |
| The [[widest path problem]] seeks a path so that the minimum label of any edge is as large as possible.
| |
| | |
| ==Linear programming formulation==
| |
| | |
| There is a natural [[linear programming]] formulation for the shortest path problem, given below. It is very simple compared to most other uses of linear programs in [[discrete optimization]], however it illustrates connections to other concepts.
| |
| | |
| Given a directed graph (''V'', ''A'') with source node ''s'', target node ''t'', and cost ''w<sub>ij</sub>'' for each arc (''i'', ''j'') in ''A'', consider the program with variables ''x<sub>ij</sub>''
| |
| | |
| :minimize <math>\sum_{ij \in A} w_{ij} x_{ij}</math> subject to <math>x \ge 0</math> and for all ''i'', <math>\sum_j x_{ij} - \sum_j x_{ji} = \begin{cases}1, &\text{if }i=s;\\ -1, &\text{if }i=t;\\ 0, &\text{ otherwise.}\end{cases}</math>
| |
| | |
| This LP has the special property that it is integral; more specifically, every [[Linear programming#Theory|basic optimal solution]] (when one exists) has all variables equal to 0 or 1, and the set of edges whose variables equal 1 form an [[s-t path|''s''-''t'' dipath]]. See Ahuja et al.<ref>{{cite book | author=[[Ravindra K. Ahuja]], [[Thomas L. Magnanti]], and [[James B. Orlin]] | title= Network Flows: Theory, Algorithms and Applications | publisher=Prentice Hall | year=1993 | isbn=0-13-617549-X }}</ref> for one proof, although the origin of this approach dates back to mid-20th century.
| |
| | |
| The dual for this linear program is
| |
| :maximize ''y''<sub>''t''</sub> − ''y''<sub>s</sub> subject to for all ''ij'', ''y''<sub>''j''</sub> − ''y''<sub>''i''</sub> ≤ ''w''<sub>''ij''</sub>
| |
| and feasible duals correspond to the concept of a [[consistent heuristic]] for the [[A-star algorithm|A* algorithm]] for shortest paths. For any feasible dual ''y'' the [[reduced cost]]s <math>w'_{ij} = w_{ij} - y_j + y_i</math> are nonnegative and [[A-star algorithm|A*]] essentially runs [[Dijkstra's algorithm]] on these reduced costs.
| |
| | |
| ==See also==
| |
| * [[IEEE 802.1aq]]
| |
| * [[Flow network]]
| |
| * [[Shortest path tree]]
| |
| * [[Euclidean shortest path]]
| |
| * [[Min-plus matrix multiplication]]
| |
| * [[Bidirectional search]], an algorithm that finds the shortest path between two vertices on a directed graph
| |
| | |
| ==References==
| |
| {{reflist|30em}}
| |
| | |
| * {{cite journal |last=Bellman |first=Richard |authorlink=Richard Bellman |title=On a routing problem |journal=Quarterly of Applied Mathematics |volume=16 |issue= |pages=87–90 |year=1958 |mr=0102435 |ref=harv}}
| |
| * {{Introduction to Algorithms|edition=2|chapter=Single-Source Shortest Paths and All-Pairs Shortest Paths |pages=580–642}}
| |
| * {{cite journal |last1=Dijkstra |first1=E. W. |authorlink=Edsger W. Dijkstra |url=http://www-m3.ma.tum.de/twiki/pub/MN0506/WebHome/dijkstra.pdf |title=A note on two problems in connexion with graphs |journal=Numerische Mathematik |volume=1 |issue= |pages=269–271 |year=1959 |ref=harv |doi=10.1007/BF01386390}}
| |
| * {{cite conference |last1=Fredman |first1=Michael Lawrence |authorlink1=Michael Fredman |first2=Robert E. |last2=Tarjan |authorlink2=Robert Tarjan |title=Fibonacci heaps and their uses in improved network optimization algorithms |conference=25th Annual Symposium on Foundations of Computer Science |year=1984 |publisher=[[IEEE]] |pages=338–346 |url=http://www.computer.org/portal/web/csdl/doi/10.1109/SFCS.1984.715934 |ref=harv |doi=10.1109/SFCS.1984.715934 |isbn=0-8186-0591-X}}
| |
| * {{cite journal |last1=Fredman |first1=Michael Lawrence |authorlink1=Michael Fredman |first2=Robert E. |last2=Tarjan |authorlink2=Robert Tarjan |title=Fibonacci heaps and their uses in improved network optimization algorithms |journal=Journal of the Association for Computing Machinery |volume=34 |issue=3 |year=1987 |pages=596–615 |url=http://portal.acm.org/citation.cfm?id=28874 |ref=harv |doi=10.1145/28869.28874 }}
| |
| * {{cite book |last1=Leyzorek |first1=M.|first2=R. S. |last2=Gray |first3=A. A. |last3=Johnson |first4=W. C. |last4=Ladew |first5=S. R., Jr. |last5=Meaker |first6=R. M. |last6=Petry |first7=R. N. |last7=Seitz |title=Investigation of Model Techniques — First Annual Report — 6 June 1956 — 1 July 1957 — A Study of Model Techniques for Communication Systems |publisher=Case Institute of Technology |location=Cleveland, Ohio |year=1957 |ref=harv}}
| |
| * {{cite conference |last=Moore |first= E. F. |authorlink=Edward F. Moore |year=1959 |title=The shortest path through a maze |pages=285–292 |booktitle=Proceedings of an International Symposium on the Theory of Switching (Cambridge, Massachusetts, 2–5 April 1957) |publisher=Harvard University Press |location=Cambridge |ref=harv }}
| |
| *{{cite journal|first=Alfonso|last=Shimbel|title=Structural parameters of communication networks|journal=Bulletin of Mathematical Biophysics|year=1953|volume=15|issue=4|pages=501–507|doi=10.1007/BF02476438 |ref=harv}}
| |
| | |
| ==Further reading==
| |
| *{{cite conference |url=http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.32.9856 |title=Fully dynamic output bounded single source shortest path problem |author=D. Frigioni |coauthors=A. Marchetti-Spaccamela and U. Nanni |year=1998 |booktitle=Proc. 7th Annu. ACM-SIAM Symp. Discrete Algorithms |pages=212–221 |location=Atlanta, GA |doi= }}
| |
| | |
| [[Category:Network theory]]
| |
| [[Category:Polynomial-time problems]]
| |
| [[Category:Graph algorithms]]
| |
| [[Category:Computational problems in graph theory]]
| |