Cutting and connecting lines with surface in grasshopper

This is a simplified example but I working on a project where I need to cut a bunch of lines based on a custom surface. These cut lines then need to be reconnected to one another on that surface. Is there anyway to find all of the end nodes that were cut and connect them with other lines? I’m mostly working in grasshopper, if this is possible there that would be huge.

See image for more details.

For less details you mean (nothing attached).

Anyway since a truss is a nothing thing without connectivity (VV, VE, EV trees) you should use that type of data for connecting things.