Dijkstra[g,v]
gives a shortest-path spanning tree and associated distances from vertex v of graph g. The shortest-path spanning tree is given by a list in which element is the predecessor of vertex
in the shortest-path spanning tree. Dijkstra does not work correctly when the edge weights are negative; BellmanFord should be used in this case.


Dijkstra
Dijkstra[g,v]
gives a shortest-path spanning tree and associated distances from vertex v of graph g. The shortest-path spanning tree is given by a list in which element is the predecessor of vertex
in the shortest-path spanning tree. Dijkstra does not work correctly when the edge weights are negative; BellmanFord should be used in this case.
Details and Options
- Dijkstra functionality is now available in the built-in Wolfram Language function FindShortestPath.
- To use Dijkstra, you first need to load the Combinatorica Package using Needs["Combinatorica`"].
Tech Notes
Related Guides
-
▪
- Combinatorica Package ▪
- Graph Algorithms ▪
- Graphs & Networks ▪
- Graph Visualization ▪
- Computation on Graphs ▪
- Graph Construction & Representation ▪
- Graphs and Matrices ▪
- Graph Properties & Measurements ▪
- Graph Operations and Modifications ▪
- Statistical Analysis ▪
- Social Network Analysis ▪
- Graph Properties ▪
- Mathematical Data Formats ▪
- Discrete Mathematics
Text
Wolfram Research (2012), Dijkstra, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/Dijkstra.html.
CMS
Wolfram Language. 2012. "Dijkstra." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/Combinatorica/ref/Dijkstra.html.
APA
Wolfram Language. (2012). Dijkstra. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/Combinatorica/ref/Dijkstra.html
BibTeX
@misc{reference.wolfram_2025_dijkstra, author="Wolfram Research", title="{Dijkstra}", year="2012", howpublished="\url{https://reference.wolfram.com/language/Combinatorica/ref/Dijkstra.html}", note=[Accessed: 13-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_dijkstra, organization={Wolfram Research}, title={Dijkstra}, year={2012}, url={https://reference.wolfram.com/language/Combinatorica/ref/Dijkstra.html}, note=[Accessed: 13-August-2025]}