Reorder lists generated by Recursion

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 (14.3 KB)

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

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


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 (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. (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). (129.6 KB)