"Member Index" Searching inside branches. Need help with tree managment

Hi, I would like to use members that are inside of the first branch of a list to search for index inside another list’s first branch.

Member List = Branch 0 ----search—> Target List = Branch 0
Member List = Branch 1 ----search—> Target List = Branch 1
etc.

Moved to Grasshopper category

Can anyone help me with this?

I am not really sure abou the question, do you need to find the occurrence of the first item in a tree inside another tree?

That is correct. But I want to find the occurrence of all items inside the first branch of tree A inside the first branch of tree B. So it is a comparison of two trees, but branch one with one, two with two, etc.

If you are looking for common items between two lists of numbers, then just use Set Intersection.

1 Like

And how to get the index of the common items inside list A&B refering to to list A?

1 Like

For branch {2} you receive Item Index 2, 0, 1 in B with path {2;0}, {2,1}, {2,2}. In my case, it is necessary to receive all three index numbers inside one branch. So all resulting Indexes for {2] should inside one branch. I do not know how to receive this structure

Flatten the result.

Flatten does not seem to work correctly.

Before Flatten:

After Flatten:

Have a try Shift Parhs.

1 Like

I received my final result. Thanks a lot for your time!

When you have a little bit more time, there is no hurry:

I do not know much about sets, but I read somewhere else that there is not any difference between lists (trees, branches, etc) and sets. I still do not know when to use tree components and when set components.

Just for our example right now. Is there any possibility to solve this thing with tree components. So just with lists, shifting branches, etc. ?

Maybe they look similar, but they’re playing a different role, so they’re divided.
The components in the Tree tab are tools for manipulating or selecting when using the Datatree of GH.
The components in the Sets tab are mainly useful for boolean, selection, and manipulation of set of points or numbers.

1 Like

I will keep that in mind. Thank you.

Just one more example with same tree problem but a bit different. First branch of tree “Numbers” should be tested inside first branch of tree “Domains”.

I am not sure if this could be done with the solution from above. Do you know how to handle that?

TryIncludes if you’d like to get true or false values whether your number is in a specific domain or not.

Please have a look here. Hopefully this is more clear: