Python - Dijkstra's algorithm on a large scale
<p>I have a large network, about 400 nodes, and what I'm trying to do is calculate every possible route you can make on the network. That means, the nodes traversed and the total weighting of the route from Node 1 to Node 2, Node 1 to Node 3 up to Node 1 to Node 400. </p>

<p>Then, from Node 2 to Node 3, Node 2 to Node 4 up to Node 2 to Node 400.</p>

<p>(Just FYI, I have very limited knowledge of python, day to day I work with HTML/CSS)</p>

<p>I've been using this code that I discovered: <a href="http://bytes.com/topic/python/insights/877227-dijkstras-algorithm-finding-shortest-route" rel="nofollow">http://bytes.com/topic/python/insights/877227-dijkstras-algorithm-finding-shortest-route</a></p>

<p>Which is great, however, due to the size of my network, calculating every possible way to go from any node to any node takes a very, very long time. </p>

<p>From what I understand of the algorithm I linked to, it visits each node in turn from the start node, and gives it a value which is the weighting required to get to that node from the start (I imagine it also records the route required to get to each specific node?). If it finds a shorter route to get to that node it overwrites what it had before. Once it gets to the destination it stops and returns the result. </p>

<p>I figure, if the script can be edited slightly, can it instead of stopping at a specific destination, just visit all the nodes as it usually would and print out a report of the shortest route and weighting to each one? That way, the algorithm would only have to be run a total of 400 times, once for each possible starting position.</p>

<p>Thanks for any advice you can give and I hope that was clear!</p>
