Re: [Tutor] Recursion doubt

2008-04-23 Thread Kent Johnson
Anshu Raval wrote: But my question would again be how do you know to put square brackets around path in if start == end: return [path] in find_all_paths. I am still puzzled by this. find_all_paths() returns a *list* of paths, even when the result is a single path. Without the brac

Re: [Tutor] Recursion doubt

2008-04-23 Thread Anshu Raval
Hi, Thank you so much for your response. I followed the 2 reasonings you gave, -- You can look at find_all as a master routine that keeps calling find_path until find_path gives up. If the search space has not been exhausted (here there are still other nodes connected to 'start') take a suit

Re: [Tutor] Recursion doubt

2008-04-19 Thread Jos Kerc
Hi, you are tackling 3 "heavy" subjects in just 1 go! graphs :a triving math society would approve your choice. But you might start with the *slightly* less difficult challenge: trees. I do not know your math/programming background, so the following link can perhaps enlighten you: http://www.brpr

[Tutor] Recursion doubt

2008-04-15 Thread Anshu Raval
Hi, At the url http://www.python.org/doc/essays/graphs.html there is some code by Guido Van Rossum for computing paths through a graph - I have pasted it below for reference - Let's write a simple function to determine a path between two nodes. It takes a graph and the start and end nodes as