I have some code for a routing algorithm in python programming language but i don't understand the code at all. I am only a beginner and i was wondering if anyone could explain it for me in plain text. Could you please go through and explain each part. Cheers. Here's the code :
def findRoute(source, dest):
global theGraph
global count1
global count2
global count3
theGraph.reset(source)
while theGraph.getChoices() != []:
u = theGraph.getBestChoice(source)
theGraph.addVisited(u)
if u == dest:
print "there is no other choice, we have reach the destination", dest
return True
for v in theGraph.getNode(u).getNeighbours():
theGraph.addChoice(v)
alt = theGraph.getNode(u).getDistanceFrom(sour... + theGraph.getLength(u, v)
#print "the distance is", theGraph.getNode(v).getDistanceFrom(sour...
count3= count3+1
if alt < theGraph.getNode(v).getDistanceFrom(sour...
theGraph.getNode(v).update(u, alt)
count2=count2+1
print " choicelist ", theGraph.getChoices(), "visitedlist", theGraph.getVisited()
print len(theGraph.getChoices())
if len(theGraph.getChoices())>= count1:
count1= len(theGraph.getChoices())
print u, "has neighbours", theGraph.getNode(u).getNeighbours()
#print "the distance is", theGraph.getNode(v).getDistanceFrom(sour...
print " "
print " "