Data tree riddle

I think my brain is frozen today and I can’t solve it.
I have to build a tree structure (TARGET) where each item from the SOURCE tree is replaced with respective paths from the ITEM tree:


More or less the intention is shown using set elements (if only this accepted multiple items).
The empty branches must remain.
Internalized data attached.
data tree trouble.gh (7.3 KB)
I’m sure the solution is simple, just not for me today.
I could join-split the text but it is stupid af.

should the values on this tree be perpetually incremental?
like {0} starts with 16, {1} starts with 17, {2} starts with 18
so {3} starts with 19 and so on?

are you aware the tree matching will be something like:

Nope. Consider both as everchanging list.
The item from the second list becomes a content of the path from the first list.
I have managed to solve it with text join-split and the result is what I expect:


but is it really way to go?

On the other hand, it’s ain’t stupid if it works :sweat_smile:

1 Like

if the two lists have the very same number of branches and structure, a simple List Item should do the job :slight_smile:

here I have simulated the lists having same branches with Tree Stats + Tree Branch, but it won’t be necessary in your original -complete- data if the number of paths is already matching:

just List Item with L input from “ITEMS TO REPLACE WITH” and i input from “SOURCE TREE”

The point is the have the structure represented on attached image in a previous post. No shortcuts.

I agree, it seems weak and fragile. Watching this thread because I often encounter similar problems in GH, with not much apparent complexity upstream, and expect there are smarter ways to handle data with components instead of tinkering with fixed text strings

I think I’m not catching the point

@Piotr if you don’t mind to post a single set of your data in such a way it’s a complete set that we can see in our GH, with the solution you have also found yourself with Split Text, it would be very useful!

It’s not that bad. I love thinking and finding solutions, and I like learning, therefore, sometimes, I post my struggles.

Hi Inno

Have a look at the tall image for answer and guide.
The content of the path from first tree {0}, {1} or {2} should replace the value 0,1 or 2 in the second tree respectively.

1 Like

ahhhhhh now I got it, you want he whole content of each Branch :+1:

if you are open to plugins like the -awesome- Metahopper, the Wrap List component can group anything (not just geometries), in such a way you can effectively List Item on Paths directly (eventually Trim Tree at the end if you are ok on having items from different paths in the same branch, or not)

this is the same approach as the one you used, but instead of joining and splitting text items, it wraps them

data tree trouble_Metahopper_WrapList.gh (14.9 KB)

you can get at the very same result using just vanilla components:

data tree trouble_Vanilla.gh (16.3 KB)


[edit]

of course here you can put anything as data to be duplicated, as you are just interested in the tree structure to be used with Unflatten, not at all about its content:

[/edit]


as comparation, final data structure from Vanilla (V) and Metahopper (M) :

2 Likes

Metahopper was not an option but I really admire the solution based on a vanilla component.
Create fake tree to use it as a guide - bravissimo :slight_smile:
Thanks for your time.

2 Likes