Hi,
I guess I lack some details. Anyway, From what I'm seeing , Maybe You just need to use LineCombiner transformer.
To look at this another way, it appears what is needed is instead to find lines that touch at their end points and there are no more than 2 lines touching each other at their end points, and to group them together.
This is the default behaviour of LineCombiner. This will create a List of line segments that touch each other at their end "Junction" points and the valency is no more than 2 line end points touching that Junction.
Sending the LIneCombiner output to a Counter will then put a "Group ID" integer against the groups of combined lines.