Dijkstra Algorithm Help

Ulrich Eckhardt ulrich.eckhardt at dominolaser.com
Wed Mar 9 04:07:22 EST 2011


yoro wrote:
> Thanks for replying, maybe i'm misunderstanding your comment -
> nodeTable is used to store the distances from source of each node
> within a text file, the file having the format :
> 
> 1,2,3,4,5,6,7,8,9
> 1,2,3,4,5,6,7,8,9
> 
> Each of these nodes will have the same settings as set out in Class
> Node, i.e. all having no previous nodes.

The thing he tried to point out is that your program is doing things that
make no sense much earlier than where you think your problems lie, and I
tend to agree. If you are reading the file and then discarding what you
read, that just doesn't make sense.

> I am then trying to pass this parameter to the next function so that
> the distance from the start node can be calculated

You are calling populateNodeTable twice, which already makes no sense. I'd
first try to call this function once and then verify the results by
outputting the content of the node table. Once that is done and the content
is what you would expect it to be, then you can start trying to implement
Dijkstra.

Uli



-- 
Domino Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list