How to generate all the subtrees expanded from the root node?

336 views Asked by At

I need an efficient algorithm to generate all the subtrees expanded from the root node. The algorithm should work for any tree structure. Can anyone contribute a code?

For example, given the edges of a tree as 0->1, 0->2, 2->3. There are six subtrees: 0,

0,1

0,2

0,1,2

0,2,3

0,1,2,3

1

There are 1 answers

0
Bogdan B On BEST ANSWER

You might want to have a look at the TRIPS algorithm: paper