Reorder lists generated by Recursion

Hi,
Attached, I’m struggling with reordering a list generated by a recursive algorithm.
So that all identical members take identical values.
In this example, to be able to assign the same thickness to each branch in the same generation.
Thanks for the help in advance,


Test 01.gh (14.3 KB)

See the attached definition. This is one approach to solve it by sorting by length.
image
Test 01_RI.gh (10.7 KB)

@rajaa
Thanks,
But, I have already tried “sort by length” and it does not seem to be working properly in all settings.

.

Hi,
I’m ‘python-blind’ but from the output of your component it is obvious that the lines are not grouped by generations.
I think you have two options:

  • change the code so that the lines come grouped by generation.
  • change the code so that each new generation of lines is shorter than the previous (that way you can use Rajaa’s elegant solution)

See attached, I sorted by list length, which indicates the generation. I hope this helps.
Test 01_RI2.gh (15.5 KB)

But not C#-blind I do hope (cross fingers).

Get a proper Entry Level Recursion (NEVER use Lists, ALWAYS use Trees and global vars) in a proper language and be a proper happy bunny.

Recursion_LSTree_V1.gh (124.7 KB)

et sic sonat gay!!!

check what this means according to Google Translate (language Catalan)

Yikes + Yikes + … + Yikes (1M Q: was that a typo?)

Don’t think > act > just open the def and take the challenge (only for the brave).

Recursion_LSTree_V1A_ForTheBrave.gh (129.6 KB)

hahahahahaha