1 Attachment(s)

Generate all possible sequences from Event Tree

Suppose, i have event tree and each node has a type namely 'event', 'sequence' and 'set'. A node can have 'n' branches.

event- leaf node

sequence- the leaf node must come in sequence like for node 'A' in the example tree the sequence must be only B->C

set- any combination of leaf node may appear in sequence like for node 'E' in the example tree: the sequence may be F->G, G->F

For example:

Attachment 853

So, I have to generate all the possible sequence of event for a given tree. The example tree will have 4 event sequences which are

B->D->F->G

B->D->G->F

B->F->G->D

B->G->F->D

So, how it can be done in java to find out all possible sequences.

Any algorithm will also be a great help.