With the missing piece from How do I "read out" the vertex names on this graph? I can self-answer using Nearest
and Graph
. Please don't let this post discourage answering as I am eager to see other approaches.
Now as a function with at least a little reusability. The second parameter is the search radius.
order[data_, rad_: 0.0001] := Module[{dd, near, g},
dd = Join @@ data;
near = Nearest[dd -> Automatic, dd, {2, rad}] ~Cases~ {_, _};
g = near ~Join~ Partition[Range @ Length @ dd, 2] // Graph;
FindPath[g, ##][[1]] & @@ GraphPeriphery[g]
]
ListLinePlot[Part[Join @@ dat, order[dat]], Frame -> True]
It works on the set with gaps given a sufficient radius:
ListLinePlot[Part[Join @@ dat2, order[dat2, 0.0001]], Frame -> True]
The next step in improving this would be to extract direction data from the output of order
to apply to full lines.