-1

Given a route with a start and end vertices, I wish find out all the paths, how should I do this?

1
  • Enumerate all the paths from any node to any other node. Then discard the ones that don't have your desired start and end point. (You didn't say you wanted to solve the problem efficiently.) Jan 29, 2013 at 5:10

1 Answer 1

2

Run DFS from the starting vertex, passing the list of vertexes that you found so far down to the next invocation level. Print the list upon reaching the end vertex, and continue with the DFS until all paths have been enumerated.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.