Dijkstra Algorithm

Version 1.0.0.0 (2,57 ko) par Dimas Aryo
Dijstra algorithm to solve shortest path problem.
16,3K téléchargements
Mise à jour 11 avr. 2012

Afficher la licence

This algorithm is to solve shortest path problem.

Usage
[cost rute] = dijkstra(graph, source, destination)

note : graph is matrix that represent the value of the edge. if node not connected with other node, value of the edge is 0.

example:
Finding shortest path form node 1 to node 7.

>> G = [0 3 9 0 0 0 0;
0 0 0 7 1 0 0;
0 2 0 7 0 0 0;
0 0 0 0 0 2 8;
0 0 4 5 0 9 0;
0 0 0 0 0 0 4;
0 0 0 0 0 0 0;
];
>> [cost rute] = dijkstra(G,1,7)

it will resulting

cost = 15
rute = [7 6 4 5 2 1]

Citation pour cette source

Dimas Aryo (2024). Dijkstra Algorithm (https://www.mathworks.com/matlabcentral/fileexchange/36140-dijkstra-algorithm), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R14SP1
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0.0