Retrieve values matching higher order branch index

Hello!

I have two different trees: one containing some values that I want to retrieve (let’s call it tree V), and the other one containing the indices of these values I want to retrieve (tree I).

Trees V and I have different structures:

  • Tree V contains two branches: even values in branch {0}, and odd values in branch {1}.
  • Tree I has two branch levels: {0;x} and {1;x}.
    I would like {0;x} indices to retrieve values from branch {0} of tree V and {1;x} indices to retrieve values from branch {1}. In other words, the higher order branch index of tree I should match the index of tree V. The output tree should have the same structure as tree I.

I was wondering if there was a more elegant way to accomplish this than the one I found. :slightly_smiling_face:

Thanks!


matching_branches.gh (10.5 KB)