Parametrize Join Component

Hi everybody
I try to multiply the following drawing in a rectangular grid and at the end I would like to join the curves so as to keep the continuity as explained in the picture below. I tested different ways but I can not.
I do not want the curves of the same branch to be joined, and I want it to privilize the continuity of the curves in the junction.
I dont know if there is a way to do this.
Thank you in advance for your help.

Pattern

Join-Array-Pattern.gh (28.4 KB)

The long way home is to take this as a given, treat it as a line graph and start doing tricks with connectivity (VV, VE, EV etc). But is kinda like reinventing the wheel since the possibilities and variations (therefor the loop(s) seach logic) are rather numerous.

The short way is to create your loops (as shown or other) with some sort of logic at the grid creation phase.

Thank you Peter for your reply.
Depending on the complexity of the drawing it should be more and more difficult.
I would like to know how to exclude the junction of the curves which belong to the same branch.
Thank you

If you create some sort of modular mini graphs (in a given branch) and ask from the stupid (for the moment) part (the computer) to find some suitable combos … this means indeed a lot of questions (far easier via code but still reinventing the wheel).

If I was you I would attack this via recursion on grid points (a freaky technique where a Method calls itself) that could yield “similar” stuff … but this requires code and I guess is not the solution for you. That said working with native components is not my forte (at all) and thus I/m not the right person to provide some acceptable solution.

Ok thanks

Another way to reinvent the wheel could be to find all the regions due to all ccx Curve/Curve events (rather nighmare without code [or at best very slow]) and then … er … start asking questions and joining Breps (or Region Curves).

Kinda like 3rd marriage if you ask me.

Thanks for explanation and the time spent