How to teach about trees?

Hi all.
Recently I’ve been doing some grasshopper lessons for people around my area.
With normal rhino users or even generic CAD rookies (who might have had rhino lessons some day before) is not that hard to explain the basics of grasshopper.
But somehow you’ll end up hitting the big “data tree” wall!

Does anybody have some tip about teaching about trees? Maybe some small, simple yet smart example…
… for making the student mentally visualize what them are and how navigation in them occur.
Trees are really much more abstract than lists…

Thank you already for everything!

‘Tree/List Viewer’, open source clusters - take them apart to see how they work. (20.0 KB)


Trees in themselves in their simplest form are not hard to visualize… They’re just lists of lists (of lists of lists…) If a list is a basket containing stuff, then a tree is a bigger basket of a bunch of baskets of stuff.

The hard part to visualize is data matching… That big basket “A” holds a bunch of smaller baskets “A1-A10” and that big basket “B” also holds bunch of smaller baskets “B1-B10” and that you can make operations that work on A1 and B1, A2 and B2, etc…

I’m sure there are already some nice examples using colors/forms as above…

1 Like

Yes, you’re right. That’s the real problem.

It goes everything well until you go "and now we have to graft this because… " and i have no idea how to explain properly…

This method worked for me, plus understanding relative items component

I think you’re going in the opposite direction. Understanding the collection is easy because we are all familiar with “tagged lists”. What normally fails (in my experience as a teacher and by the doubts in this forum) is to understand how the component works with the branches, the practical part.

Depending on the type of parameter access and the structure and amount of data given, the component runs N times. You don’t understand the branches well until you are able to predict N (and the amount of branches and items per branch in the outputs), because if you know that you are able to relate different data structures in different inputs properly. This is the hard part. The other side of dealing with branches is knowing the components that operate directly with them, but this is not a problem.

1 Like

Trees are like a big town have many buildings every buildings have apartments and every apartment have rooms …etc

The datatree is not a nested collection, it’s a list of lists (a SortedList<GH_Path, List< object>>). What makes it nested is our understanding of the sequence of operations, but that information is not in the collection, at least not using it in a normal way. If you divide a line into 5 segments, you have a list of 5 lines, if you divide all these three times, you have 5 branches with 3 elements. But the first line and the first 5 segments no longer belong to the tree, so the data are not nested. It’s not a tree, it’s just the leaves. It’s not like the folder system, it’s just the files of the last folders.


Interesting point. That’s true.

This still messes with me sometimes.

I’d love to see some illustrated examples and/or use cases for some of the more advanced tree components, including plug ins.

This tutorial from @andheum explains it very well imho,


you are right it is about ordering everything again to the needs of each one because they know the trees and you can navigate them but at the time of restructuring and giving them another classification the common problems of the forum are generated

I also made a video tutorial that covers much of the same material: