Over the past few days, I have been trying to implement this algorithm. So far, I have managed to create a dynamic 2d array and insert distances between nodes, a function to remove the path between nodes, and a function that tells me if there is a path between two nodes. Now I would like to implement a function that returns the shortest path from node A to node B. I know how the dijkstras algorithm works, and I read the wiki pseudocode without being able to write the code myself. I am really stuck here.
I was thinking about how the code should look and what should happen, so I created this function that tells me if there is a path between two nodes. Do I need additional help functions that make implementing dijkstras easier?
At the moment I have only 3 nodes, but the code that I would like to write should work for n nodes in general.
Any help is appreciated.
source
share