All Possible Combinations from a Tree

Hi All,

I’m wanting to get all the possible combinations from a tree as shown (this tree can change).

I have shown what I what I want the output to be (its just the indices) however I need it to be dynamic so I don’t have to keep fixing the inputs for the cross reference and merge when the input list changes. Any suggestions?

the combinations you are looking for is a “product” in the python itertool module
see attached file (7.7 KB)

1 Like

I have a similar issue. I have a tree list. I have tried Itertools before, but this time the input its a bit more complex, because i want to combine from a tree list (nested list) the lists that share the first path item.
so in this example:

{0;0} with {0;1}
{1;0} with {1;1}
{2;0} with {2;1}
The input its dynamic.
And the output should be also a tree list with all the combinations for later manipulation.

Any ideas? (16.5 KB)

Thank you! (10.9 KB)

I put in the conditionals to look for path indices for “sub grouping”
Calling it “index aware”

1 Like

@Will_Wang you are a genius! Thank you very much. This was exactly what I was looking for. Thanks to this I can continue with the ‘big picture’ of the complex definition im doing for residential feseability study. Text me if you want to know more about it!