# Snake-in-the-box

Last updated

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 which has been marked unusable.

## Contents

In other words, a snake is a connected open path in the hypercube where each node connected with path, with the exception of the head (start) and the tail (finish), it 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

1, 2, 4, 7, 13, 26, 50, 98 (sequence in the OEIS ).

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

0, 4, 6, 8, 14, 26, 48, 96 (sequence in the OEIS ).

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. [1]

## Related Research Articles

The travelling salesman problem asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city and returns to the origin city?" It is an NP-hard problem in combinatorial optimization, important in theoretical computer science and operations research.

Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years later.

In artificial intelligence (AI), an evolutionary algorithm (EA) is a subset of evolutionary computation, a generic population-based metaheuristic optimization algorithm. An EA uses mechanisms inspired by biological evolution, such as reproduction, mutation, recombination, and selection. Candidate solutions to the optimization problem play the role of individuals in a population, and the fitness function determines the quality of the solutions. Evolution of the population then takes place after the repeated application of the above operators.

Branch and bound is an algorithm design paradigm for discrete and combinatorial optimization problems, as well as mathematical optimization. A branch-and-bound algorithm consists of a systematic enumeration of candidate solutions by means of state space search: the set of candidate solutions is thought of as forming a rooted tree with the full set at the root. The algorithm explores branches of this tree, which represent subsets of the solution set. Before enumerating the candidate solutions of a branch, the branch is checked against upper and lower estimated bounds on the optimal solution, and is discarded if it cannot produce a better solution than the best one found so far by the algorithm.

The curse of dimensionality refers to various phenomena that arise when analyzing and organizing data in high-dimensional spaces that do not occur in low-dimensional settings such as the three-dimensional physical space of everyday experience. The expression was coined by Richard E. Bellman when considering problems in dynamic programming.

Vladimir Iosifovich Levenshtein was a Russian scientist who did research in information theory, error-correcting codes, and combinatorial design. Among other contributions, he is known for the Levenshtein distance and a Levenshtein algorithm, which he developed in 1965.

Network coding is a field of research founded in a series of papers from the late 1990s to the early 2000s. However, the concept of network coding, in particular linear network coding, appeared much earlier. In a 1978 paper, a scheme for improving the throughput of a two-way communication through a satellite was proposed. In this scheme, two users trying to communicate with each other transmit their data streams to a satellite, which combines the two streams by summing them modulo 2 and then broadcasts the combined stream. Each of the two users, upon receiving the broadcast stream, can decode the other stream by using the information of their own stream.

In graph theory, a path decomposition of a graph G is, informally, a representation of G as a "thickened" path graph, and the pathwidth of G is a number that measures how much the path was thickened to form G. More formally, a path-decomposition is a sequence of subsets of vertices of G such that the endpoints of each edge appear in one of the subsets and such that each vertex appears in a contiguous subsequence of the subsets, and the pathwidth is one less than the size of the largest set in such a decomposition. Pathwidth is also known as interval thickness, vertex separation number, or node searching number.

In graph theory, the hypercube graphQn is the graph formed from the vertices and edges of an n-dimensional hypercube. For instance, the cubical graph Q3 is the graph formed by the 8 vertices and 12 edges of a three-dimensional cube. Qn has 2n vertices, 2n−1n edges, and is a regular graph with n edges touching each vertex.

In graph theory, a mathematical discipline, a factor-critical graph is a graph with n vertices in which every subgraph of n − 1 vertices has a perfect matching.

In the mathematical area of graph theory, an induced path in an undirected graph G is a path that is an induced subgraph of G. That is, it is a sequence of vertices in G such that each two adjacent vertices in the sequence are connected by an edge in G, and each two nonadjacent vertices in the sequence are not connected by any edge in G. An induced path is sometimes called a snake, and the problem of finding long induced paths in hypercube graphs is known as the snake-in-the-box problem.

In graph theory, the cube-connected cycles is an undirected cubic graph, formed by replacing each vertex of a hypercube graph by a cycle. It was introduced by Preparata & Vuillemin (1981) for use as a network topology in parallel computing.

In mathematics, a unique sink orientation is an orientation of the edges of a polytope such that, in every face of the polytope, there is exactly one vertex for which all adjoining edges are oriented inward. If a polytope is given together with a linear objective function, and edges are oriented from vertices with smaller objective function values to vertices with larger objective values, the result is a unique sink orientation. Thus, unique sink orientations can be used to model linear programs as well as certain nonlinear programs such as the smallest circle problem.

In graph theory and theoretical computer science, the longest path problem is the problem of finding a simple path of maximum length in a given graph. A path is called simple if it does not have any repeated vertices; the length of a path may either be measured by its number of edges, or by the sum of the weights of its edges. In contrast to the shortest path problem, which can be solved in polynomial time in graphs without negative-weight cycles, the longest path problem is NP-hard and the decision version of the problem, which asks whether a path exists of at least some given length, is NP-complete. This means that the decision problem cannot be solved in polynomial time for arbitrary graphs unless P = NP. Stronger hardness results are also known showing that it is difficult to approximate. However, it has a linear time solution for directed acyclic graphs, which has important applications in finding the critical path in scheduling problems.

In graph theory, the planar separator theorem is a form of isoperimetric inequality for planar graphs, that states that any planar graph can be split into smaller pieces by removing a small number of vertices. Specifically, the removal of O(√n) vertices from an n-vertex graph can partition the graph into disjoint subgraphs each of which has at most 2n/3 vertices.

Zoltán Füredi is a Hungarian mathematician, working in combinatorics, mainly in discrete geometry and extremal combinatorics. He was a student of Gyula O. H. Katona. He is a corresponding member of the Hungarian Academy of Sciences (2004). He is a research professor of the Rényi Mathematical Institute of the Hungarian Academy of Sciences, and a professor at the University of Illinois Urbana-Champaign (UIUC).

Any-angle path planning algorithms are a subset of pathfinding algorithms that search for a path between two points in space and allow the turns in the path to have any angle. The result is a path that goes directly toward the goal and has relatively few turns. Other pathfinding algorithms such as A* constrain the paths to a grid, which produces jagged, indirect paths.

In graph theory, a branch of mathematics, an apex graph is a graph that can be made planar by the removal of a single vertex. The deleted vertex is called an apex of the graph. It is an apex, not the apex because an apex graph may have more than one apex; for example, in the minimal nonplanar graphs K5 or K3,3, every vertex is an apex. The apex graphs include graphs that are themselves planar, in which case again every vertex is an apex. The null graph is also counted as an apex graph even though it has no vertex to remove.

In the study of algorithms, an LP-type problem is an optimization problem that shares certain properties with low-dimensional linear programs and that may be solved by similar algorithms. LP-type problems include many important optimization problems that are not themselves linear programs, such as the problem of finding the smallest circle containing a given set of planar points. They may be solved by a combination of randomized algorithms in an amount of time that is linear in the number of elements defining the problem, and subexponential in the dimension of the problem.

Katalin Marton was a Hungarian mathematician, born in Budapest.

## References

• 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  [ fr ], 40: 97–116
• Allison, David; Paulusma, Daniel (2016), New Bounds for the Snake-in-the-Box Problem, arXiv:, 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,
• 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:
• 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.264259
• 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", Proceedings of the 8th Conference on 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:
• Evdokimov, A. A. (1969), "Maximal length of a chain in a unit n-dimensional cube", Matematicheskie Zametki , 6: 309–319
• Kautz, William H. (June 1958), "Unit-distance error-checking codes", IRE Transactions on Electronic Computers , EC-7 (2): 179–180, doi:10.1109/TEC.1958.5222529, S2CID   26649532
• 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 (1–3): 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 Diskretnogo Analiza (in Russian), 45: 71–76, 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, hdl: