How to resolve the algorithm Dijkstra's algorithm step by step in the Maple programming language
How to resolve the algorithm Dijkstra's algorithm step by step in the Maple programming language
Table of Contents
Problem Statement
Dijkstra's algorithm, conceived by Dutch computer scientist Edsger Dijkstra in 1956 and published in 1959, is a graph search algorithm that solves the single-source shortest path problem for a graph with non-negative edge path costs, producing a shortest path tree.
This algorithm is often used in routing and as a subroutine in other graph algorithms.
For a given source vertex (node) in the graph, the algorithm finds the path with lowest cost (i.e. the shortest path) between that vertex and every other vertex.
If the vertices of the graph represent cities and edge path costs represent driving distances between pairs of cities connected by a direct road, Dijkstra's algorithm can be used to find the shortest route between one city and all other cities.
As a result, the shortest path first is widely used in network routing protocols, most notably:
The inputs to Dijkstra's algorithm are a directed and weighted graph consisting of 2 or more nodes, generally represented by:
A destination node is not specified. The output is a set of edges depicting the shortest path to each destination node.
You can use numbers or names to identify vertices in your program.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Dijkstra's algorithm step by step in the Maple programming language
Source code in the maple programming language
restart:
with(GraphTheory):
G:=Digraph([a,b,c,d,e,f],{[[a,b],7],[[a,c],9],[[a,f],14],[[b,c],10],[[b,d],15],[[c,d],11],[[c,f],2],[[d,e],6],[[e,f],9]}):
DijkstrasAlgorithm(G,a);
# [[[a], 0], [[a, b], 7], [[a, c], 9], [[a, c, d], 20], [[a, c, d, e], 26], [[a, c, f], 11]]
You may also check:How to resolve the algorithm Word frequency step by step in the Bracmat programming language
You may also check:How to resolve the algorithm Cartesian product of two or more lists step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Nested function step by step in the Pascal programming language
You may also check:How to resolve the algorithm 4-rings or 4-squares puzzle step by step in the Scala programming language
You may also check:How to resolve the algorithm Comma quibbling step by step in the Cowgol programming language