Original Post
Hi guys!,
My problemo is:
I need to find ALL possible paths within a bi-directional graph from a given edge (by bi-directional I mean that every vertice of the graph is conected to the last edge in a 2 way direction).
For example, my adjacency matrix is
0 | 1, 2, 3, 5
1 | 0, 2, 3, 5
2 | 0, 1, 3
and so on.
I want my alg to start at point 0 and find all possible paths that I can take from zero. I've tried to use a depth-first alg, but it bails out as soon I reach the "longest" branch. But what I need is the alg to backtrack to the longest branch - 1 and find any other possible path from there.
A simple backtracking alg would to the trick? if yes, which one?
many thanks!
My problemo is:
I need to find ALL possible paths within a bi-directional graph from a given edge (by bi-directional I mean that every vertice of the graph is conected to the last edge in a 2 way direction).
For example, my adjacency matrix is
0 | 1, 2, 3, 5
1 | 0, 2, 3, 5
2 | 0, 1, 3
and so on.
I want my alg to start at point 0 and find all possible paths that I can take from zero. I've tried to use a depth-first alg, but it bails out as soon I reach the "longest" branch. But what I need is the alg to backtrack to the longest branch - 1 and find any other possible path from there.
A simple backtracking alg would to the trick? if yes, which one?
many thanks!