Tree with a single branch

tree
branches

#1

I’m processing a simple tree with branches like
{0}[list]
{1}[list]
etc.

I split it into two smaller trees using Split Tree, and sometimes (but not always) one of the sub-trees has only one branch. Grasshopper strips the tree structure from that sub-tree, and now my code is expecting a tree like
{11}[list]
but it receives only a list. The branch number, which is needed later when the tree will be merged back together, has been stripped.

Then data manipulation components don’t work the same on a list that is not a tree branch – to take the simplest example, Graft doesn’t behave consistently – and now everything breaks.

Is there a way to maintain a tree with a list or item in a single branch?

I can’t avoid needing to handle trees with any number of branches, and it’s a lot of work if I have to write a giant special case for the number 1.

Thanks!


#2

I don’t understand because Split Tree is supposed to keep it’s data tree structure by replacing unselected data to “Null”.

What you’re talking about is Split List?