Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Short Circuiting DFS Graph Traversal

by lidden (Deacon)
on Oct 29, 2010 at 08:23 UTC ( #868266=note: print w/ replies, xml ) Need Help??


in reply to Short Circuiting DFS Graph Traversal

I am not sure I correctly understod the problem, but it seems Dijkstra's algorithm with all edges set to one should work.


Comment on Re: Short Circuiting DFS Graph Traversal
Re^2: Short Circuiting DFS Graph Traversal
by Limbic~Region (Chancellor) on Oct 29, 2010 at 14:44 UTC
    lidden,
    Unfortunately it won't - at least, not as I understand it. In the problem posed by neversaint, all paths between two nodes is desired. It is never said that cycle avoidance is required but I have assumed it for my purposes. In other words, each node visited along the path may only be visited once. Any algorithm designed to find the shortest or cheapest path or paths will not produce the correct result - even if every edge has the same cost. Assume the two nodes are directly connected. Imagine taking a Hamiltonian path around the graph with the start and end points being the two nodes in question - this can certainly be proven not to be among the shortest/cheapest paths.

    Cheers - L~R

      Can the edge cost be set to zero? :) Then, all the possible paths would be the cheapest.
        choroba,
        Most of what I know about graph theory I have learned here but I don't see why not. On the other hand, what you have just described is an unweighted graph which is stated as a given in my original node. I would be VERY impressed if an algorithm exists that can intuitively know not to follow paths that can lead to dead ends without keeping some sort of a cache of previously followed paths. If they can, then certainly they will be more efficient then what I propose and would love to learn about them.

        Cheers - L~R

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2014-10-25 01:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (139 votes), past polls