# single-source shortest-path problem

(classic problem)

**Definition:**
Find the *shortest paths* from a specific *source* *vertex* to every other vertex in a *weighted, directed graph*. *Dijkstra's algorithm* solves this if all weights are nonnegative. The *Bellman-Ford algorithm* handles any weights.

**See also**
*graph*, *all pairs shortest path*, *single-destination shortest-path problem*, *DAG shortest paths*, *shortest path*.

*Note:
Equivalent to the single-destination shortest-path problem with all directions reversed.*

Author: PEB

## Implementation

See implementations at graph. Single-source shortest directed path (Java) from Sedgewick and Wayne "Algorithms" 4th edition.

Go to the
Dictionary of Algorithms and Data
Structures home page.

If you have suggestions, corrections, or comments, please get in touch
with Paul Black.

Entry modified 15 October 2021.

HTML page formatted Fri Oct 15 16:48:46 2021.

Cite this as:

Paul E. Black, "single-source shortest-path problem", in
*Dictionary of Algorithms and Data Structures* [online], Paul E. Black, ed. 15 October 2021. (accessed TODAY)
Available from: https://www.nist.gov/dads/HTML/singleSourceShortestPath.html