# Creation of tree №3 using elements of tree №1 and paths of tree №2

Greetings all. I ran into a problem that I can’t solve myself.
How to use tree #1 and tree #2 to get tree #3.
In the picture I attached: red - tree, green - first level branch, blue - second level branch, black - elements. Some branches on tree #1 or #2 may be empty, but they are there, such is the structure.
The task is as follows: You need to compare each element from tree #2 (New Tree #2) with each element from tree #1. As a result you will get tree #3, in which paths are taken from New Tree #2 (New TREE #2) and elements from tree two from the corresponding branch are placed on these branches.
P.s. The number of first-level branches in both trees is the same.
P.s.s. Elements from trees one and two are unique.

Maybe there is a similar topic somewhere?

Hello,

I think this is a job for Elefront’s `Graft Parallel` (example in thread below) , but it’s very hard to tell from your description. Please attach the data trees internalized !

Yes here is the Grass file with trees #1 and #2.
As for the problem itself, here is an example: Here on trees “TREE #1 and #2” there are main branches 0, 1, 2, 3, 4, on which there are different number of elements. I want each element from the “TREE #2” branch to be compared with all elements from the corresponding main branch “TREE #1”.
So we have an element on the “New TREE #2” branch {0;0;0} that is 123. I want “TREE #3” to have all elements from the corresponding main branch of “TREE #1”.

QuestionGrass.gh (10.2 KB)

To put it simply, I need elements from “TREE #1” on the corresponding branches to be scoped as many times as elements on the corresponding branch of “TREE #2” and to have separate paths to elements from “TREE #2”.

Graft Parallel, then !

QuestionGrass.gh (16.2 KB)

1 Like

lol, it’s that simple. BUT is it somehow possible to do it without using the elefront plugin. I would like to understand if it is possible to do it by means of grasshopper itself. That way I think there will be more understanding of how the tool works.

Yes, have a look at the thread I posted above, both solutions are described. Reproducing it will be a nice exercise

Сool, thanks, best of the best of the best of the best