Probley a really simple one ive got the basis of the Dijkstra’s algorithm
# findRoute - dijkstra's algorithm.
#
def findRoute(source, dest):
global theGraph
theGraph.reset(source)
while theGraph.get
() != []:
u = theGraph.getBestChoice(source)
theGraph.addVisited(u)
if u == dest:
return True
for v in theGraph.getNode(u).getNeighbours():
theGraph.addChoice(v)
alt = theGraph.getNode(u).getDistanceFrom(source) + theGraph.getLength(u, v)
if alt < theGraph.getNode(v).getDistanceFrom(source):
theGraph.getNode(v).update(u, alt)
return False
what im really trying to do is to count the maximum number of nodes held in the choices list, the number of nodes whose absolute distance from source is modified and the number of distance comparisons made. Not sure how easy this is to achieve any help would be much appreciated.