Checking if two curves are connected

This question departs from my old post here, in which I was trying to get the polycurves of a surface with holes. The suggested steps involve “Group the curves and create new polycurves from the groups”, which I am trying to implement myself. My approach uses PolyCurve.ByJoinedCurves to see if I can make a polycurve from two curves; if it raises an exception, they are not connected. However, it turned out that my assumption was wrong. The example below highlights two connected curves of a tubular surface, but they cannot be joined by this node. So I am wondering if there is a better way to detect the connection.

Many thanks,


Sorry…just realised that Geometry.DoesIntersect seems to do the job. Will check this first.