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
You might want to have a look at the TRIPS algorithm: paper