 # Grouping the list

Hi, everyone

Is there a way to create the list shown below on a standard node or Python script?

We also upload frustrated Python scripts.

Thank you

Home_01.dyn (2.4 KB)

It might be worth going through more than just that solution.

PauLtus san

I saw the thread you introduced.

However, the goal is to create a combination rather than sorting the list.

Therefore, as shown in the figure shown above, I would like to tell you how to generate a list like the one on the right from the given list.

Yes, but with Design Script …

``````a;
b = [Imperative]
{
c = List.Count(a);
d = {};
e = 0;
while (e < c)
{
f = 0;
g = 0;
while (g < c)
{
d[e] = a[e];
if (List.LastItem(d[e][f]) == List.FirstItem(a[g+1]))
{
f = f + 1;
d[e][f] = a[g+1];
g = -1;
}
else
{
g = g + 1;
}
}
e = e + 1;
}
return = d;
};``````
5 Likes

Vikram Subbaiah san

Design script worked as expected.
This script can check the route of piping etc.

Thank you very much for helping me.

1 Like

Sorry for misunderstanding your question then. I’m glad that @Vikram_Subbaiah was able to solve it (consider giving him a like ).

3 Likes

To do so, the script might have to be altered to check equality for objects.
Also, it might work with open loops, but might fail with closed loops.

You might also find the Grouping Curves script I’ve posted here helpful.

3 Likes

PauLtus san