Getting all graph paths between nodes

Hi,



Is there any way that I get all paths(route) in goview between 2 nodes?

Simple Exampe is



1–>2–>3

| |

| |

4–>5–>3



Here I would like to get the all posible routes( if posible in XML format) between Nodes 1 and 3 like



a) 1-2-3

b) 1-4-5-3

c) 1-4-5-2-3

d) 1-2-5-3



If any object in GODiagram supoorts this, what algorithm it is using ( Depth,Breadth first search).



Thank you

Rami





If you don’t want to include cycles, what I would do is a depth first search over all paths leading from node 1, pushing visited nodes onto a stack to remember the route, marking visited nodes along the way, stopping when encountering a visited node, and recording the path when reaching node 3. You can use the IGoNode.UserFlags property for setting a “visited” flag.
One optimization: you could discover all of the nodes from which there is no path to node 3, and pre-mark them as “visited”. Just find all nodes reachable backwards from node 3–all the other nodes in the graph can be marked “visited”.

Thanks Walter… I like your Optimization technique.