JHF_Dijkstra-Algorithm_withUserHandling
Version 1.0 (14,5 KB) von
Jacob Foster
Implementation of Dijkstra’s Algorithm with user handling
If your graphical representation of your network is in 0...inf format then this code will be able to handle user inputs of 0...inf since MATLAB is in 1...inf format. The outputs are even converted back to 0...inf format for easy analysis with your visualization. If your graphical representation is in 1...inf then no actions/conversions are taken on the source and destination node.
The default node map***
(1,2) = distance from 0 to vertex #1 which equals 4
(2,8) = distance from 1 to vertex #7 which equals 11
This code also has extra features. This code will ask the user for the desired source node, destination node, and if the code should find the shortest distance to all nodes or just the destination node. One extra feature is checking for out of range source and destination nodes that the user inputs. The other feature is exit handling in case the user wants to exit the program after the program has been started. These features are mostly unnecessary for the Dijkstra’s Algorithm but have some utility.
The cost matrix can be changed and defined manually.
Zitieren als
Jacob Foster (2024). JHF_Dijkstra-Algorithm_withUserHandling (https://github.com/JHFoster11/JHF_Dijkstra-s-Algorithm/releases/tag/1.0), GitHub. Abgerufen .
Kompatibilität der MATLAB-Version
Erstellt mit
R2021a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Quellenangaben
Inspiriert von: dijkstra very simple
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.0 |
Um Probleme in diesem GitHub Add-On anzuzeigen oder zu melden, besuchen Sie das GitHub Repository.
Um Probleme in diesem GitHub Add-On anzuzeigen oder zu melden, besuchen Sie das GitHub Repository.