A walk records a journey through a graph as a finite alternating sequencewhere each edge joins the consecutive vertices and . Both vertices and edges may repeat. Its length is , counting edge traversals with repetitions, rather than counting different edges or measuring the drawing. Here a graph path means a walk with no repeated vertices; a trail instead forbids repeated edges. These conventions distinguish a journey's record from the subgraph consisting of the connections it used.[ref]
https://ptwiddle.github.io/MAS341-Graph-Theory-2017/lecturenotes/lecture3.html. Paul Johnson, MAS341, Lecture 3: walks and trails
Unless stated otherwise, the examples below use a finite simple graph that is an undirected graph, so an edge may be traversed in either direction. In a multigraph, retain each edge's individual identity as well as its endpoint vertices: two parallel edges are different choices for the same step. If self-loops are allowed, traversing one leaves the current vertex unchanged but adds one to the length. In a directed graph, each step must follow its directed edge from its initial to its terminal vertex, giving a directed walk; reversing a journey need not be possible.[ref]
https://people.math.binghamton.edu/zaslav/Oldcourses/581.S99/notes.html. Thomas Zaslavsky, Supplementary Notes for Graduate Graph Theory: edge identities and walks
We allow the zero-length walk at every vertex . It uses no edges, so it is also a trail and a graph path, and its coinciding endpoints make it a closed walk. This means staying put is a legitimate journey; a graph with no vertices has no such walk. Positive-length restrictions will be stated explicitly.[ref]
Mathematics for Computer Science by Eric Lehman and others. Lehman, Leighton and Meyer, Mathematics for Computer Science, §11.8.1: length-zero convention
Use the same constructed graph throughout these three sections:Here denotes the unordered pair , and . Two triangles in a graph, and , share , with one extra edge . These are schematic connections, not measured roads; the highlighted connections in the diagram show which edges are used, while the numbered sequence records their order.
The length-six walk uses and twice, so it is not a trail. The length-six trail returns to but uses six different edges, so it is not a graph path. The length-three graph path repeats neither vertices nor edges. Thusfor this particular graph. The restrictions answer different routing questions: revisiting a junction is harmless for many journeys, whereas reusing a serviced road segment can matter for an inspection route. Travel costs require a weighted graph; a walk's cost adds the weight of each traversal, even when an edge is used again.
Every finite walk from to contains a graph path from to after deleting detours. For a proof outline, if with , delete the intervening closed walk. The retained steps still meet at the same vertex, and the length strictly decreases. Repeating terminates with no repeated vertices, or with the zero-length graph path when . This explains why reachability can be formulated using either walks or graph paths. With nonnegative edge weights, deletion also cannot increase cost, connecting the argument to the shortest path problem; with negative weights that cost conclusion fails.[ref]
https://ptwiddle.github.io/MAS341-Graph-Theory-2017/lecturenotes/lecture3.html. Paul Johnson, MAS341, Lecture 3: deleting repeated-vertex detours
A trail is a walk whose edge sequence has no repetitions. Its vertices may repeat, including its first and last vertices. The zero-length walk is a trail because it repeats no edge. Every graph path is a trail, but the converse fails: the trail in the shared example isIts six edges are pairwise distinct, although occurs twice. Visiting a junction again and traversing a road segment again are different events.[ref]
https://people.math.binghamton.edu/zaslav/Oldcourses/581.S99/notes.html. Thomas Zaslavsky, Supplementary Notes for Graduate Graph Theory: trails and paths
In an undirected graph, traversing and then repeats the same edge; direction of travel does not give it a new identity. In a multigraph with distinct parallel edges joining and , the closed walk is a trail, whereas is not. Both have the same vertex sequence . In a directed graph, separate directed edges and may instead be used once each; record their identities and obey their directions. Thus testing a trail means checking the actual edge records, not merely checking consecutive endpoint labels.
For a finite graph, a trail has length at most ; unrestricted walks can have arbitrarily large length whenever a positive-length closed walk exists, since it can be repeated. An Eulerian trail is the special trail that uses every edge, so its length is exactly . Our length-six trail omits and is therefore not an Eulerian trail. In a road-inspection model, a trail describes servicing its selected segments once while allowing returns to junctions; requiring service of every segment leads to the Eulerian trail question. If extra travel between serviced segments is necessary, the complete journey can be a walk even when each segment is serviced only once. This distinction keeps the service requirement separate from the route actually travelled.
A closed walk is a walk with equal endpoint vertices, . Under our convention this includes the zero-length walk ; returning after traversing at least one edge requires . Closure imposes no other restriction on repeated vertices or edges. In a directed graph, a closed directed walk must also follow every directed edge in its permitted direction.[ref]
Mathematics for Computer Science by Eric Lehman and others. Lehman, Leighton and Meyer, Mathematics for Computer Science, §§9.2 and 11.8.1: closed walks
Returning to : backtracking closed walk, closed trail with a repeated internal vertex, and graph cycle
. Details. In the shared simple graph, is a length-two closed walk that immediately backtracks along . It is not a trail, since is used twice, and it is not a graph cycle. The length-six closed walk is a trail, since its six edges are distinct, but is not a graph cycle: it returns to midway through the journey. The length-three closed walk is a graph cycle, with all vertices distinct apart from the required endpoint repetition. In a simple graph that is an undirected graph, a graph cycle has length at least three; the two-step backtrack is excluded.[ref]
Mathematics for Computer Science by Eric Lehman and others. Lehman, Leighton and Meyer, Mathematics for Computer Science, §11.8.1: cycles and backtracking
A positive-length closed walk therefore need not reveal a graph cycle: even a tree permits an out-and-back journey on an edge. A positive-length closed trail in a simple graph does contain a graph cycle. For a proof outline, choose a shortest positive-length consecutive portion of the trail whose endpoint vertices coincide. It cannot repeat an internal vertex, since that would give a shorter such portion; it cannot have length one or two because self-loops and repeated edges are excluded. It is consequently a graph cycle. Cutting it out leaves another closed trail, possibly of length zero, so repetition partitions the original edges into graph cycles. In our six-step example these are the two triangles in a graph. A closed trail using every edge would be an Euler circuit; here is omitted.
Counting return journeys makes closed walks useful even when they repeat edges. For a finite simple graph with adjacency matrix , the walk count from powers of an adjacency matrix gives length- walks from to , for every nonnegative integer . A proof outline is that matrix multiplication appends one allowed step, summing over the previous endpoint; is the identity matrix, recording the unique zero-length walk at each vertex. ConsequentlyThe trace counts closed walks with a specified starting vertex and traversal order, not distinct graph cycles. These formulas use adjacency entries, not arbitrary travel costs in a weighted graph.[ref]
https://ocw.mit.edu/courses/14-15-networks-spring-2022/mit14_15s22_lec2.pdf. Alexander Wolitzky, Graph Theory and Social Networks, slides 9–10: powers of adjacency matrices
In our example, : the five length-two closed walks are , , , , and . Also , going round either triangle in a graph in either direction, and : each of the two triangles in a graph supplies three choices of starting vertex and two directions. These exact counts for the constructed graph illustrate why return counts and graph cycle counts differ.
A closed walk naturally models a delivery or inspection journey that returns to its depot. Repeated vertices let it combine several excursions; repeated edges let it serve a dead end and return. For an Euclidean travelling salesman tour, one can first construct a closed walk visiting all locations and then use the triangle inequality to shortcut repeated visits without increasing total length. That argument assumes direct travel between the retained locations is permitted, as in a complete graph weighted by Euclidean distance; an arbitrary road network need not contain those shortcut edges.
Articles by others on the same topic
There are currently no matching articles.

