Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^15: Finding All Paths From a Graph From a Given Source and End Node

by LanX (Cardinal)
on Nov 02, 2010 at 20:39 UTC ( #869092=note: print w/replies, xml ) Need Help??


in reply to Re^14: Finding All Paths From a Graph From a Given Source and End Node
in thread Finding All Paths From a Graph From a Given Source and End Node

just intelligent looping, no need for tail-recursion.

Any recursion can be linearized.

Pushing and popping the @path array and/or %seen is all you need as a stack.

But I'm too lazy to do neversaints homework! :)

Cheers Rolf

  • Comment on Re^15: Finding All Paths From a Graph From a Given Source and End Node

Replies are listed 'Best First'.
Re^16: Finding All Paths From a Graph From a Given Source and End Node
by BrowserUk (Pope) on Nov 02, 2010 at 21:14 UTC

    If I thought that this was homework, I wouldn't be doing it either!

    But neversaint has a long history of posting deeply involved genomic programming tasks. And he is always more than willing to do his part in cleaning up and generalising what we post for his use.

    I'm not sure whether he's making a fortune off of the help he gets here, or is on a research pittance furthering the science for the benefit of all human-kind. Nor do I much care.

    He presents interesting problems, and I enjoy trying to solve them. It's far better than a cross-word or sudoku. (Besides, I wrote solvers for both of those years ago. Now if only I could get the computer to buy the papers and scan them in, they'd get used :)

    Come to that. If neversaint's Perl/CS lecturer is presenting problems like these as "homework", he is either a brilliant lecturer with very gifted students; or a sadistic bastard.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://869092]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2021-03-03 02:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (69 votes). Check out past polls.

    Notices?