# 骑士巡游

骑士巡游是指国际象棋中的骑士在棋盘上的一系列走法，骑士恰好访问每个格子一次。当最后一个格子与起始格子之间也是一步骑士走法，使得整条路径可以闭合成环时，该巡游称为闭合巡游或可重入巡游；否则称为开放巡游。<sup>[1](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)</sup> 用图论术语来说，棋盘的格子是顶点，合法的骑士走法是边，巡游便是这个骑士图中的一条哈密顿路径；闭合巡游则是一条哈密顿回路。<sup>[2](https://www.combinatorics.org/ojs/index.php/eljc/article/download/v3i1r5/8358/)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 骑士恰好访问棋盘每个格子一次的路径；若最后一格与第一格之间是一步骑士走法，则为闭合巡游<sup>[1](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)</sup> |
| 图论表述 | 骑士图中的哈密顿路径（开放巡游）或哈密顿回路（闭合巡游）<sup>[2](https://www.combinatorics.org/ojs/index.php/eljc/article/download/v3i1r5/8358/)</sup> |
| 8×8 棋盘上的闭合巡游 | 13,267,364,410,532 条无向巡游；在旋转和反射下共有 1,658,420,855,433 个等价类（麦凯，1997）<sup>[2](https://www.combinatorics.org/ojs/index.php/eljc/article/download/v3i1r5/8358/)</sup> |
| 8×8 棋盘上的开放巡游 | 估计约有 1.22 × 10^15 条几何上不同的巡游（坎塞拉与莫尔德基，随机化沃恩斯多夫采样）<sup>[3](https://arxiv.org/abs/math/0609009)</sup> |
| 矩形棋盘 | 施文克（1991）精确刻画了哪些 m × n 棋盘（m ≤ n）存在闭合巡游<sup>[4](https://www.ams.org/bookstore/pspdf/mbk-63-prev.pdf)</sup> |
| 算法 | 回溯法为指数时间；沃恩斯多夫规则（1823）是一种快速启发式方法；康拉德等人（1994）给出了 n × n 棋盘（n ≥ 5）的线性时间构造<sup>[1](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)</sup><sup> • </sup><sup>[5](https://mathworld.wolfram.com/KnightGraph.html)</sup> |
| 复杂性 | 在矩形棋盘上判定巡游是否存在可在常数时间内完成，但在带洞棋盘和连通棋盘上是 NP 难的<sup>[6](https://arxiv.org/abs/2606.29153)</sup> |

## 历史

这个问题很古老。它出现在九世纪的印度和阿拉伯手稿中，并作为国际象棋谜题在中世纪流传。<sup>[1](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)</sup> 现代数学研究始于莱昂哈德·欧拉（Leonhard Euler），他于 1759 年处理了这个“无法用分析法处理的奇特问题”并详细给出了自己的解法；他提交给柏林科学院的论文直到 1766 年才付印。<sup>[1](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)</sup><sup> • </sup><sup>[7](https://mayhematics.com/t/1b.htm)</sup> 早在 840 年，一份早期文献中就已经给出了这个谜题的一个解。<sup>[8](https://assets.press.princeton.edu/chapters/s10314.pdf)</sup>

巡游计数出现得更晚，而且比寻找巡游更难。欧拉只指出巡游的数量非常巨大。C. F. von Jaenisch 在 1862 年论证说，由于 8 × 8 棋盘上完整的骑士走法网络包含 168 步走法，而一条开放巡游使用其中 63 步，因此开放巡游的一个上界是二项式系数 \( \binom{168}{63} \)，按 Dawson 1922 年的计算约为 1.22 × 10<sup>47</sup>，这个高估值包含了不像巡游的模式。<sup>[9](https://www.mayhematics.com/t/8a.htm)</sup>

## 8 × 8 棋盘上的巡游计数

标准棋盘上闭合巡游的精确数量由澳大利亚国立大学计算机科学系的布伦丹·D. 麦凯（Brendan D. McKay）在 1997 年的一份技术报告中确定。他的计算发现 13,267,364,410,532 条无向闭合巡游，即不区分正反方向的巡游，以及在棋盘旋转和反射下 1,658,420,855,433 个等价类。<sup>[2](https://www.combinatorics.org/ojs/index.php/eljc/article/download/v3i1r5/8358/)</sup> 该方法将每条巡游沿棋盘中线分成上半巡游和下半巡游，每一半都是半个棋盘上的一组顶点不相交路径，然后计算半巡游对如何跨中线连接；枚举 70,433,448 条半巡游及其 7,934,470 种路径结构花费了约六小时的回溯计算。<sup>[2](https://www.combinatorics.org/ojs/index.php/eljc/article/download/v3i1r5/8358/)</sup>

**对称巡游。** 大多数闭合巡游属于八个一组的集合，这些巡游在旋转和反射下相同。麦凯发现 1,658,420,247,200 个大小为 8 的等价类和 608,233 个大小为 4 的等价类，后者是具有对称性的巡游；两者之和给出 1,658,420,855,433 条本质不同的巡游。斯坦福大学计算机科学荣休教授唐纳德·E. 克努特（Donald E. Knuth）曾在 1993 年的一封信中给出 608,233 条对称闭合巡游的计数，麦凯的计算证实了这一点。<sup>[9](https://www.mayhematics.com/t/8a.htm)</sup><sup> • </sup><sup>[10](https://cs.stanford.edu/~knuth/fasc8a.pdf)</sup>

**一个修正后的计数。** M. Löbbing 和 I. Wegener（1996）此前的计算给出 33,439,123,484,294 条无向巡游，这个值不可能正确，因为它不能被 4 整除；正确的值 13,267,364,410,532 出现在韦格纳随后于 2000 年出版的著作中，并与麦凯的独立计算一致。<sup>[5](https://mathworld.wolfram.com/KnightGraph.html)</sup> 根据已确认的图计数，可重入巡游编号的数量为 106,138,915,284,256。<sup>[9](https://www.mayhematics.com/t/8a.htm)</sup>

**开放巡游。** 开放巡游的精确数量尚不清楚。乌拉圭共和国大学的研究人员埃克托尔·坎塞拉（Héctor Cancela）和埃内斯托·莫尔德基（Ernesto Mordecki）使用沃恩斯多夫规则的随机化版本进行重要性采样，并以较小棋盘上已知的精确计数进行校准，估计几何上不同的开放巡游数量为 \( \mathbf{G} = 1.22 \times 10^{15} \)。他们的实验还表明，违反沃恩斯多夫规则 5 到 20 次的巡游占所有解的 99.9892%，因此全程遵循该规则的巡游比总体巡游稀少好几个数量级。<sup>[3](https://arxiv.org/abs/math/0609009)</sup>

## 哪些棋盘存在巡游

在标准 8 × 8 棋盘上巡游大量存在，但更小和形状不同的棋盘则限制较多。3 × 3 棋盘根本没有巡游：它的骑士图使中心格子孤立。在 4 × 4 棋盘上，每个格子都至少与另外两个格子相连，但该图虽然连通却没有哈密顿路径，最长路径只覆盖 15 个格子。<sup>[20](https://www.dlib.si/stream/URN%3ANBN%3ASI%3Adoc-V2Z5F9ZG/eab909ad-341f-45c7-bb1b-9926f39bbfd3/PDF)</sup> 存在巡游的最小方形棋盘是 5 × 5，其中奇偶性要求骑士从行号加列号为偶数的格子出发；5 × 5 棋盘总共有 1,728 条巡游路径，其中 8 条是对称的。<sup>[11](https://www.slac.stanford.edu/pubs/slacpubs/0250/slac-pub-0261.pdf)</sup><sup> • </sup><sup>[5](https://mathworld.wolfram.com/KnightGraph.html)</sup>

对于矩形棋盘，闭合巡游问题由艾伦·施文克（Allen Schwenk）在 1991 年完全解决。m × n 棋盘（m ≤ n）存在闭合骑士巡游，除非以下三个条件中至少一个成立：m 和 n 均为奇数；m = 1、2 或 4；或 m = 3 且 n = 4、6 或 8。<sup>[4](https://www.ams.org/bookstore/pspdf/mbk-63-prev.pdf)</sup> 当闭合巡游存在时，任何格子都可以作为起点。<sup>[4](https://www.ams.org/bookstore/pspdf/mbk-63-prev.pdf)</sup>

骑士图的结构解释了其中一些现象。在 8 × 8 棋盘上，336 条有向连接给出平均每格略多于五步走法，随着棋盘增大平均值趋近八，但角格始终只有两步走法。<sup>[11](https://www.slac.stanford.edu/pubs/slacpubs/0250/slac-pub-0261.pdf)</sup>

## 算法

朴素回溯法——随机选择走法并在死胡同时回退——只要存在巡游就总能找到，但非常慢；搜索树是指数级的，在 5 × 5 棋盘上约有 \( 3.8^{25} \) 个节点，在 8 × 8 棋盘上按实测分支因子约有 \( 1.3 \times 10^{46} \) 个节点。<sup>[1](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)</sup><sup> • </sup><sup>[12](https://runestone.academy/ns/books/published/pythonds3/Graphs/KnightsTourAnalysis.html)</sup>

**沃恩斯多夫规则。** 1823 年，H. C. 沃恩斯多夫（H. C. Warnsdorff）提出规则：骑士应始终移动到后续走法最少的未访问格子，走法数相同时任意选择。这是一种贪心启发式方法，而非保证成功的算法，而且在其提出 150 年后才首次被报告失败，但它在实践中非常有效；一个实现首次尝试便在 100 × 100 棋盘上约 0.07 秒内找到了一条巡游。<sup>[1](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)</sup><sup> • </sup><sup>[3](https://arxiv.org/abs/math/0609009)</sup><sup> • </sup><sup>[13](https://github.com/wisn/knights-tour)</sup> 一项对 8 × 8 棋盘上骑士走法优先级所有 8! 种排序的系统分析，量化了该规则在走法数相同时所作的选择导致非哈密顿路径的频率。<sup>[14](https://arxiv.org/abs/0803.4321)</sup>

**线性时间构造。** 阿克塞尔·康拉德（Axel Conrad）、坦娅·欣德里希斯（Tanja Hindrichs）、侯赛因·莫尔西（Hussein Morsy）和英戈·韦格纳（Ingo Wegener）于 1994 年发表了一种线性时间算法，解决棋盘上的哈密顿路径问题，并证明对所有 n × n 棋盘（n ≥ 5）正确；该算法将棋盘分解为已知显式解的较小棋盘。<sup>[5](https://mathworld.wolfram.com/KnightGraph.html)</sup><sup> • </sup><sup>[15](https://portal.mardi4nfdi.de/wiki/Solution_of_the_knight%27s_Hamiltonian_path_problem_on_chessboards)</sup> 更近的工作优化巡游而不仅仅是寻找巡游：一种线性时间、完全可并行化的算法在 n × n 棋盘上构造闭合巡游，至多有 \( 9.5n + O(1) \) 个转弯和 \( 13n + O(1) \) 个交叉，并相对于最小可能转弯数和交叉数具有近似保证。<sup>[16](https://arxiv.org/abs/1904.02824)</sup>

**复杂性。** 判定巡游是否存在对于矩形棋盘是常数时间可判定的，这归功于施文克等人的分类，但一般问题是困难的：对于带洞棋盘它是 NP 难的，2025 年的一项分析进一步表明骑士巡游即使在连通棋盘上也是 NP 难的。<sup>[6](https://arxiv.org/abs/2606.29153)</sup>

## 变体

巡游的思想超越了标准棋盘。巡游可以定义在任何网格模式、其他形状和大小的棋盘以及 n 维棋盘上。<sup>[17](https://www.archimedes-lab.org/knight_tour.html)</sup><sup> • </sup><sup>[1](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)</sup> 对于大的偶数 n，3 × n 棋盘上的闭合巡游并不罕见；3 × 100 的回路数量恰好为 4,861,943,174,181,138,724,903,568,742,746,024,250,554,974,208。<sup>[18](https://www-cs-faculty.stanford.edu/~knuth/knights.html)</sup> 一个相关的美学变体是幻方骑士巡游，其中巡游的编号格子构成一个幻方，由乔治·杰利斯（George Jelliss）的 Mayhematics 项目为 8 × 8 棋盘编目。<sup>[19](https://www.mayhematics.com/t/mc.htm)</sup>

## References

1. [Knight's Tour Problem, ETH Library virtual exhibition](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/Its-all-math-and-games/knights-tour-problem.html)
2. [Brendan D. McKay (1997). Knight's Tours of an 8 × 8 Chessboard. Electronic Journal of Combinatorics / ANU TR-CS-97-03.](https://www.combinatorics.org/ojs/index.php/eljc/article/download/v3i1r5/8358/)
3. [Héctor Cancela, Ernesto Mordecki (2006). Counting Knight's Tours through the Randomized Warnsdorff Rule. arXiv:math/0609009.](https://arxiv.org/abs/math/0609009)
4. [Theorem 10.1 (Schwenk), in Mathematical Recreations, AMS](https://www.ams.org/bookstore/pspdf/mbk-63-prev.pdf)
5. [Knight Graph, Wolfram MathWorld](https://mathworld.wolfram.com/KnightGraph.html)
6. [The Optimal Knight Exchange Puzzle is NP-Hard, arXiv:2606.29153](https://arxiv.org/abs/2606.29153)
7. [Rediscovery of the Knight's Problem, Mayhematics](https://mayhematics.com/t/1b.htm)
8. [The Fascinating World of Graph Theory, Princeton University Press (sample chapter)](https://assets.press.princeton.edu/chapters/s10314.pdf)
9. [George Jelliss (2003, updated 2022). Some Enumerations of Classes of 8×8 Knight's Tours, Mayhematics](https://www.mayhematics.com/t/8a.htm)
10. [Donald E. Knuth, The Art of Computer Programming Fascicle 8a (sample)](https://cs.stanford.edu/~knuth/fasc8a.pdf)
11. [SLAC-PUB-0261, knight's tour as a graph problem](https://www.slac.stanford.edu/pubs/slacpubs/0250/slac-pub-0261.pdf)
12. [Knight's Tour Analysis, Problem Solving with Algorithms and Data Structures, Runestone Academy](https://runestone.academy/ns/books/published/pythonds3/Graphs/KnightsTourAnalysis.html)
13. [wisn/knights-tour, C++ implementations of knight's tour algorithms, GitHub](https://github.com/wisn/knights-tour)
14. [Samuel L. Marateck. How good is the Warnsdorff's knight's tour heuristic? arXiv:0803.4321](https://arxiv.org/abs/0803.4321)
15. [Conrad, Hindrichs, Morsy, Wegener (1994). Solution of the knight's Hamiltonian path problem on chessboards. Discrete Applied Mathematics 50(2):125–134, MaRDI portal record](https://portal.mardi4nfdi.de/wiki/Solution_of_the_knight%27s_Hamiltonian_path_problem_on_chessboards)
16. [Taming the Knight's Tour: Minimizing Turns and Crossings, arXiv:1904.02824](https://arxiv.org/abs/1904.02824)
17. [Knight Tour Problems, Archimedes Lab](https://www.archimedes-lab.org/knight_tour.html)
18. [Donald E. Knuth, Knight's Tours in Olin Hall, Stanford University](https://www-cs-faculty.stanford.edu/~knuth/knights.html)
19. [Catalogue of 8 by 8 Magic Knight Tours, Mayhematics](https://www.mayhematics.com/t/mc.htm)
20. [dLib.si - Laceable knights](https://www.dlib.si/stream/URN%3ANBN%3ASI%3Adoc-V2Z5F9ZG/eab909ad-341f-45c7-bb1b-9926f39bbfd3/PDF)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Graph theory › Graph theory overview and basic objects

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/knights-tour

English original: https://www.edgepedia.org/knights-tour
