I have a directed acyclic graph where each node represents a state
public class State{ List<State> ForwardStates; List<State> backStates; string stateName; }
where ForwardStates is a list of states through direct links from the current state. and backStates is a list of states via backlinks from the current state.
I have two special conditions
State initialState (name=initial) State finalState (name=final)
I want to find all the paths from the initial state to the final state and fill
List<List<string>> paths
For example, this chart is as follows

If backlinks are represented by a brown arrow and direct links are represented by a black concrete arrow, the possible paths are {{initial, b, a, final}, {initial, c, final}, {initial, b, initial, final}}
The rule is that from the initial state, it must go through 1 or more backlinks before moving on a direct line of communication, and as soon as it switches to a direct link, it will continue to forward links (i.e. it cannot use backlinks).
This question is a continuation of this question ( Collecting all DAG paths ).
c # algorithm graph-theory
william007 Feb 01 '13 at 18:26 2013-02-01 18:26
source share