Lets take thess points.
pt={{-4.65371,0.1},{-4.68489,0.103169},{-4.78341,0.104834},{-4.83897,0.100757},
{-4.92102,0.0949725},{-4.93456,0.100181},{-4.89166,0.1226
I posted the following comment below your question: I don't think you'll find a general solution
. This answer tries to dig a little on that.
Heike's solution seems fair, but FindShortestTour
is based on the metric properties of the set, while your requirement is probably more on the topological side.
Here is a comparison on two points sets and the methods available to FindShortestTour
:
pl[method_, k_] :=
Module[{ptsorted, pt,s},
little[x_] := {{1, 0}, {2, 1}, {1, 2}, {0, 1}}/x - (1/x) + 2;
pt = Join[{{0, 0}, {4, 4}, {4, 0}, {0, 4}}, little[k]];
ptsorted = Join[s = pt[[FindShortestTour[pt,Method->method][[2]]]], {s[[1]]}];
ListPlot[ptsorted, Joined -> True, Frame -> True,
PlotMarkers -> Automatic,
PlotRange -> {{-1, 5}, {-1, 5}},
Axes -> False, AspectRatio -> 1, PlotLabel -> method]];
GraphicsGrid@
Table[pl[i, j],
{i, {"AllTours", "CCA", "Greedy", "GreedyCycle",
"IntegerLinearProgramming", "OrOpt", "OrZweig", "RemoveCrossings",
"SpaceFillingCurve", "SimulatedAnnealing", "TwoOpt"}},
{j, {1, 1.8}}]
As you can see, several methods deliver the expected result on the left column, while only one does it on the right one. Moreover, the only useful method for the set on the right is completely off for the column on the left.