Abstract
We present a polynomial complexity, deterministic, heuristic for solving the Hamiltonian cycle problem (HCP) in an undirected graph of order \(n\). Although finding a Hamiltonian cycle is not theoretically guaranteed, we have observed that the heuristic is successful even in cases where such cycles are extremely rare, and it also performs very well on all HCP instances of large graphs listed on the TSPLIB web page. The heuristic owes its name to a visualisation of its iterations. All vertices of the graph are placed on a given circle in some order. The graph’s edges are classified as either snakes or ladders, with snakes forming arcs of the circle and ladders forming its chords. The heuristic strives to place exactly \(n\) snakes on the circle, thereby forming a Hamiltonian cycle. The Snakes and Ladders Heuristic uses transformations inspired by \(k\)-opt algorithms such as the, now classical, Lin–Kernighan heuristic to reorder the vertices on the circle in order to transform some ladders into snakes and vice versa. The use of a suitable stopping criterion ensures the heuristic terminates in polynomial time if no improvement is made in \(n^3\) major iterations.
Similar content being viewed by others
Notes
The name stems from Sir William Hamilton’s investigations of such cycles on the dodecahedron graph around 1856, however Leonhard Euler studied the famous “knight’s tour” on a chessboard as early as 1759.
An effective implementation of L–K, for example Helsgaun’s LKH [8] could be such an algorithm.
It should be noted that modern implementations of Lin–Kernighan view sequential exchanges in a more refined sense, which permits them to construct the required 7-opt transformation.
Of course, this is guaranteed by the algorithm, but was checked nonetheless to confirm our implementation was accurate.
References
Applegate, D.L., Bixby, R.B., Chavátal, V., Cook, W.J.: Concorde TSP Solver. http://www.tsp.gatech.edu/concorde/index.html (2003)
Applegate, D.L., Bixby, R.B., Chavátal, V., Cook, W.J.: The Traveling Salesman Problem: A Computational Study. Princeton University Press, Princeton (2006)
Baniasadi, P., Clancy, K., Ejov, V., Filar, J.A., Haythorpe, M., Rossomakhine, S.: Snakes and Ladders Heuristic-Web Interface. http://fhcp.edu.au/slhweb/ (2012)
Bouwer, I.Z., Chernoff, W.W., Monson, B., Star, Z.: The Foster Census. Charles Babbage Research Center, Winnipeg (1988)
Eppstein, D.: The traveling salesman problem for cubic graphs. In: Dehne, F., Sack, J.R., Smid, M. (eds.) Algorithms and Data Structures. Lecture Notes in Computer Science, vol. 2748. pp. 307–318. Springer, Berlin (2003)
Flood, M.M.: The Traveling Salesman Problem. Oper. Res. 4, 61–75 (1956)
Gutin, G., Punnen, A.P.: Traveling Salesman Problem and Its Variations. Kluwer Academic Publishers, Boston (2002)
Helsgaun, K.: An effective implementation of Lin-Kernighan traveling salesman heuristic. Eur. J. Oper. Res. 126, 106–130 (2000)
Isaacs, R.: Infinite families of nontrivial trivalent graphs which are not Tait colorable. Am. Math. Monthly 82, 221–239 (1975)
Lawler, E.L., Lenstra, J.K., Rinooy Kan, A.H.G., Shmoys, D.B.: The Traveling Salesman Problem: A Guided Tour of Combinatorial Optimization. Wiley, New York (1985)
Lin, S.: Computer solutions of the traveling salesman problem. Bell Syst. Tech. J. 44, 2245–2269 (1965)
Lin, S., Kernighan, B.W.: An effective Heuristic algorithm for the traveling salesman problem. Oper. Res. 21, 496–516 (1973)
Royle, G., Conder, M., McKay, B., Dobscanyi, P.: Cubic symmetric graphs (The Foster Census): http://school.maths.uwa.edu.au/~gordon/remote/foster (2001)
Sheehan, J.: Graphs with exactly one hamiltonian circuit. J. Graph Theory 1, 37–43 (1977)
TSPLIB. Hamiltonian cycle problem (HCP). http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95 (2008)
Weisstein, E.W.: Generalized Petersen Graph (From MathWorld-A Wolfram Web Resource). http://mathworld.wolfram.com/generalizedpetersengraph.html
Wormald, N.: Models of random regular graphs. In: Surveys in Combinatorics, pp. 239–298. Cambridge University press, Cambridge (1999)
Acknowledgments
The authors gratefully acknowledge useful comments from the anonymous referees which improved the exposition, and useful discussions with Brendan McKay and Gordon Royle that helped us to find suitable test instances. The editor, William Cook, also contributed significantly by suggesting further testing and changes of inaccurate statements. The research presented in this manuscript was supported by the ARC Discovery Grant DP120100532.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Baniasadi, P., Ejov, V., Filar, J.A. et al. Deterministic “Snakes and Ladders” Heuristic for the Hamiltonian cycle problem. Math. Prog. Comp. 6, 55–75 (2014). https://doi.org/10.1007/s12532-013-0059-2
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s12532-013-0059-2