# 路径（图论）

在图论中，**路径**（path）是一种途径（walk），即一个顶点序列，其中每一对相邻顶点都由一条边相连，且没有顶点重复；由于顶点互不相同，边也不可能重复，因此每条路径也是一条迹（trail）。<sup>[1](https://mspace.lib.umanitoba.ca/bitstream/handle/1993/37010/GraphTheoryNotes2022.pdf)</sup><sup> • </sup><sup>[2](https://math.libretexts.org/Courses/SUNY_Geneseo/Math_104_Green/03%3A_Graph_Theory/3.05%3A_Navigating_Graphs)</sup> 路径是三种基本遍历对象中限制最强的一种：每条路径都是迹，每条迹都是途径，而重复经过某条边的途径则既不是迹也不是路径。<sup>[2](https://math.libretexts.org/Courses/SUNY_Geneseo/Math_104_Green/03%3A_Graph_Theory/3.05%3A_Navigating_Graphs)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 所有顶点（因而所有边）均不重复的途径<sup>[1](https://mspace.lib.umanitoba.ca/bitstream/handle/1993/37010/GraphTheoryNotes2022.pdf)</sup> |
| 层次关系 | 所有路径都是迹（无重复边），所有迹都是途径（除须在图上之外别无限制）<sup>[2](https://math.libretexts.org/Courses/SUNY_Geneseo/Math_104_Green/03%3A_Graph_Theory/3.05%3A_Navigating_Graphs)</sup> |
| 长度 | 路径的长度是其所经过的边数；长度为 k 的路径有 k + 1 个顶点<sup>[3](https://people.csail.mit.edu/meyer/mcs-diffs.pdf)</sup><sup> • </sup><sup>[1](https://mspace.lib.umanitoba.ca/bitstream/handle/1993/37010/GraphTheoryNotes2022.pdf)</sup> |
| 记号 | 长度为 k 的路径记作 \( P_k \)，其中 \( k \ge 2 \)；有些教材改用 \( P_{k+1} \)，以顶点计数<sup>[1](https://mspace.lib.umanitoba.ca/bitstream/handle/1993/37010/GraphTheoryNotes2022.pdf)</sup> |
| 连通性 | 若任意两个不同顶点之间都存在一条路径，则称该图是连通的<sup>[4](https://notes.bweston.uk/comp202/)</sup> |
| 距离 | 连通图中两个顶点之间的距离 \( d(x,y) \) 是一条最短 x–y 路径的长度<sup>[1](https://mspace.lib.umanitoba.ca/bitstream/handle/1993/37010/GraphTheoryNotes2022.pdf)</sup> |
| 术语警示 | 各教材定义不一：有些作者把途径称为“路径”，而用“简单路径”专指无重复的版本<sup>[3](https://people.csail.mit.edu/meyer/mcs-diffs.pdf)</sup> |

## 途径、迹与路径

图 \( G = (V, E) \) 中的**途径**（walk）是一个顶点与边交替出现的序列 \( v_0, e_1, v_1, \ldots, e_m, v_m \)，其中 \( e_i = \{v_{i-1}, v_i\} \in E \)；顶点和边均可重复。在简单图中，由于没有平行边或重边，边可由顶点序列唯一确定，因此途径可以只写成顶点列表。<sup>[5](https://www.cs.cmu.edu/afs/cs/academic/class/15210-f15/www/tapp.html)</sup> **迹**（trail）是不重复任何边的途径，但顶点可以重复；**路径**（path）是不重复任何顶点的途径。<sup>[1](https://mspace.lib.umanitoba.ca/bitstream/handle/1993/37010/GraphTheoryNotes2022.pdf)</sup>

这些限制层层嵌套。在一个有六个顶点的图上，边为 a–b、b–c、b–d、a–d、a–e、d–e 和 e–f，途径 (a, b, d, a, b, c) 既不是迹也不是路径，因为它重复了边和顶点；途径 (a, d, e, a, b, c) 是迹但不是路径，因为顶点 a 再次出现；途径 (a, e, d, b, c) 是路径，因而也是迹。<sup>[6](https://cnds.constructor.university/courses/mfcs-2025/mfcs-notes.pdf)</sup>

当途径的首尾顶点重合时，称之为**闭途径**（closed walk）。闭迹称为**回路**（circuit），而不重复中间顶点的回路称为**圈**（cycle）；等价地说，圈是只有首尾顶点相同的闭途径。<sup>[7](https://www.isibang.ac.in/~d.yogesh/Course_Notes/DM1/Ch2.S3.html)</sup><sup> • </sup><sup>[1](https://mspace.lib.umanitoba.ca/bitstream/handle/1993/37010/GraphTheoryNotes2022.pdf)</sup>

## 术语因来源而异

这些词在文献中并未统一。麻省理工学院的教材《计算机科学数学》（*Mathematics for Computer Science*）把大多数图论教材所称的途径定义为“路径”，而把他们所称的路径定义为“简单路径”，并明确提醒读者注意这一差异。<sup>[3](https://people.csail.mit.edu/meyer/mcs-diffs.pdf)</sup> 斯坦福大学的 CS106B 课程讲义也指出了同样的分歧：有些资料要求路径不重复顶点，另一些则允许重复，而用“简单路径”指不重复的版本；还有些资料把路径定义为边的列表而非顶点的列表。<sup>[8](https://web.stanford.edu/class/archive/cs/cs106b/cs106b.1242/lectures/26-graphs/)</sup> LibreTexts 的一本离散数学教材建议读者务必先查看所读材料中的定义，因为这些术语的用法差异很大，甚至会相互对调。<sup>[9](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Discrete_Mathematics_for_Computer_Science_%28Fitch%29/05%3A_Graph_Theory/5.04%3A_Paths)</sup> 不重复的版本也称为**简单路径**（simple path）或**自回避途径**（self-avoiding walk）。<sup>[7](https://www.isibang.ac.in/~d.yogesh/Course_Notes/DM1/Ch2.S3.html)</sup>

## 归约为路径

路径之所以重要，是因为途径总能被清理成路径。对于不同顶点 u 和 v，从 u 到 v 存在途径当且仅当存在迹，当且仅当存在路径：给定任意一条途径，重复出现的顶点 x 将其分成若干段，删去 x 首次与末次出现之间的那段，便得到一条更短的途径；反复执行这一去环操作，最终必得一条路径。<sup>[7](https://www.isibang.ac.in/~d.yogesh/Course_Notes/DM1/Ch2.S3.html)</sup> 这正是为什么连通性可以用途径或路径来等价定义，也是为什么一个图是连通的，当且仅当每一对不同的顶点之间都有路径相连。<sup>[4](https://notes.bweston.uk/comp202/)</sup>

## 路径图

**路径图**（path graph）\( P_n \) 是一棵有 \( n \ge 2 \) 个顶点的树，其中两个节点的度为 1，\( n - 2 \) 个节点的度为 2；它可以画成所有顶点和边都在一条直线上的形式。<sup>[10](https://mathworld.wolfram.com/PathGraph.html)</sup> 单顶点情形 \( P_1 \) 即单点图，等价于完全图 \( K_1 \)。<sup>[10](https://mathworld.wolfram.com/PathGraph.html)</sup>

## 算法问题中的路径

若干核心计算问题都以路径来表述。**最短路径问题**（shortest-path problem）要求找出两个顶点之间代价最小的路径；该领域的一篇综述从单源与全对、静态图与动态图、精确解与近似解等维度对算法进行分类，并指出没有哪一种算法能涵盖所有变体。<sup>[11](https://arxiv.org/abs/1705.02044)</sup> 荷兰计算机科学家埃德斯格·W·迪杰斯特拉（Edsger W. Dijkstra）于 1959 年在《数值数学》（*Numerische Mathematik*）上发表了最初的最短路径算法，其讨论仅限于任意两节点之间至少存在一条路径的图。<sup>[12](https://www.cs.yale.edu/homes/lans/readings/routing/dijkstra-routing-1959.pdf)</sup>

**最长路径问题**（longest path problem）要求在给定图中找出一条最长的简单路径，该问题是 NP 难的；针对无向图的一种贪心近似算法在 n 个顶点、m 条边的图上运行时间为 \( O(n^2(n+m)) \)。<sup>[13](https://arxiv.org/abs/1209.2503)</sup>

两种经典的特殊路径各有其名。**欧拉迹**（Eulerian trail）恰好经过图中每条边一次；莱昂哈德·欧拉（Leonhard Euler）1736 年对哥尼斯堡七桥问题的解答表明，这样的遍历存在当且仅当图中奇度顶点的个数为零或恰为两个，他的论文常被视为图论的第一篇文献。<sup>[14](https://mathshistory.st-andrews.ac.uk/HistTopics/Topology_in_mathematics/)</sup> **哈密顿路径**（Hamiltonian path）恰好访问每个顶点一次；爱尔兰数学家威廉·罗恩·哈密顿（William Rowan Hamilton）于 1856 年发明了二十面体演算，用以研究十二面体上恰好访问每个顶点一次的闭合边路径，并在 1857 年都柏林英国科学促进会会议上展示了相关的“二十面体游戏”；一般图中的此类闭合边路径今天被称为哈密顿回路。<sup>[15](https://www.maths.tcd.ie/pub/HistMath/People/Hamilton/Icosian/)</sup>

## References

1. [Graph Theory Notes 2022, University of Manitoba](https://mspace.lib.umanitoba.ca/bitstream/handle/1993/37010/GraphTheoryNotes2022.pdf)
2. [Navigating Graphs, Mathematics LibreTexts](https://math.libretexts.org/Courses/SUNY_Geneseo/Math_104_Green/03%3A_Graph_Theory/3.05%3A_Navigating_Graphs)
3. [Chapter 9, Simple Graphs, Mathematics for Computer Science (Meyer, MIT)](https://people.csail.mit.edu/meyer/mcs-diffs.pdf)
4. [COMP202 Complexity of Algorithms notes, University of Liverpool](https://notes.bweston.uk/comp202/)
5. [Parallel Computing: Theory and Practice, Chapter 15, Carnegie Mellon University](https://www.cs.cmu.edu/afs/cs/academic/class/15210-f15/www/tapp.html)
6. [Walks, Trails, Paths, MFCS notes, Constructor University](https://cnds.constructor.university/courses/mfcs-2025/mfcs-notes.pdf)
7. [Walks, Trails and Paths, Discrete Mathematics lecture notes, ISI Bangalore](https://www.isibang.ac.in/~d.yogesh/Course_Notes/DM1/Ch2.S3.html)
8. [CS106B Graph Algorithms, Stanford University](https://web.stanford.edu/class/archive/cs/cs106b/cs106b.1242/lectures/26-graphs/)
9. [Paths, Discrete Mathematics for Computer Science, Mathematics LibreTexts](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Discrete_Mathematics_for_Computer_Science_%28Fitch%29/05%3A_Graph_Theory/5.04%3A_Paths)
10. [Path Graph, Wolfram MathWorld](https://mathworld.wolfram.com/PathGraph.html)
11. [A Survey of Shortest-Path Algorithms (Madkour et al., arXiv)](https://arxiv.org/abs/1705.02044)
12. [E. W. Dijkstra (1959), A note on two problems in connexion with graphs, Numerische Mathematik 1, 269–271](https://www.cs.yale.edu/homes/lans/readings/routing/dijkstra-routing-1959.pdf)
13. [A greedy approximation algorithm for the longest path problem in undirected graphs (arXiv)](https://arxiv.org/abs/1209.2503)
14. [Topology history, MacTutor History of Mathematics, University of St Andrews](https://mathshistory.st-andrews.ac.uk/HistTopics/Topology_in_mathematics/)
15. [The Icosian Calculus, William R. Hamilton, Trinity College Dublin](https://www.maths.tcd.ie/pub/HistMath/People/Hamilton/Icosian/)

---
*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/path-graph-theory

English original: https://www.edgepedia.org/path-graph-theory
