dijkstra

Versión 1.0 (2.32 KB) por Jordi Palacin
Another single-function implementation of Dijkstra's Algorithm for shorter path finding in a directed matrix-graph

4 descargas

Actualizado 5 Sep 2023

Ver licencia

A single-function implementation of Dijkstra's algorithm for shorter path finding in a directed matrix-graph
Didactic reference of Dijkstra's algorithm at: https://youtu.be/bZkzH5x0SKU
[route, cost, M] = dijkstra(G, initialNode, finalNode)
Interpretation of the columns of the Dijkstra matrix M
Node number | best previous node | cumulative path cost | node visited
Example: G(a,b)=z defines a directional link from (only) the node a to b, use G(b,a)=w to link from b to a
G = [;
0 1 0 0 0 0 0;
0 0 1 0 0 10 0;
2 0 0 1 0 0 0;
0 0 2 0 1 0 0;
0 0 0 2 0 1 0;
0 0 0 0 2 0 1;
0 0 0 0 0 2 0;
];
[ r, c, W] = dijkstra( G, 1, 7)
r =
1 2 3 4 5 6 7
c =
6
W =
1 0 0 1
2 1 1 1
3 2 2 1
4 3 3 1
5 4 4 1
6 5 5 1
7 6 6 1

Citar como

Jordi Palacin (2023). dijkstra (https://www.mathworks.com/matlabcentral/fileexchange/134851-dijkstra), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2015b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.0