# 哈密顿回路

哈密顿回路是图中的一条闭合路径，它恰好经过每个顶点一次，不重复任何边，并回到起始顶点。含有这种回路的图称为哈密顿图，而判定任意图是否具有哈密顿回路的问题，是最著名的NP完全问题之一。<sup>[1](https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.WG.2026.5)</sup><sup> • </sup><sup>[2](https://mathworld.wolfram.com/IcosianGame.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 一条遍历图中每个顶点恰好一次、不重复任何边、最终回到起点的回路<sup>[2](https://mathworld.wolfram.com/IcosianGame.html)</sup> |
| 起源 | 由威廉·罗恩·哈密顿于1857年作为“二十面体游戏”发明，基于他1856年为正十二面体上闭合边路径所创的“二十面体演算”<sup>[2](https://mathworld.wolfram.com/IcosianGame.html)</sup><sup> • </sup><sup>[3](https://www.maths.tcd.ie/pub/HistMath/People/Hamilton/Icosian/)</sup> |
| 正十二面体图 | 恰有30条哈密顿回路，对应二十面体游戏的30个解<sup>[2](https://mathworld.wolfram.com/IcosianGame.html)</sup> |
| 复杂度 | 判定哈密顿性问题是NP完全的，由卡普1972年关于组合问题归约性的论文确立<sup>[4](https://cir.nii.ac.jp/crid/1363670320486485248)</sup> |
| 正则图 | 对每个固定的k ≥ 3，k-正则图上的判定是NP完全的；对平面k-正则图，k = 3、4、5时为NP完全，k ≥ 6时有多项式算法<sup>[5](https://www.sciencedirect.com/science/article/pii/0304397594901856)</sup> |
| 充分条件 | 狄拉克定理（1952）：任何具有n ≥ 3个顶点且最小度至少为n/2的图都有哈密顿回路<sup>[6](https://opentext.uleth.ca/Combinatorics/sect_Euler-Hamilton.html)</sup> |
| 所引最佳精确界 | 赫尔德–卡普动态规划算法的运行时间为\( O(n^{2} \cdot 2^{n}) \)<sup>[7](https://link.springer.com/article/10.1007/s42979-022-01256-0)</sup> |

## 源于哈密顿的二十面体游戏

这个问题通过威廉·罗恩·哈密顿（William Rowan Hamilton，1805–1865）进入数学领域，这位爱尔兰数学家此前已因四元数而闻名。1856年，他发明了一种“二十面体演算”，用以研究正十二面体上恰好经过每个顶点一次的闭合边路径；一般图中的此类路径今天被称为哈密顿回路。他于1856年在《哲学杂志》和《皇家爱尔兰科学院院刊》上发表了关于该演算的短文，并强调这一新演算与四元数完全不同，不涉及虚根。<sup>[3](https://www.maths.tcd.ie/pub/HistMath/People/Hamilton/Icosian/)</sup>

哈密顿在1857年8月至9月于都柏林举行的英国科学促进会第二十七次会议上展示了该演算及一个相关游戏，并分发了一幅石版画，画中展示了一个正五角十二面体的投影，每个顶点处有孔洞可插象牙钉。<sup>[3](https://www.maths.tcd.ie/pub/HistMath/People/Hamilton/Icosian/)</sup> 二十面体游戏又称哈密顿游戏，以钉板形式作为商品出售，钉板上的孔洞位于正十二面体图的节点处。哈密顿于1859年以25英镑将其卖给伦敦一家游戏经销商，此后该游戏以多种形式在欧洲销售，包括名为“旅行者的十二面体”和“环游世界”的版本。<sup>[2](https://mathworld.wolfram.com/IcosianGame.html)</sup><sup> • </sup><sup>[8](https://academic.oup.com/princeton-scholarship-online/book/18106/chapter-abstract/176020830)</sup> 在双人玩法中，第一位玩家放置编号1至5的钉子以形成一条部分路径，第二位玩家则须用剩余的钉子完成回路。<sup>[9](https://www.cs.toronto.edu/~ahertel/WebPageFiles/Papers/MastersThesis10.pdf)</sup> 正十二面体图恰有30条哈密顿回路。<sup>[2](https://mathworld.wolfram.com/IcosianGame.html)</sup>

## 计算复杂度

哈密顿回路问题问的是：给定一个图，是否存在哈密顿回路。它是NP完全的，这一分类由理查德·M·卡普（Richard M. Karp）在1972年的论文《组合问题之间的归约性》中确立，该文发表于《计算机计算复杂性》（Plenum出版社，第85–103页）。<sup>[4](https://cir.nii.ac.jp/crid/1363670320486485248)</sup> 对于一般问题，目前未知有任何多项式时间算法。<sup>[10](https://arxiv.org/abs/1701.03136)</sup>

即使在很强的限制下，困难性依然存在。对任意固定的k ≥ 3，判定一个k-正则图是否有哈密顿回路或路径是NP完全的。当k-正则图是平面图时，此前已知k = 3时问题为NP完全、k ≥ 6时为多项式可解，而1994年《理论计算机科学》上的一篇短文解决了剩余情形，证明了k = 4和k = 5时的NP完全性。<sup>[5](https://www.sciencedirect.com/science/article/pii/0304397594901856)</sup>

## 充分条件

度条件给出了哈密顿性的经典保证。狄拉克定理（1952），由加布里埃尔·安德鲁·狄拉克（Gabriel Andrew Dirac，1925–1984）证明，指出一个至少有3个顶点且最小度\( \delta(G) \ge |V|/2 \)的图具有哈密顿回路；它至今仍是证明一个图具有哈密顿回路的最有力方法之一。<sup>[6](https://opentext.uleth.ca/Combinatorics/sect_Euler-Hamilton.html)</sup> 该界是紧的，意思是若最小度仅为\( (p-1)/2 \)，便不能保证结论成立：任何完全二部图\( K_{d,d+1} \)都是反例。<sup>[11](https://www.math.wm.edu/~rrkinc/homework/HamSuff.pdf)</sup>

**奥尔定理**（1960）削弱了假设：若对每一对不同的非邻接顶点\( u \)和\( v \)，其度数满足\( \deg(u) + \deg(v) \ge n \)，则该图是哈密顿的。狄拉克条件蕴含奥尔条件，因为最小度为n/2使得每一对非邻接顶点的度数之和至少为n。<sup>[11](https://www.math.wm.edu/~rrkinc/homework/HamSuff.pdf)</sup><sup> • </sup><sup>[12](https://arxiv.org/abs/1403.0776)</sup> 这些条件是充分的而非必要的：一个环图\( C_n \)违反度条件，却显然含有哈密顿回路，即它自身。<sup>[13](https://www.umcconnell.net/posts/2024-07-31-dirac-theorem-hamiltonian/)</sup> 对狄拉克定理的一种自然解释是就座问题：若n个人中每个人都至少与n/2个人是朋友，那么他们可以围桌而坐，使得每个人都坐在两个朋友之间。<sup>[11](https://www.math.wm.edu/~rrkinc/homework/HamSuff.pdf)</sup>

## 算法

一般问题的精确算法是指数时间的。赫尔德–卡普动态规划算法源于旅行商问题所用的同一技术，运行时间为\( O(n^{2} \cdot 2^{n}) \)，但内存消耗大，且在所调查的确定性精确方法中时间复杂性最低。<sup>[7](https://link.springer.com/article/10.1007/s42979-022-01256-0)</sup> 精确回溯算法族自1877年起发展起来，理论最坏情况上界为\( O(v!) \)，但通过三种优化技术——顶点度优先、边剪枝和非哈密顿性检查——在大量随机图上表现显著更优。这些深度优先算法的最难实例集中在科姆洛什–塞迈雷迪界附近，即随着边数增加，随机图是哈密顿图的概率从几乎为零升至几乎为一。<sup>[7](https://link.springer.com/article/10.1007/s42979-022-01256-0)</sup>

特殊图类具有更好的保证。对于平面图，存在一个最坏情况时间为\( O(c^{\sqrt{n}}) \)的精确算法，其中c是不依赖于实例的固定常数，属于次指数运行时间。<sup>[14](https://wrap.warwick.ac.uk/id/eprint/33786/)</sup> 研究还识别出多项式时间可解的图类，例如准伴随图的超类，当边数为\( O(n^{2}) \)时，其哈密顿回路问题可在\( O(n^{4}) \)时间内求解。<sup>[15](https://www.informatica.vu.lt/journal/INFORMATICA/article/1346/text)</sup> 在分布式方面，当输入图是狄拉克图（即满足狄拉克最小度条件的图）时，一种随机化CONGEST算法以高概率在\( O(\log n) \)轮内找到哈密顿回路。<sup>[16](https://arxiv.org/abs/2302.00742)</sup>

## 与旅行商问题的关系

旅行商问题是其优化版本：在加权图上，寻找权重最小的哈密顿回路。这种联系也反方向存在：在一个有n个顶点的有向图上暴力枚举所有巡回路线，最坏情况下需要计算\( n(n-1)! \)条有向哈密顿回路，这促使了赫尔德–卡普算法将其改进为\( O(n^{2} \cdot 2^{n}) \)。<sup>[17](https://ndl.ethernet.edu.et/bitstream/123456789/77330/1/56.pdf)</sup><sup> • </sup><sup>[7](https://link.springer.com/article/10.1007/s42979-022-01256-0)</sup>

## References

1. [Determining if an input undirected graph is Hamiltonian, The S-Hamiltonian Cycle Problem, WG 2026](https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.WG.2026.5)
2. [Icosian Game, Wolfram MathWorld](https://mathworld.wolfram.com/IcosianGame.html)
3. [The 'Icosian Calculus', by William R. Hamilton, Trinity College Dublin](https://www.maths.tcd.ie/pub/HistMath/People/Hamilton/Icosian/)
4. [Richard M. Karp (1972). Reducibility among Combinatorial Problems, Complexity of Computer Computations, pp. 85–103](https://cir.nii.ac.jp/crid/1363670320486485248)
5. [Complexity of the hamiltonian cycle in regular graph problem, Theoretical Computer Science 131(2):463–473, 1994](https://www.sciencedirect.com/science/article/pii/0304397594901856)
6. [Hamilton paths and cycles, Combinatorics (OpenText, University of Lethbridge)](https://opentext.uleth.ca/Combinatorics/sect_Euler-Hamilton.html)
7. [The Hardest Hamiltonian Cycle Problem Instances: The Plateau of Yes and the Cliff of No, SN Computer Science (2022)](https://link.springer.com/article/10.1007/s42979-022-01256-0)
8. [Encircling Graphs, The Fascinating World of Graph Theory, Princeton Scholarship Online](https://academic.oup.com/princeton-scholarship-online/book/18106/chapter-abstract/176020830)
9. [A. Hertel, Master's thesis on Hamiltonian cycles, University of Toronto](https://www.cs.toronto.edu/~ahertel/WebPageFiles/Papers/MastersThesis10.pdf)
10. [A practical efficient and effective method for the Hamiltonian cycle problem, arXiv:1701.03136](https://arxiv.org/abs/1701.03136)
11. [A Study of Sufficient Conditions for Hamiltonian Cycles (Dirac and Ore theorems)](https://www.math.wm.edu/~rrkinc/homework/HamSuff.pdf)
12. [Ore-degree threshold for the square of a Hamiltonian cycle, arXiv:1403.0776](https://arxiv.org/abs/1403.0776)
13. [Dirac's theorem on Hamiltonian Graphs](https://www.umcconnell.net/posts/2024-07-31-dirac-theorem-hamiltonian/)
14. [Exact algorithms for the Hamiltonian cycle problem in planar graphs, Warwick Research Archive Portal](https://wrap.warwick.ac.uk/id/eprint/33786/)
15. [Beyond Quasi-Adjoint Graphs: On Polynomial-Time Solvable Cases of the Hamiltonian Cycle and Path Problems, Informatica](https://www.informatica.vu.lt/journal/INFORMATICA/article/1346/text)
16. [Distributed CONGEST Algorithm for Finding Hamiltonian Paths in Dirac Graphs and Generalizations, arXiv:2302.00742](https://arxiv.org/abs/2302.00742)
17. [Applications of Hamiltonian Cycles, section 5.4](https://ndl.ethernet.edu.et/bitstream/123456789/77330/1/56.pdf)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Graph theory › Computational graph problems and algorithms › NP-hard graph problems and their algorithms

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/hamiltonian-cycle

English original: https://www.edgepedia.org/hamiltonian-cycle
