Data doubts

In the given screenshot, in the first scenario, when I input grafted elements of group 2 in concatenate, then every element of 1st group gets matched with 2nd group. This is understandable, as all elements of group one try to match with every branch of the grafted group 2.

In the second scenario, when both group 1 and 2 are grafted, why don’t every element of both groups (now individual branches) match with each other?

Its just logical like this…
At least for me :wink:

What should be the outcome?
Can u just type it down by hand?

U may need to duplicate some data first… Maybe a FlipMatrix is needed too…
or any other Tree-related-Stuff…
It strongly depends on what u are expecting…

The rule is this:

First, branches match to branches
Then, items match to items.

Both branches and items use basically the same “matching” rules - effectively, “longest list” matching. So if you match 1 branch M with many branches N1-N6, it will match M to N1, M to N2, etc. If you have M1-M3 branches in one input, and N1-N3 branches in the second input, it will match M1 to N1, M2 to N2, and so on.

Then, once the branch associations have been made, it handles item matching within each branch match, in exactly the same way.

So items match like this:

and trees match like this:

So this means when you graft both grp 1 and grp 2, it’s just going to match each branch with the corresponding branch in the other list. Each branch has only one item, so after that, it’s done!

Hope that helps explain a little bit; if theres a particular problem you’re trying to solve, try to explain it a little deeper and we can try to help :slight_smile:

12 Likes

Thanks a lot man! That’s some really detailed and exhaustive explanation of data structures.

Well, I’m a beginner level in Grasshopper and just trying to understand how things work.

Even tutorials on data structures on youtube, Lynda and thinkparametric haven’t helped me in deep.

Yours is the most comprehensive explanation that talks about each and every scenario.

If you’re a beginner you might also benefit from this accompanying video tutorial I put together :slight_smile:
https://www.youtube.com/watch?v=MQKkiggh6vE - I explain a lot of these concepts in a little more detail in the real context of Grasshopper’s interface :slight_smile:

1 Like

Also just in case any one else is interested here is the PDF I made that these diagrams/graphics come from: Data Trees.pdf (3.3 MB)

8 Likes

Thank you Andrew for your explanation of data structure and trees.
So far is the best one I’ve seen.

1 Like

This document is pure gold! Nowhere in this universe I have ever seen such simple explanation of data trees! @andheum . Thank you so much for this again.