This is my approach to solve this problem without simulations. Let's give it a name - Constrained Shortest Path.
In summary, the idea is to force a path [edge selection] via iteration of the Shortest Path algorithm that passes through select set of points (in ascending index number order) from a Mesh grid, giving the resulting path a tangled cable appearance.
Here is the result so far:
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/5l2Os.png)
The Mesh grid will be added for clarity. As you can see holes are implemented via points deletion using a control Empty object.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/zKvx6.png)
Here is the node set up, however it is too complicated to explain in detail here. A .blend file is provided at the end of the post for your own studies.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/JGkHY.png)
Here is the short description:
- Initial Point selection - Select points from the Mesh plane via random value generation to speed up the testing process. As it is hard to control the exact number of selected points or generate a good point distribution this way other methods for selection initializing should be considered.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/hImxt.png)
- Plane with Hole(s) - this is the mesh from which we select the initial points. The plane has an option for vertex deletion (single hole) . The hole widens with scaling the Empty object.
There are few types of input Geometry grids tested:
- Ordered quad grid - separate object, when the random points are connected they produce a zig-zag like pattern and are not a good candidate.
- Quad grid - separate object with vertex index randomization
- Triangulated grid via modifiers - the host Plane object with modifiers stack before the Geometry Nodes modifier.
- Triangulated grid - separate object with vertex index randomization
Here is a comparison:
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/FBnM9.jpg)
All grids are available for testing in the file
- Elevate the initial point selection - The selected points are moved slightly above the surface, the end points - even higher.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/3gy4C.png)
- Shortest Edge Path Modules - The process is as follows:
a) Select first two vertices from the selection (in ascending order) - Output shortest path via curve
b) Remove the smaller index vertex from the selection.
c) Pass the resulting selection to the next module.
d) Repeat the process.
There are 1+20 operations currently. The file will work best with about 21 selected vertices or less. Add more modules for larger number of selected vertices.
Blender 3.6 doesn't have looping nodes, A Repeat zone is expected to be released in Blender 4.0. This will make the iteration over repetitive processes so much easier.
- Distribute Mesh Line on Paths - All generated paths are joined in specific order so the indices are in ascending order. A Mesh Line is generated to match the point count of the curve and the positions of these points thus forming a continuous single thread. The Mesh Line is then converted to Curve.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/niFIR.png)
6 Randomize slightly Z positions - just to decrease the amount of overlapping points due to path backtracking.
7 Resampled Auto Handle Curve to Cable - giving the curve a Bezier type with Automatic point handles gives best cable like appearance. Lastly a simple Curve to Mesh node is applied to generate the cable.
You are welcome to explore the .blend file:
![](https://cdn.statically.io/img/blend-exchange.com/embedImage.png?bid=WWvwpAYV)
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/eRDIm.gif)
Edit: As requested by @vklidu I am including the setup for the upcoming Blender v4.0 using the Utilities > Repeat Zone instead of connecting / removing modules for different amount of selected points:
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/T7tRX.png)
and a close-up:
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/S5CkX.png)
You can change the number of Iterations manually or plug the number of selected points to control it automatically.
This should work for Blender Versions 4+. I can't guarantee the Repeat Zone will change after release, but it is most likely to remain the same.