BRIEF
In long-term Grasshopper practice, I figured that approximately 80% of Grasshopper script failures stem from a fundamental issue: data structure mismatch. Consequently, a deep understanding of Grasshopper's Data Structure is important.
Grasshopper utilizes a singular data storage mechanism: the Data Tree. Based on its inherent complexity and topology, we can professionally categorize the resulting structures into three types:
Single Item
List of Items (List)
Tree of Items (Tree)
Before we dive more into them, we should understand that the two primary components for data visualization are Panel and Param Viewer. Param Viewer offers two display modes: Text Mode and Graphic Mode.
Figure 0.1 | From Left to right, they are Panel, Param Viewer in Text Mode, and Param Viewer in Graphic Mode.
Figure 0.2 | TIPS: You can quickly identify a component's data type by observing the style of the line connecting it to others.
SINGLE ITEM
A Single Item is a tree with one branch/path containing only one data item.
This type of data is a minimal data unit that stays identical, no matter if you graft or flatten it.
When Branch = 1 and N = 1, the data is a Single Item.
Figure 1.1 | It's like a piece of steak.
Figure 1.2 | Example above: when Branch = 1 and N = 1, the data is a Single Item.
List of Items (List)
A list of items is a tree with one branch/path that stores multiple sequential data items.
This type of data is the fundamental collection structure.
When Branch = 1 and N > 1, the data is a List of Items.
Figure 2.1 | It's like multiple pieces of steak in one pot.
Figure 2.2 | Example above: when Branch = 1 and N > 1, the data is a List of Items.
Tree of Items (Tree)
A tree of items is a tree with multiple branches/paths that hold one or more data items.
This type of data is a complex, hierarchical structure.
When Branch > 1 and N ≥ 1, the data is a Tree of Items.
Figure 3.1 | It's like multiple types of food in its own pot.
Figure 3.2 | Example above: each pot (path/branch) contains its own food (items)
More comprehensively,
Figure 3.3 | It's like multiple types of food with its own components in its own pot.
Figure 3.4 | Example above: each pot (path/branch) contains its own food (items), and each food has its own components.