You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

图论中Path(路径)定义的困惑:两种定义哪个正确?

Understanding Path Definitions in Graph Theory

Hey there! This is such a common source of confusion in graph theory—there’s no single "correct" definition here because terminology can vary between different textbooks, papers, and resources. Let me break it down clearly:

The Two Definitions Explained

  • Your original understanding:

    A path is a trail in which all vertices are distinct.
    This is often called a simple path or open path in many academic materials. It describes a vertex sequence where no vertex is visited more than once, so the path can’t loop back to its starting point.

  • Wikipedia’s definition:

    A path is a trail in which all vertices (except possibly the first and last) are distinct.
    This broader definition includes closed paths (where the start and end vertex are identical) alongside open paths. A closed path fitting this criteria is essentially a cycle—a path that starts and ends at the same vertex with no other repeated vertices.

Why the Difference Matters

The key is to look at context:

  • In most algorithm-focused work (like shortest path problems or graph traversal), the "all vertices distinct" definition (your original understanding) is the default—closed paths would allow infinite loops, which aren’t useful for these tasks.
  • In more theoretical graph discussions, some authors prefer the broader definition that includes cycles under the "path" umbrella, usually clarifying with terms like "open path" or "closed path" to avoid mix-ups.

Always take a quick look at the terminology section of the resource you’re using—most authors will explicitly define what they mean by "path" to prevent confusion.

内容的提问来源于stack exchange,提问作者Kushagra Chatterjee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:53:16