Given a 3D network of curves and point (root) at one of the end points of the network, I have been trying to get all the possible paths from it.

To illustrate what I mean:

Ideally after running the algorithm starting from the root I would get the following:

List A <C0, C1,C2,C4,C7>

List B <C0,C1,C3,C5,C7>

List C <C0,C1,C3,C6,C8>

Problem is I am only managing to get the following:

List A <C0,C1,C2,C4,C7,C3,C5,C6,C8>

I attach the code I have written. ( In this code as it is a 3D curve Network I add an extra condition so the path always moves up on the Z axis, meaning that at the end I would get all the connections as long as they move progressively up in Z direction)

I have been looking at some graph theory algorithms but I have not been able to decipher them.

Any help would be greatly appreciated.All possible paths.gh (8.7 KB)