The snake-in-the-box problem in graph theory and computer science deals with finding a certain kind of path along the edges of a hypercube. This path starts at one corner and travels along the edges to as many corners as it can reach. After it gets to a new corner, the previous corner and all of its neighbors must be marked as unusable. The path should never travel to a corner after it has been marked unusable.
In other words, a snake is a connected open path in the hypercube where each node in the path, with the exception of the head (start) and the tail (finish), has exactly two neighbors that are also in the snake. The head and the tail each have only one neighbor in the snake. The rule for generating a snake is that a node in the hypercube may be visited if it is connected to the current node and it is not a neighbor of any previously visited node in the snake, other than the current node.
In graph theory terminology, this is called finding the longest possible induced path in a hypercube; it can be viewed as a special case of the induced subgraph isomorphism problem. There is a similar problem of finding long induced cycles in hypercubes, called the coil-in-the-box problem.
The snake-in-the-box problem was first described by Kautz (1958), motivated by the theory of error-correcting codes. The vertices of a solution to the snake or coil in the box problems can be used as a Gray code that can detect single-bit errors. Such codes have applications in electrical engineering, coding theory, and computer network topologies. In these applications, it is important to devise as long a code as is possible for a given dimension of hypercube. The longer the code, the more effective are its capabilities.
Finding the longest snake or coil becomes notoriously difficult as the dimension number increases and the search space suffers a serious combinatorial explosion. Some techniques for determining the upper and lower bounds for the snake-in-the-box problem include proofs using discrete mathematics and graph theory, exhaustive search of the search space, and heuristic search utilizing evolutionary techniques.
Known lengths and bounds
The maximum length for the snake-in-the-box problem is known for dimensions one through eight; it is
Beyond that length, the exact length of the longest snake is not known; the best lengths found so far for dimensions nine through thirteen are
- 190, 370, 712, 1373, 2687.
For cycles (the coil-in-the-box problem), a cycle cannot exist in a hypercube of dimension less than two. the maximum lengths of the longest possible cycles are
Beyond that length, the exact length of the longest cycle is not known; the best lengths found so far for dimensions nine through thirteen are
- 188, 366, 692, 1344, 2594.
Doubled coils are a special case: cycles whose second half repeats the structure of their first half, also known as symmetric coils. For dimensions two through seven the lengths of the longest possible doubled coils are
- 4, 6, 8, 14, 26, 46.
Beyond that, the best lengths found so far for dimensions eight through thirteen are
- 94, 186, 362, 662, 1222, 2354.
For both the snake and the coil in the box problems, it is known that the maximum length is proportional to 2n for an n-dimensional box, asymptotically as n grows large, and bounded above by 2n-1. However the constant of proportionality is not known, but is observed to be in the range 0.3 - 0.4 for current best known values.
- Abbot, H. L.; Katchalski, M. (1988), "On the snake in the box problem", Journal of Combinatorial Theory, Series B, 45: 13–24, doi:10.1016/0095-8956(88)90051-2
- Abbot, H. L.; Katchalski, M. (1991), "On the construction of snake-in-the-box codes", Utilitas Mathematica, 40: 97–116
- Allison, David; Paulusma, Daniel (2016), New Bounds for the Snake-in-the-Box Problem, arXiv:1603.05119, Bibcode:2016arXiv160305119A
- Bitterman, D. S. (2004), New Lower Bounds for the Snake-In-The-Box Problem: A Prolog Genetic Algorithm and Heuristic Search Approach (PDF), M.S. thesis, Department of Computer Science, University of Georgia
- Blaum, Mario; Etzion, Tuvi (2002), Use of snake-in-the-box codes for reliable identification of tracks in servo fields of a disk drive, U.S. Patent 6,496,312
- Casella, D. A.; Potter, W. D. (2005), "Using Evolutionary Techniques to Hunt for Snakes and Coils", 2005 IEEE Congress on Evolutionary Computation (CEC2005), 3, pp. 2499–2504
- Casella, D. A. (2005), New Lower Bounds for the Snake-in-the-Box and the Coil-in-the-Box Problems (PDF), M.S. thesis, Department of Computer Science, University of Georgia
- Danzer, L.; Klee, V. (1967), "Length of snakes in boxes", Journal of Combinatorial Theory, 2 (3): 258–265, doi:10.1016/S0021-9800(67)80026-7
- Davies, D. W. (1965), "Longest 'separated' paths and loops in an N-cube", IEEE Transactions on Electronic Computers, EC-14 (2): 261, doi:10.1109/PGEC.1965.264262
- Deimer, Knut (1985), "A new upper bound for the length of snakes", Combinatorica, 5 (2): 109–120, doi:10.1007/BF02579373
- Diaz-Gomez, P. A.; Hougen, D. F. (2006), "The snake in the box problem: mathematical conjecture and a genetic algorithm approach", Proc. 8th Conf. Genetic and Evolutionary Computation, Seattle, Washington, USA, pp. 1409–1410, doi:10.1145/1143997.1144219
- Douglas, Robert J. (1969), "Upper bounds on the length of circuits of even spread in the d-cube", Journal of Combinatorial Theory, 7 (3): 206–214, doi:10.1016/S0021-9800(69)80013-X
- Evdokimov, A. A. (1969), "Maximal length of a chain in a unit n-dimensional cube", Matematicheskie Zametki, 6: 309–319
- Kautz, William H. (1958), "Unit-distance error-checking codes", IRE Transactions on Electronic Computers, 7: 177–180
- Kim, S.; Neuhoff, D. L. (2000), "Snake-in-the-box codes as robust quantizer index assignments", Proceedings of the IEEE International Symposium on Information Theory, p. 402, doi:10.1109/ISIT.2000.866700
- Kinny, D. (2012), "A New Approach to the Snake-In-The-Box Problem", Proceedings of the 20th European Conference on Artificial Intelligence, ECAI-2012, pp. 462–467
- Kinny, D. (2012), "Monte-Carlo Search for Snakes and Coils", Proceedings of the 6th International WS on Multi-disciplinary Trends in Artificial Intelligence, MIWAI-2012, pp. 271–283
- Klee, V. (1970), "What is the maximum length of a d-dimensional snake?", American Mathematical Monthly, 77 (1): 63–65, doi:10.2307/2316860, JSTOR 2316860
- Kochut, K. J. (1996), "Snake-in-the-box codes for dimension 7", Journal of Combinatorial Mathematics and Combinatorial Computing, 20: 175–185
- Lukito, A.; van Zanten, A. J. (2001), "A new non-asymptotic upper bound for snake-in-the-box codes", Journal of Combinatorial Mathematics and Combinatorial Computing, 39: 147–156
- Paterson, Kenneth G.; Tuliani, Jonathan (1998), "Some new circuit codes", IEEE Transactions on Information Theory, 44 (3): 1305–1309, doi:10.1109/18.669420
- Potter, W. D.; Robinson, R. W.; Miller, J. A.; Kochut, K. J.; Redys, D. Z. (1994), "Using the genetic algorithm to find snake in the box codes", Proceedings of the Seventh International Conference on Industrial & Engineering Applications of Artificial Intelligence and Expert Systems, Austin, Texas, USA, pp. 421–426
- Snevily, H. S. (1994), "The snake-in-the-box problem: a new upper bound", Discrete Mathematics, 133: 307–314, doi:10.1016/0012-365X(94)90039-6
- Solov'eva, F. I. (1987), "An upper bound on the length of a cycle in an n-dimensional unit cube", Metody Diskret. Analiz. (in Russian), 45: 71–76 and 96–97
- Tuohy, D. R.; Potter, W. D.; Casella, D. A. (2007), "Searching for Snake-in-the-Box Codes with Evolved Pruning Models", Proceedings of the 2007 Int. Conf. on Genetic and Evolutionary Methods (GEM'2007), Las Vegas, Nevada, USA, pp. 3–9
- Wojciechowski, J. (1989), "A new lower bound for snake-in-the-box codes", Combinatorica, 9 (1): 91–99, doi:10.1007/BF02122688
- Yang, Yuan Sheng; Sun, Fang; Han, Song (2000), "A backward search algorithm for the snake in the box problem", Journal of the Dalian University of Technology, 40 (5): 509–511
- Zémor, Gilles (1997), "An upper bound on the size of the snake-in-the-box", Combinatorica, 17 (2): 287–298, doi:10.1007/BF01200911
- Zinovik, I.; Kroening, D.; Chebiryak, Y. (2008), "Computing binary combinatorial gray codes via exhaustive search with SAT solvers", IEEE Transactions on Information Theory, 54 (4): 1819–1823, doi:10.1109/TIT.2008.917695
- Kinny, David. (2012). "Snake-in-the-Box Research Page (Kyoto University)".
- Potter, W. D. (2011). "A list of current records for the Snake-in-the-Box Problem (UGA)".