JHF_Dijkstra-Algorithm_withUserHandling
Version 1.0 (14.5 KB) by
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.
Cite As
Jacob Foster (2024). JHF_Dijkstra-Algorithm_withUserHandling (https://github.com/JHFoster11/JHF_Dijkstra-s-Algorithm/releases/tag/1.0), GitHub. Retrieved .
MATLAB Release Compatibility
Created with
R2021a
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Acknowledgements
Inspired by: dijkstra very simple
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0 |
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.