Introduction. Donald Knuth in his book Combinatorial Algorithms works with an example graph consisting of the 48 state capitals (excluding Hawaii and Alaska), with the normal driving distances between them. A path in a graph is a sequence of vertexes, each connected to the next with an edge. A simple path includes each vertex at most once. A Hamiltonian path includes each vertex exactly once. (Of course neither of these last two kinds of paths can cross themselves.) Finding a Hamiltonian path in a graph is an NP-complete problem. (The meaning of this will be discussed elsewhere, but in simple terms, such problems are considered intractable.) Knuth used extremely sophisticated and powerful tools (mostly tools developed by others) to arrive at his results. Data About Paths. Any Hamiltonian path in this example must clearly start or end at ME. Knuth first considered paths from ME to CA. His tools told him that there are 437,525,772,584 distinct simple paths from ME to CA. The longest such paths are Hamiltonian, and he could show that there are 2,707,075 of them. Then he considered Hamiltonian paths from ME to any other vertex. (A few final vertexes would be impossible.) He could show that there are 68,656,026 Hamiltonian paths from ME to any other vertex. Of these, it turns out that there is a unique longest one (of length 18040 miles) and a unique shortest one (of length 11698 miles), each ending at WA. In addition to finding the longest and shortest Hamiltonian paths, Knuth was able to calculate the average path length over all 68,656,026 paths, which is 14886.01 miles, with standard deviation 666.2. Ordinary brute-force techniques would be completely inadequate to solve these problems. Pictures of the longest path and shortest path are given below. I also included another ("random") Hamiltonian path as a third example. ![]() Longest Hamiltonian path, with length 18040 miles (Click picture or here for a full size image) ![]() Shortest Hamiltonian path, with length 11698 miles (Click picture or here for a full size image) ![]() Random Hamiltonian path, with length 13619 miles (Click picture or here for a full size image) |