… it may even be the source (or result) of this thread?
This thread predates the project you mentioned; won’t say more than that.
To find a valid ordering for a large amount of pegs, find the concave hull of the point set (versus finding a Hamiltonian cycle, which is very slow).
I respectfully beg to differ. This statement is questionable, if not false, on several counts:
-
A concave hull is an envelope in the shape of a concave polygon that encompasses all the points. It does not necessarily have to pass through every point. The one showed in your example, however, seems to be a variant (a very special case) of a concave hull that visits each and every point in the set before returning to the starting point. Note that this is the perfect definition of a Hamiltonian cycle. As a matter of fact, the special concave hull you are showing is an example of a Hamiltonian cycle, so comparing / opposing them isn’t really relevant.
-
A “valid” ordering does not depend on any particular procedure. As we’ve already discussed here, any technique that finds a non-intersecting Hamiltonian cycle is appropriate (yours included!). A few other examples could include:
- circular sorting with 2-opt
- horizontal sorting with 2-opt
- angular sorting
- shortest path approximation (TSP) (*a shortest path never crosses itself)
Although these approaches have distinct objectives, they all share the common goal of addressing a route optimization problem, which specifically involves finding a cycle that visits each point exactly once without any intersection.
I have a personal preference for the last suggestion. Focusing on reducing the total distance traveled allows for the generation of solutions that are visually more homogeneous, likely aligning with Armin Hofmann’s intentions. This also seems more appropriate for applications in graphic design.
side note: I can’t help but think of Bruno Munari’s work, particularly his book ‘Flight of Fancy’ (1982), where he takes a single point cloud and transforms it into multiple different shapes by varying the connections, demonstrating how one can interpret the same raw information in numerous ways.
-
Unless your goal is to enumerate a set of solutions (all possible permutations of a set of points), speed is hardly an issue. For the successive generation of a single solution, the problem does not arise. Some of the techniques mentioned above are likely even faster than the one you’re presenting. Even in the case of the Shortest Path approximation and with moderately sized instances (a few thousand points), a simple metaheuristic algorithm such as Simulated Annealing with just two operators (”swap” and “transport”) can find a solution in just a few hundred milliseconds (in Python). For even larger instances, you can still resort to the Concorde solver (world record: 85 900 cities / pegs in .06 seconds).
side note: Regarding this, I can only recommend reading ‘In Pursuit of the Traveling Salesman’ by William J. Cook (the brain behind the Concorde algorithm). I found his way of simplifying some basic computer science concepts very effective, and the book is filled with anecdotes about the historical context of the TSP and the algorithmic challenges associated with it. At least, if you can, try watching this recording of one of his public talks, which is very engaging (informative, full of visuals and funny).
Following the popularity of this thread and a few questions I had received privately, I wrote a comprehensive blog post on the topic, which I illustrated with code and some personal work (2D/3D abstract visuals, lots of renderings, and typographic work). Unfortunately, I encountered some technical issues and this site is no longer online today. Moreover, I was bitterly disappointed to see that some of the visuals I had posted had ‘inspired’ some individuals who subsequently published strikingly similar works without ever bothering to cite their source. I have nothing against copying; in fact, I am even flattered by it, but it seems to me that referencing one’s sources of inspiration, even subtly, is a matter of basic courtesy.
I hope one day to find the courage to rebuild this website and to share this work with those who are interested.