This article includes a list of references, but its sources remain unclear because it has insufficient inline citations. The problem of finding the shortest path between two intersections on a road map may be modeled as a special case of the shortest path problem in graphs, where the vertices correspond to intersections and the edges correspond linear programming definition journal road segments, each weighted by the length of the segment. The shortest path problem can be defined for graphs whether undirected, directed, or mixed.

Two vertices are adjacent when they are both incident to a common edge. 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. 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. Dijkstra’s algorithm solves the single-source shortest path problem with non-negative edge weight.

```
```

`Did not find what they wanted? Try here`

```
```

Ford algorithm solves the single-source problem if edge weights may be negative. Warshall algorithm solves all pairs shortest paths. Viterbi algorithm solves the shortest stochastic path problem with an additional probabilistic weight on each node. For this application fast specialized algorithms are available.

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. 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. 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 VLSI design.

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. All of these algorithms work in two phases. In the first phase, the graph is preprocessed without knowing the source or target node. The second phase is the query phase.