[Tutor] "Path tree"

Mats Wichmann mats at wichmann.us
Mon Aug 14 11:19:42 EDT 2017


On 08/13/2017 02:07 PM, Michael C wrote:
> Hi all:
> 
> I am trying to formulate a "path-finding" function, and I am stuck on this
> problem:
> 
> Please look at the picture attached: Those dots are coordinates of (x,y),
> and this tree can be thought of as a list of tuples, with each tuple
> consisting of (x,y).  Now I am trying to make a function go through this
> list of tuples and then return the "path." to go from, say, 4 to 8. If I
> simply compute for the dot for shortest distance, then the solution would
> be to go from 4 to 8 direct, but that doesn't work, because the correct
> solution should have been 4,3,2,5,6,8.
>
> How do I do this?

There is no picture, don't know if you forgot to attach, or if it got
stripped by the mailing list software (the latter does happen, although
some seem to get through).

There is quite some on path-walking solvers in Python if you search a
bit, although when I looked just now it was not as easy to find useful
stuff as I remembered from some years ago when I was interested in such
a problem.

Usually, the tutors are better able to help if you post some initial
code and explain what you're trying to do and what is going wrong or
what you don't understand.




More information about the Tutor mailing list