World Library  
Flag as Inappropriate
Email this Article

Path (graph theory)


Path (graph theory)

A hypercube graph showing a Hamiltonian path in red, and a longest induced path in bold black.

In graph theory, a path in a graph is a finite or infinite sequence of edges which connect a sequence of vertices which, by most definitions, are all distinct from one another. In a directed graph, a directed path (sometimes called dipath[1]) is again a sequence of edges (or arcs) which connect a sequence of vertices, but with the added restriction that the edges all be 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. Bondy and Murty (1976), Gibbons (1985), or Diestel (2005). Korte et al. (1990) cover more advanced algorithmic topics concerning paths in graphs.


  • Definitions 1
  • Examples 2
  • Finding paths 3
  • See also 4
  • References 5


A path is a trail in which all vertices (except possibly the first and last) are distinct. A trail is a walk in which all edges are distinct. A walk of length k in a graph is an alternating sequence of vertices and edges, v_0,e_0,v_1,e_1,v_2,\ldots, v_{k-1},e_{k-1},v_k, which begins and ends with vertices. If the graph is directed, then e_i is an arc from v_i to v_{i+1}. An infinite path is an alternating sequence of the same type described here, but with no first or last vertex, and a semi-infinite path (also ray) has a first vertex, v_0, but no last vertex. Most authors require that all of the edges and vertices be distinct from one another.

A weighted graph associates a value (weight) with every edge in the graph. The weight of a 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.

A simple path is one which contains no repeated vertices (in other words, it does not cross over itself).


  • A graph is connected if there are paths containing each pair of vertices.
  • A directed graph is 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 is known as a Hamiltonian path.
  • Two paths are vertex-independent (alternatively, internally vertex-disjoint) if they do not have any internal vertex in common. Similarly, two paths are edge-independent (or edge-disjoint) if they do not have any internal edge in common. Two internally vertex-disjoint paths are edge-disjoint, but the converse is not necessarily true.
  • The 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 and longest paths in graphs, with the important distinction that the former problem is computationally much easier than the latter, unless P=NP.

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.

See also


  1. ^ Graph Structure Theory: Proceedings of the AMS-IMS-SIAM Joint Summer Research Conference on Graph Minors, Held June 22 to July 5, 1991,, p.205
  • Diestel, Reinhard (2005). Graph Theory (3rd ed.).  
  • Gibbons, A. (1985). Algorithmic Graph Theory. Cambridge University Press. pp. 5–6.  
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from World eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.