Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by Limbic~Region (Chancellor)
on Oct 28, 2010 at 14:54 UTC ( #868047=note: print w/replies, xml ) Need Help??


in reply to Finding All Paths From a Graph From a Given Source and End Node

neversaint,
I noticed you asked a graph question the other day too. If they are related, then perhaps it might be useful for you to explain the bigger picture. There are a few monks I lean on heavily whenever I have a graph question. Using Graph or some other high level abstraction model is usually faster for the programmer to write - but can end up being terribly slow runtime.

If you only wanted the shortest path between the two end points (assuming cyclical path avoidance), I would go with modified Bidirectional search which I discovered in A Better Word Morph Builder. To find all paths I might go with a self-pruning Depth-first search. This is still a brute force search but you pay attention to which paths are invalid and do not descend into them when reaching the node from a different path.

If you need example code beyond the explanation above, let me know but it won't happen until tonight.

Cheers - L~R

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2020-04-08 16:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (45 votes). Check out past polls.

    Notices?