Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Path (graph theory)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Sequence of edges which join a sequence of nodes on a given graph}} {{For|the family of graphs known as paths|Path graph}} [[File:Snake-in-the-box and Hamiltonian path.svg|thumb|right|A three-dimensional [[hypercube graph]] showing a [[Hamiltonian path]] in red, and a [[Snake-in-the-box|longest induced path]] in bold black]] In [[graph theory]], a '''path''' in a [[Graph (discrete mathematics)|graph]] is a finite or infinite [[sequence]] of [[Edge (graph theory)|edges]] which joins a sequence of [[Vertex (graph theory)|vertices]] which, by most definitions, are all distinct (and since the vertices are distinct, so are the edges). A '''directed path''' (sometimes called '''dipath'''{{sfn|McCuaig|1992|p=205}}) in a [[directed graph]] is a finite or infinite sequence of edges which joins a sequence of distinct vertices, but with the added restriction that the edges be all directed in the same direction. Paths are fundamental concepts of graph theory, described in the introductory sections of most graph theory texts. See e.g. {{harvtxt|Bondy|Murty|1976}}, {{harvtxt|Gibbons|1985}}, or {{harvtxt|Diestel|2005}}. {{harvtxt|Korte|Lovász|Prömel|Schrijver|1990}} cover more advanced [[algorithm]]ic topics concerning paths in graphs. == Definitions == === Walk, trail, and path === [[File:Trail but not path.svg|200px|thumb|right]] * A '''walk''' is a finite or infinite [[sequence]] of [[Edge (graph theory)|edges]] which joins a sequence of [[Vertex (graph theory)|vertices]].{{sfn|Bender|Williamson|2010|p=162}} : Let {{nowrap|1=''G'' = (''V'', ''E'', ''Φ'')}} be a graph. A finite walk is a sequence of edges {{nowrap|(''e''<sub>1</sub>, ''e''<sub>2</sub>, ..., ''e''<sub>''n'' − 1</sub>)}} for which there is a sequence of vertices {{nowrap|(''v''<sub>1</sub>, ''v''<sub>2</sub>, ..., ''v''<sub>''n''</sub>)}} such that {{nowrap begin}}''Φ''(''e''<sub>''i''</sub>) = {''v''<sub>''i''</sub>, ''v''<sub>''i'' + 1</sub>}{{nowrap end}} for {{nowrap|1=''i'' = 1, 2, ..., ''n'' − 1}}. {{nowrap|(''v''<sub>1</sub>, ''v''<sub>2</sub>, ..., ''v''<sub>''n''</sub>)}} is the ''vertex sequence'' of the walk. The walk is ''closed'' if {{nowrap begin}}''v''<sub>1</sub> = ''v''<sub>''n''</sub>{{nowrap end}}, and it is ''open'' otherwise. An infinite walk is a sequence of edges of the same type described here, but with no first or last vertex, and a semi-infinite walk (or [[End (graph theory)|ray]]) has a first vertex but no last vertex. * A '''trail''' is a walk in which all edges are distinct.{{sfn|Bender|Williamson|2010|p=162}} * A '''path''' is a trail in which all vertices (and therefore also all edges) are distinct.{{sfn|Bender|Williamson|2010|p=162}} If {{nowrap|1=''w'' = (''e''<sub>1</sub>, ''e''<sub>2</sub>, ..., ''e''<sub>''n'' − 1</sub>)}} is a finite walk with vertex sequence {{nowrap|(''v''<sub>1</sub>, ''v''<sub>2</sub>, ..., ''v''<sub>''n''</sub>)}} then ''w'' is said to be a ''walk from'' ''v''<sub>1</sub> ''to'' ''v''<sub>''n''</sub>. Similarly for a trail or a path. If there is a finite walk between two ''distinct'' vertices then there is also a finite trail and a finite path between them. Some authors do not require that all vertices of a path be distinct and instead use the term '''simple path''' to refer to such a path where all vertices are distinct. A [[weighted graph]] associates a value (''weight'') with every edge in the graph. The ''weight of a walk'' (or trail or path) in a weighted graph is the sum of the weights of the traversed edges. Sometimes the words ''cost'' or ''length'' are used instead of weight. === Directed walk, directed trail, and directed path === * A '''directed walk''' is a finite or infinite [[sequence]] of [[Edge (graph theory)|edges]] directed in the same direction which joins a sequence of [[Vertex (graph theory)|vertices]].{{sfn|Bender|Williamson|2010|p=162}} : Let {{nowrap|1=''G'' = (''V'', ''E'', ''Φ'')}} be a directed graph. A finite directed walk is a sequence of edges {{nowrap|(''e''<sub>1</sub>, ''e''<sub>2</sub>, ..., ''e''<sub>''n'' − 1</sub>)}} for which there is a sequence of vertices {{nowrap|(''v''<sub>1</sub>, ''v''<sub>2</sub>, ..., ''v''<sub>''n''</sub>)}} such that {{nowrap|1=''Φ''(''e''<sub>''i''</sub>) = (''v''<sub>''i''</sub>, ''v''<sub>''i'' + 1</sub>)}} for {{nowrap|1=''i'' = 1, 2, ..., ''n'' − 1}}. {{nowrap|(''v''<sub>1</sub>, ''v''<sub>2</sub>, ..., ''v''<sub>''n''</sub>)}} is the ''vertex sequence'' of the directed walk. The directed walk is ''closed'' if {{nowrap begin}}''v''<sub>1</sub> = ''v''<sub>''n''</sub>{{nowrap end}}, and it is ''open'' otherwise. An infinite directed walk is a sequence of edges of the same type described here, but with no first or last vertex, and a semi-infinite directed walk (or [[End (graph theory)|ray]]) has a first vertex but no last vertex. * A '''directed trail''' is a directed walk in which all edges are distinct.{{sfn|Bender|Williamson|2010|p=162}} * A '''directed path''' is a directed trail in which all vertices are distinct.{{sfn|Bender|Williamson|2010|p=162}} If {{nowrap|1=''w'' = (''e''<sub>1</sub>, ''e''<sub>2</sub>, ..., ''e''<sub>''n'' − 1</sub>)}} is a finite directed walk with vertex sequence {{nowrap|(''v''<sub>1</sub>, ''v''<sub>2</sub>, ..., ''v''<sub>''n''</sub>)}} then ''w'' is said to be a ''walk from'' ''v''<sub>1</sub> ''to'' ''v''<sub>''n''</sub>. Similarly for a directed trail or a path. If there is a finite directed walk between two ''distinct'' vertices then there is also a finite directed trail and a finite directed path between them. A "simple directed path" is a path where all vertices are distinct. A [[Weighted graph|weighted directed graph]] associates a value (''weight'') with every edge in the directed graph. The ''weight of a directed walk'' (or trail or path) in a weighted directed graph is the sum of the weights of the traversed edges. Sometimes the words ''cost'' or ''length'' are used instead of weight. == Examples == * A graph is [[Connectivity (graph theory)|connected]] if there are paths containing each pair of vertices. * A directed graph is [[Strongly-connected digraph|strongly connected]] if there are oppositely oriented directed paths containing each pair of vertices. * A path such that no graph edges connect two nonconsecutive path vertices is called an [[induced path]]. * A path that includes every vertex of the graph without repeats is known as a [[Hamiltonian path]]. * Two paths are ''vertex-independent'' (alternatively, ''internally disjoint'' or ''internally vertex-disjoint'') if they do not have any internal vertex or edge in common. Similarly, two paths are ''edge-independent'' (or ''edge-disjoint'') if they do not have any edge in common. Two internally disjoint paths are edge-disjoint, but the converse is not necessarily true. * The [[Distance (graph theory)|distance]] between two vertices in a graph is the length of a shortest path between them, if one exists, and otherwise the distance is infinity. * The diameter of a connected graph is the largest distance (defined above) between pairs of vertices of the graph. == Finding paths == Several algorithms exist to find [[Shortest path problem|shortest]] and [[Longest path problem|longest]] paths in graphs, with the important distinction that the former problem is computationally much easier than the latter. [[Dijkstra's algorithm]] produces a list of shortest paths from a source vertex to every other vertex in directed and undirected graphs with non-negative edge weights (or no edge weights), whilst the [[Bellman–Ford algorithm]] can be applied to directed graphs with negative edge weights. The [[Floyd–Warshall algorithm]] can be used to find the shortest paths between all pairs of vertices in weighted directed graphs. == The path partition problem == The '''k-path partition''' problem is the problem of partitioning a given graph to a smallest collection of vertex-disjoint paths of length at most ''k''.<ref>{{Cite journal |last=Chen |first=Yong |last2=Goebel |first2=Randy |last3=Lin |first3=Guohui |last4=Su |first4=Bing |last5=Xu |first5=Yao |last6=Zhang |first6=An |date=2019-07-01 |title=An improved approximation algorithm for the minimum 3-path partition problem |url=https://doi.org/10.1007/s10878-018-00372-z |journal=Journal of Combinatorial Optimization |volume=38 |issue=1 |pages=150–164 |doi=10.1007/s10878-018-00372-z |issn=1382-6905}}</ref> == See also == * [[Glossary of graph theory]] * [[Path graph]] * [[Polygonal chain]] * [[Shortest path problem]] * [[Longest path problem]] * [[Dijkstra's algorithm]] * [[Bellman–Ford algorithm]] * [[Floyd–Warshall algorithm]] * [[Self-avoiding walk]] *[[Shortest-path graph]] == Notes == {{Reflist}} == References == {{refbegin|2}} * {{cite book |last1=Bender |first1=Edward A. |last2=Williamson |first2=S. Gill |date=2010 |title=Lists, Decisions and Graphs. With an Introduction to Probability |url=https://books.google.com/books?id=vaXv_yhefG8C }} * {{cite book |last1=Bondy |first1=J. A. |last2=Murty |first2=U. S. R. |date=1976 |title=Graph Theory with Applications |url=https://archive.org/details/graphtheorywitha0000bond/page/12 |publisher=North Holland |page=[https://archive.org/details/graphtheorywitha0000bond/page/12 12-21] |isbn=0-444-19451-7 }} * {{cite book |last=Diestel |first=Reinhard | author-link = Reinhard Diestel|date=2005 |title=Graph Theory |url=http://www.math.uni-hamburg.de/home/diestel/books/graph.theory/ |publisher=Springer-Verlag |pages=6–9 |isbn=3-540-26182-6 }} * {{cite book |last=Gibbons |first=A. |date=1985 |title=Algorithmic Graph Theory |publisher=Cambridge University Press |pages=5–6 |isbn=0-521-28881-9 }} * {{cite book |last1=Korte |first1=Bernhard |authorlink1=Bernhard Korte|last2=Lovász |first2=László |authorlink2=László Lovász |last3=Prömel |first3=Hans Jürgen |last4=Schrijver |first4=Alexander |authorlink4=Alexander Schrijver |date=1990 |title=Paths, Flows, and VLSI-Layout |url=https://archive.org/details/pathsflowsvlsila0000unse |publisher=Springer-Verlag |isbn=0-387-52685-4 |url-access=registration }} * {{cite conference |last=McCuaig |first=William |chapter=Intercyclic Digraphs |year=1992 |title=Graph Structure Theory |editor1-last=Robertson |editor1-first=Neil |editor2-last=Seymour |editor2-first=Paul |page=205 |conference=AMS–IMS–SIAM Joint Summer Research Conference on Graph Minors, Seattle, June 22 – July 5, 1991 |publisher=American Mathematical Society |chapter-url=https://archive.org/details/graphstructureth0000amsi/page/205/ |chapter-url-access=limited}} {{refend}} {{interwiki extra|qid=Q917421}} {{Authority control}} [[Category:Graph theory objects]] [[Category:Graph connectivity]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite conference
(
edit
)
Template:Cite journal
(
edit
)
Template:For
(
edit
)
Template:Harvtxt
(
edit
)
Template:Interwiki extra
(
edit
)
Template:Nowrap
(
edit
)
Template:Nowrap begin
(
edit
)
Template:Nowrap end
(
edit
)
Template:Refbegin
(
edit
)
Template:Refend
(
edit
)
Template:Reflist
(
edit
)
Template:Sfn
(
edit
)
Template:Short description
(
edit
)