Dijkstra Algorithm Help

Tim Roberts timr at probo.com
Wed Mar 9 03:33:40 EST 2011


yoro <gmj123 at hotmail.co.uk> wrote:
>
>Thanks for replying, maybe i'm misunderstanding your comment -

Yes, it was not clear at first glance that you are calling
populateNodeTable twice.  You call it once and throw away the result, then
you call it again and pass the result to tentativeDistance.  That's
probably not what you meant to do.

But look at the code within populateNodeTable.  You read the list from your
file, chop it into pieces at the commas, convert them to integers, and then
store them into a variable that you never use.  You never use the contents
of your file in this code.

>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. I am then trying to pass this
>parameter to the next function so that the distance from the start
>node can be calculated

How do those numbers say anything about the distances between nodes?
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list