Question Updated
I am currently working on implementing Dijkstra's Algorithm in Python, I have looked at other questions here regarding the algorithm and none seem to fit what I am looking for.
Currently my program reads two text files, one containing a network routing diagram network.txt (basically the route costs).
0,2,4,1,6,0,0
2,0,0,0,5,0,0
4,0,0,0,0,5,0
1,0,0,0,1,1,0
6,5,0,1,0,5,5
0,0,5,1,5,0,0
0,0,0,0,5,0,0
and one containing the desired route (route.txt)
B>F
The Network Routing Table: (Each Line Is a Node and Its Links so node A is linked to B, C, D and E)
A B C D E F G
A [0, 2, 4, 1, 6, 0, 0]
B [2, 0, 0, 0, 5, 0, 0]
C [4, 0, 0, 0, 0, 5, 0]
D [1, 0, 0, 0, 1, 1, 0]
E [6, 5, 0, 1, 0, 5, 5]
F [0, 0, 5, 1, 5, 0, 0]
G [0, 0, 0, 0, 5, 0, 0]
Nodes On The Network: ([Structure] PreviousNode, DistanceFromSource, Visited)
A [-1, 1000000000, False]
B [-1, 1000000000, False]
C [-1, 1000000000, False]
D [-1, 1000000000, False]
E [-1, 1000000000, False]
F [-1, 1000000000, False]
G [-1, 1000000000, False]
I kind of understand Dijkstra's Algorithm but using the two data structures I have, combined with having to write it in Python I don't have a clue where to go from here because I am unable to get my head round how to do this not knowing the language.
I have some very basic "pseudocode" to what I need to do next
3 - Examine all the unvisited neighbours of the current node and calculate their tentative distances from the starting node, overwriting the existing distance if the new value is lower
4 - Mark current node as visited (will not be examined again)
5 - If not at destination and unvisited node exists go to the unvisited node with the smallest > distance from initial node and make it the current node, otherwise end
6 - Go back to 3
Is anyone able to assist me with translating that "pseudocode" into code or even more meaningful pseudocode would be great as I am struggling with this