Data Combination Holistic?

Hi,

I have to lists A and B. List A has “a” branches and List B has “b” branches. Each branch holds a random number of items. In the example case (see attached my .gh file.), each branch of List A has N=284, whereas N=1 for branches of List B. N might differ from branch to branch within the same List.

What I ultimately want is to generate two output lists, both with “a x b” branches. Both outputs, when placed side by side, would define all possible combinations between the branches of List A and the branches of List B. But, in a specific order/way. As such:

  • The list generated from List A would be the 1st branch of A, repeated “b” times. Then, the the 2nd branch of A repeated “b” times, followed by the 3rd branch of A repeated “b” times and so one.

  • As for the list generated from B, its 1st “b” branches (branches from 0 to “b-1”) would be the same as List B. From branch “b” to “2xb -1”, we would have another repetition of List B, until we would have “a” repetitions of List B.

I’ve been playing with the Holistic component but the problem is that I can’t achieve this specific order and, more importantly, the number of items per branch from the original Lists are not being kept…

Thanks

Data Combination.gh (17.0 KB)

To make it simpler, with an example output considering List A with 2 branches (a1 and a2) and List B with only 3 branches (b1, b2, b3), instead of 20.

As you can see, the number of items inside each branch is equal to those of the original lists.

this is the very first thing that came to my mind, I don’t exclude there might be even simpler ways to do the same

Data Combination_inno.gh (14.2 KB)

1 Like

Hi Inno,

I had never played with the maintain/renumber options within the Branch Component! Thanks for that.

However, it is not quite right yet, I think… This is what you proposal achieves (in my new .gh file, I changed the size of List B to 3 branches to reduce complexity):

This is what I intend (same as my previous post):


Data Combination.gh (18.6 KB)

Oh, yes, you can remove the “Series” components and use directly the “P” output of Tree Statistics components… that way it should work with any tree structure.

2 Likes

you are right, I didn’t really double check the order of branches… sorry for that

in simple words:
you want to repeat each single branch in A, times {number of branches in B}
and
repeat the whole data structure in B, times {number of branches in A}

the number of items in each branch doesn’t really matter because entire branches are just repeated/duplicated “as they are”

Data Combination_inno_corrected.gh (15.2 KB)

but I think Riccardo’s solution is -as always- more elegant :slight_smile:

2 Likes

Thanks @inno and @maje90! Quite helpful!

1 Like