Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
GraphTheory[DijkstrasAlgorithm]
Calling Sequence
DijkstrasAlgorithm(G, s, t)
DijkstrasAlgorithm(G, s, T)
DijkstrasAlgorithm(G, s)
Parameters
G
-
a graph with nonnegative edge weights or no weights
s, t
vertices of the graph G
T
list of vertices of the graph G
Description
If G is an unweighted graph, the edges are assumed all to have weight 1.
If G is a weighted graph, DijkstrasAlgorithm('G','s','t') returns the cheapest weighted path from vertex s to vertex t in the graph G. If a path from s to t exists, the output is a list of the form [[s,...,t],w] where [s,...,t] is the path and w is the weight of that path. If no such path exists the output is .
In the second calling sequence where T is a list of vertices of G, this is short for [seq(DijkstrasAlgorithm(G,s,t), t=T)], save that the algorithm does not need to recompute cheapest paths.
In the third calling sequence where no destination vertices are given, this is short for DijkstrasAlgorithm(G,s,Vertices(G)), i.e. the cheapest path from s to every vertex in G is output.
To compute distances between all pairs of vertices simultaneously, use the AllPairsDistance command. To ignore edge weights (and use a faster breadth-first search) use the ShortestPath command.
If some edge weights are negative, the BellmanFordAlgorithm command can be used to compute the shortest path.
Examples
See Also
AllPairsDistance, BellmanFordAlgorithm, ShortestPath
Download Help Document