Foundations

Walks, Trails, Paths, Circuits and Cycles

A walk may repeat anything, a trail never repeats an edge, and a path never repeats a vertex; closed walks, circuits and cycles are the versions that come back to where they started. This guide sets out the six definitions on one example graph, explains why textbooks use the words differently, proves that every walk contains a path, counts walks with powers of the adjacency matrix, and shows why paths are so much harder to count, with tested Python code throughout.

25 Min Read Updated: October 2026 Beginner Level
Mohammed Islam Hadjoudj
Mohammed Islam Hadjoudj
Expert Operations Research Engineer

1. Six words for moving through a graph

Graph theory has a small family of words for travelling along the edges of a graph: walk, trail and path for routes that may end anywhere, and closed walk, circuit and cycle for routes that come back to where they started. They differ in only three things: whether a vertex may be visited twice, whether an edge may be used twice, and whether the route ends at its starting vertex.

These are the definitions used by most modern graph theory textbooks, but not by all of them, and section 4 shows where the main conventions differ. The running example is a strip of four triangles with 6 vertices and 9 edges:

edges = {AB, AC, BC, BD, CD, CE, DE, DF, EF}      6 vertices, 9 edges

top row:       B     D     F
bottom row:  A     C     E

deg:   A 2   B 3   C 4   D 4   E 3   F 2
Six copies of the strip graph, each with one route drawn in colour and its steps numbered. Walk A, B, C, A, B, D uses edge A-B twice. Trail A, C, B, D, C, E passes through C twice but repeats no edge. Path A, C, D, F repeats nothing. Closed walk A, B, C, D, B, A uses edge A-B twice and returns to A. Circuit A, B, C, D, E, C, A returns to A through C twice without repeating an edge. Cycle A, B, D, F, E, C, A returns to A and repeats nothing.
One graph, six kinds of route. Top row: routes that end somewhere else. Bottom row: routes that come back to A.

Each route in the picture is the most specific of the six that it can be called:

A single vertex on its own, such as A, also counts: it is a walk of length 0 and a path of length 0, called a trivial walk. It matters mainly for edge cases in proofs and code, where "the path from a vertex to itself" should exist and have length 0.

2. How the six fit together

The definitions nest. Every path is a trail, because a route that never revisits a vertex cannot reuse an edge, and every trail is a walk. On the closed side, every cycle is a circuit and every circuit is a closed walk. None of these inclusions reverses, as the examples in section 1 show. Three questions are always enough to find the right name, and the order in which they are asked does not matter.

Left: a decision chart. First question: does it end where it started? Then: does it repeat an edge? If yes, it is a walk or a closed walk. If no: does it repeat a vertex? If yes, it is a trail or a circuit; if no, a path or a cycle. Right: two nested sets of boxes, paths inside trails inside walks, and cycles inside circuits inside closed walks, with the counts from A to F: 13 paths, 23 trails and infinitely many walks.
Three yes-or-no questions name any route. Each kind sits inside the next one, so the counts can only grow from paths to trails to walks.

The counts in the example show how quickly the families grow apart. From A to F there are exactly 13 paths: 3 of length 3, 6 of length 4 and 4 of length 5. There are 23 trails: the 13 paths plus 10 trails that pass through some vertex twice, such as A, C, B, D, C, E, F. There are infinitely many walks, because a walk may run back and forth along any edge as often as it likes. Only when the length is fixed does the number of walks become finite, and section 6 counts them exactly.

Two details trip up beginners:

Why does a cycle need length at least 3? In a simple graph the shortest closed walks, such as A, B, A, go out along an edge and come straight back along the same one. That repeats an edge, so it is neither a circuit nor a cycle. In a multigraph the situation changes: two parallel edges between the same two vertices form a cycle of length 2, and a loop forms a cycle of length 1. This is also why the formal definition of a walk lists edges as well as vertices, v0, e1, v1, e2, ..., vk: when two parallel edges join the same vertices, the list of vertices alone does not say which edge was used. In a simple graph the vertices determine the edges, and listing the vertices is enough.

3. Checking a route in code

The definitions translate directly into a short function. It takes a simple graph and a sequence of vertices, checks that every step follows an edge, and then asks the three questions from section 2.

def graph(edges):
    adj = {}
    for u, v in edges:
        adj.setdefault(u, set()).add(v)
        adj.setdefault(v, set()).add(u)
    return adj

def classify(adj, seq):
    """Name the most specific kind of walk that the vertex sequence seq is."""
    steps = list(zip(seq, seq[1:]))
    if any(v not in adj[u] for u, v in steps):
        return 'not a walk'
    closed = len(seq) > 1 and seq[0] == seq[-1]
    edges = [frozenset(step) for step in steps]
    no_repeated_edge = len(set(edges)) == len(edges)
    inner = seq[:-1] if closed else seq          # a closed walk ends where it began
    no_repeated_vertex = len(set(inner)) == len(inner)
    if not closed:
        return 'path' if no_repeated_vertex else 'trail' if no_repeated_edge else 'walk'
    if no_repeated_vertex and len(edges) >= 3:
        return 'cycle'
    return 'circuit' if no_repeated_edge else 'closed walk'

strip = graph(['AB', 'AC', 'BC', 'BD', 'CD', 'CE', 'DE', 'DF', 'EF'])
for seq in ['ABCABD', 'ACBDCE', 'ACDF', 'ABCDBA', 'ABCDECA', 'ABDFECA', 'ABA', 'ABE']:
    print(seq, classify(strip, seq))
# ABCABD walk
# ACBDCE trail
# ACDF path
# ABCDBA closed walk
# ABCDECA circuit
# ABDFECA cycle
# ABA closed walk
# ABE not a walk

The function first rejects A, B, E, because there is no edge between B and E. For a closed route it compares vertices without the final one, since a closed walk always repeats its first vertex at the end. The test len(edges) >= 3 is what keeps A, B, A from being reported as a cycle: its two vertices are different, but its two steps use the same edge. The whole check takes time proportional to the length of the route.

4. Why textbooks disagree

If you have met these words before, you may have met them with different meanings. Graph theory grew up in several countries and fields at once, and the vocabulary was never fully standardised. The table compares the words that some widely used textbooks give to the same four ideas.

TextbookVertices and edges may repeatNo repeated edgeNo repeated vertexClosed, no repeated edge
Ore (1962)edge sequencepathsimple path, or arccyclic path
Harary (1969)walktrailpathclosed trail
West (2001)walktrailpathcircuit
Bondy and Murty (2008)walktrailpathclosed trail
Chartrand and Zhang (2012)walktrailpathcircuit, of length 3 or more
Rosen (2012)pathsimple pathno separate namesimple circuit
Diestel (2017)walknot namedpathnot named

Since Harary's book of 1969, most graph theory texts agree on the core: a walk may repeat anything and a path repeats nothing. Ore's Theory of Graphs of 1962 shows the older usage, in which a path was a route without repeated edges, what is now called a trail. Rosen's Discrete Mathematics and Its Applications, a standard textbook for first courses in discrete mathematics, keeps a version of it: path means any walk, and a simple path is a route that does not repeat an edge. Rosen notes the conflict himself and lists walk, closed walk and trail as the other books' words, but a student who learns "path" from Rosen and then opens a graph theory text will find the same word meaning something stricter.

The words circuit and cycle are the least stable. West, and Chartrand and Zhang, use circuit for a closed trail, as this article does. Ore used circuit for what is now a cycle, and engineers often say "circuit" for any closed loop. Directed graphs add another layer: in Berge's classic books, first written in French, a route in an undirected graph is a chaîne (chain) and a closed one a cycle, while a route along arrows is a chemin (path) and a closed one a circuit.

The safest habit is to state the definition you are using the first time a word appears, or to replace the ambiguous word with the property: "a route that repeats no vertex" cannot be misread. When reading, look for the definition in the first chapter and expect it to differ from the last book you read.

The best-known casualty of the naming is the Eulerian path. It uses every edge of a graph exactly once, and it usually passes through vertices several times, so in the vocabulary of this article it is a trail, not a path. The name survives because the problem is older than the vocabulary, and "Eulerian trail" is now the more careful name for the same thing. The Hamiltonian path, which visits every vertex exactly once, really is a path. Section 8 returns to both.

5. Every walk contains a path

The most useful fact about walks is that repetition is never needed to get somewhere. If there is a walk from u to v, there is a path from u to v, and the path is no longer than the walk. The proof is a shortcut. If the walk visits some vertex x twice, delete everything between the two visits: the walk still runs from u to v, and it is shorter. Repeat until no vertex repeats. What is left is a path.

Left: the trail A, C, B, D, C, E, F of length 6 drawn on the strip; the loop C, B, D, C between the two visits to C is shown dashed in red, and cutting it leaves the path A, C, E, F of length 3 in green. Right: the closed walk A, B, C, D, C, A of length 5 split at the repeated vertex C into the triangle A, B, C, A of length 3, which is odd, and the step C, D, C there and back of length 2, which is even.
Cutting out a loop turns a walk into a shorter path with the same ends. Splitting an odd closed walk always leaves an odd piece, and the last odd piece is an odd cycle.

This small lemma has large consequences:

Closed walks need more care. A closed walk does not always contain a cycle: A, B, A is closed but contains none. A closed walk of odd length always does, and the cycle it contains is odd as well. Split the closed walk at a repeated vertex into two shorter closed walks. Their lengths add up to the original odd length, so one of them is odd. Keep the odd one and repeat. The process stops at an odd closed walk with no repeated vertex, and since a simple graph has no closed walk of length 1, that walk is a cycle of length at least 3.

This argument is the key step in Kőnig's theorem: a graph is bipartite exactly when it has no cycle of odd length. A circuit splits the same way, into cycles that share no edge. The program below carries out all three operations: it cuts loops out of a walk, finds an odd cycle inside an odd closed walk, and splits a circuit into cycles.

def walk_to_path(walk):
    """Cut out every loop. The result is a path with the same two ends."""
    path, where = [], {}
    for v in walk:
        if v in where:                       # back at v: drop everything since the last visit
            for u in path[where[v] + 1:]:
                del where[u]
            del path[where[v] + 1:]
        else:
            where[v] = len(path)
            path.append(v)
    return ''.join(path)

def split_closed_walk(walk):
    """Split a closed walk at its first repeated vertex into two shorter closed walks."""
    seen = {}
    for i, v in enumerate(walk[:-1]):
        if v in seen:
            j = seen[v]
            return walk[j:i + 1], walk[:j] + walk[i:]
        seen[v] = i
    return None                              # nothing repeats: a cycle, or a step there and back

def odd_cycle(walk):
    """A closed walk of odd length always contains a cycle of odd length."""
    while True:
        parts = split_closed_walk(walk)
        if parts is None:
            return walk
        walk = next(p for p in parts if (len(p) - 1) % 2 == 1)

def circuit_to_cycles(walk):
    """Split a circuit into cycles that share no edge."""
    parts = split_closed_walk(walk)
    if parts is None:
        return [walk]
    return circuit_to_cycles(parts[0]) + circuit_to_cycles(parts[1])

print(walk_to_path('ACBDCEF'))               # walk of length 6
# ACEF
print(odd_cycle('ABCDCA'))                   # closed walk of length 5, edge C-D used twice
# ABCA
print(circuit_to_cycles('ABCDECA'))          # circuit of length 6 through C twice
# ['CDEC', 'ABCA']

The trail A, C, B, D, C, E, F visits C twice, so the loop C, B, D, C goes, leaving A, C, E, F. The closed walk A, B, C, D, C, A splits at C into C, D, C, of length 2, and A, B, C, A, of length 3, which is the odd cycle. The circuit A, B, C, D, E, C, A splits at C into the two triangles C, D, E, C and A, B, C, A.

The circuit split is a special case of a theorem published by Oswald Veblen in 1912: the edges of a graph can be divided into cycles that share no edge if and only if every vertex has even degree. A cycle uses two edges at each vertex it passes through, so the degrees must be even; the converse follows by repeatedly removing a cycle, which keeps every degree even.

6. Counting walks with matrix powers

Walks are hard to list but easy to count. Write the graph as its adjacency matrix A, with a 1 in row u, column v when u and v are adjacent and a 0 otherwise. The guide to graph representation explains the matrix itself. Then a classical fact holds: the entry in row u, column v of the power Ak is the number of walks of length k from u to v.

The reason is the rule for multiplying matrices. A walk of length k from u to v is a walk of length k - 1 from u to some vertex w, followed by one step from w to v. So the number of such walks is the sum over all w of (walks of length k - 1 from u to w) times A[w][v], which is exactly the entry of Ak-1 times A. Induction on k does the rest.

Left: the 6 by 6 adjacency matrix of the strip with rows and columns A to F. Right: its cube, with the entry in row A, column F equal to 3 highlighted, and the three walks of length 3 from A to F listed beside it: A, B, D, F; A, C, D, F; and A, C, E, F. The diagonal of the cube adds up to 24, six times the 4 triangles.
The cube of the adjacency matrix counts walks of length 3. Its entry for A and F is 3, and its diagonal counts every triangle six times.

The strip shows several consequences at once:

def graph(edges):
    adj = {}
    for u, v in edges:
        adj.setdefault(u, set()).add(v)
        adj.setdefault(v, set()).add(u)
    return adj

def matmul(X, Y):
    return [[sum(x * y for x, y in zip(row, col)) for col in zip(*Y)] for row in X]

def walk_counts(adj, order, k):
    """Entry [i][j] of the k-th power of the adjacency matrix counts walks of length k."""
    A = [[int(v in adj[u]) for v in order] for u in order]
    M = A
    for _ in range(k - 1):
        M = matmul(M, A)
    return M

strip = graph(['AB', 'AC', 'BC', 'BD', 'CD', 'CE', 'DE', 'DF', 'EF'])
order = 'ABCDEF'
for k in range(1, 7):
    M = walk_counts(strip, order, k)
    print(f'length {k}:  A to F {M[0][5]:3}   A back to A {M[0][0]:3}')
# length 1:  A to F   0   A back to A   0
# length 2:  A to F   0   A back to A   2
# length 3:  A to F   3   A back to A   2
# length 4:  A to F   6   A back to A  11
# length 5:  A to F  29   A back to A  24
# length 6:  A to F  78   A back to A  92
A3 = walk_counts(strip, order, 3)
print('triangles:', sum(A3[i][i] for i in range(len(order))) // 6)
# triangles: 4

The number of walks from A to F grows quickly with the length, from 3 to 78 in three steps, yet the computation stays cheap. Each multiplication of two n by n matrices takes about n3 operations, and repeated squaring reaches Ak in about log2 k multiplications, so even walks of length one million can be counted exactly in a few dozen matrix products. The sum of the diagonal of Ak is also the sum of the k-th powers of the matrix's eigenvalues, which is where walks meet spectral graph theory: the largest eigenvalue sets the growth rate of the number of long walks.

7. Walks are easy, paths are hard

The matrix trick has no counterpart for paths. The number of paths between two vertices is, in general, hard to compute: Leslie Valiant proved in 1979 that counting the paths between two given vertices is #P-complete, the counting analogue of NP-complete. No method much better than trying the routes one by one is known, and none is expected. The program below counts paths by exactly that kind of search, and counts trails the same way with edges in place of vertices.

def graph(edges):
    adj = {}
    for u, v in edges:
        adj.setdefault(u, set()).add(v)
        adj.setdefault(v, set()).add(u)
    return adj

def count_paths(adj, s, t, seen=None):
    """Number of paths from s to t: try every unvisited neighbour, then undo."""
    if s == t:
        return 1
    seen = seen or {s}
    total = 0
    for w in adj[s] - seen:
        seen.add(w)
        total += count_paths(adj, w, t, seen)
        seen.remove(w)
    return total

def count_trails(adj, s, t, used=None):
    """Number of trails from s to t. A trail may pass through t and come back to it later."""
    used = used or set()
    total = 1 if s == t else 0
    for w in adj[s]:
        e = frozenset((s, w))
        if e not in used:
            used.add(e)
            total += count_trails(adj, w, t, used)
            used.remove(e)
    return total

strip = graph(['AB', 'AC', 'BC', 'BD', 'CD', 'CE', 'DE', 'DF', 'EF'])
print(count_paths(strip, 'A', 'F'), count_trails(strip, 'A', 'F'))
# 13 23

def grid(n):
    """The n by n grid of streets: vertices (row, column), edges to the right and down."""
    return graph([((r, c), (r, c + 1)) for r in range(n) for c in range(n - 1)] +
                 [((r, c), (r + 1, c)) for r in range(n - 1) for c in range(n)])

for n in range(2, 6):
    print(n, count_paths(grid(n), (0, 0), (n - 1, n - 1)))
# 2 2
# 3 12
# 4 184
# 5 8512

On the strip the search confirms the counts from section 2: 13 paths and 23 trails from A to F. The grid shows how fast the numbers explode. Between opposite corners of a grid of streets with 2, 3, 4 and 5 vertices on a side there are 2, 12, 184 and 8,512 paths, and one more row and column gives 1,262,816. Physicists and chemists call paths in a lattice self-avoiding walks and use them as models of polymer chains, a molecule that cannot pass through itself.

The same gap separates the easy and hard questions about single routes:

8. Trails, circuits and Euler

Trails belong to Euler. His 1736 solution of the Königsberg bridge problem asked for a walk that crosses every bridge exactly once: a trail through every edge of a multigraph. Such a trail is an Eulerian trail, and a closed one is an Eulerian circuit. Euler's condition, proved in full by Carl Hierholzer in a paper published in 1873, is about degrees. A connected graph has an Eulerian circuit exactly when every vertex has even degree, and an Eulerian trail that is not closed exactly when exactly two vertices have odd degree, in which case the trail must start at one of them and end at the other.

In the strip, B and E have degree 3 and every other vertex has even degree, so an Eulerian trail runs from B to E:

B, A, C, B, D, C, E, D, F, E        9 edges, each used once

It passes through B, C, D and E twice each, which is why "Eulerian path" is, strictly speaking, a misnomer. The guide to Eulerian paths and circuits covers Hierholzer's algorithm in detail. When a graph has more than two odd vertices, some edges must be walked twice, and the cheapest closed walk through every edge is the Chinese postman problem.

Veblen's theorem from section 5 is the other side of the same coin. An Eulerian circuit is a circuit through every edge, and splitting it at repeated vertices divides the edges into cycles that share no edge. Conversely, a connected graph whose edges divide into such cycles has all degrees even, and the cycles can be spliced together at shared vertices into one Eulerian circuit.

9. Cycles, girth and circumference

The strip has exactly 10 cycles: the four triangles, three cycles of length 4, two of length 5 and one of length 6.

length 3:  ABC, BCD, CDE, DEF
length 4:  ABDC, BDEC, CDFE
length 5:  ABDEC, BDFEC
length 6:  ABDFEC

Two numbers summarise the cycles of a graph. The girth is the length of a shortest cycle, here 3, and the circumference is the length of a longest cycle, here 6. A cycle through every vertex, like A, B, D, F, E, C, A, is a Hamiltonian cycle, so the strip is Hamiltonian. A graph with no cycle at all is a forest, and a connected one is a tree, in which there is exactly one path between any two vertices; the guide to trees develops that idea. The guide to cycles in graphs explains how to detect a cycle with depth-first search and how many independent cycles a graph has.

10. Directed walks and paths

In a directed graph every step must follow an arrow from its tail to its head. With that one change, all six definitions carry over: a directed walk, directed trail, directed path, closed directed walk, directed circuit and directed cycle. A few things behave differently:

The matrix trick of section 6 works unchanged for directed graphs: the entry in row u, column v of Ak counts the directed walks of length k from u to v.

11. Where each kind of route is used

Each of the six words names the right model for a different kind of real problem:

12. Common mistakes

MistakeWhy it is wrongFix
Calling any route a "path"In most graph theory texts a path repeats no vertex; some computer science texts use "path" for any walkSay which definition you use, or name the property
"An Eulerian path is a path"It uses every edge once and usually revisits vertices, so it is a trailSay "Eulerian trail" when precision matters
Treating circuit and cycle as the sameA, B, C, D, E, C, A is a circuit but passes through C twiceA cycle repeats no vertex; a circuit only repeats no edge
Calling A, B, A a cycleIt uses the same edge twiceIn a simple graph a cycle has length at least 3
"Every closed walk contains a cycle"A, B, A is closed and contains noneOnly closed walks of odd length are guaranteed one
Measuring length in verticesA, C, D, F has 4 vertices but length 3Length counts steps, that is, edges
Reading Ak as a count of pathsA5[A][F] = 29, but only 4 paths of length 5 run from A to FMatrix powers count walks; paths need a search
Counting each cycle once per spellingA cycle of length k has 2k sequencesDivide by 2k, or fix the start and direction

13. Glossary

TermMeaning
WalkA sequence of vertices, each joined to the next by an edge; anything may repeat
LengthThe number of steps of a walk, counting repeated edges each time
TrailA walk with no repeated edge
PathA walk with no repeated vertex
Closed walkA walk that ends at its starting vertex
CircuitA closed trail: back to the start, no repeated edge
CycleA closed walk of length at least 3 with no repeated vertex except the start
Trivial walkA single vertex: a walk and a path of length 0
DistanceThe length of a shortest path between two vertices
GirthThe length of a shortest cycle
CircumferenceThe length of a longest cycle
Eulerian trailA trail that uses every edge exactly once
Hamiltonian pathA path that visits every vertex exactly once
Random walkA walk that moves to a randomly chosen neighbour at each step
Self-avoiding walkThe physicists' name for a path in a lattice

14. Frequently asked questions

What is the difference between a walk, a trail and a path?

A walk is any sequence of vertices joined by edges, and it may repeat both vertices and edges. A trail is a walk that never uses the same edge twice, although it may revisit a vertex. A path is a walk that never visits the same vertex twice, so it repeats no edge either. Every path is a trail and every trail is a walk.

What is the difference between a circuit and a cycle?

Both are closed: they end at the vertex where they started. A circuit is a closed trail, so it never repeats an edge but may pass through a vertex more than once. A cycle repeats no vertex at all except that it returns to the start, and in a simple graph it has length at least 3. Every cycle is a circuit, but a figure-eight route through one vertex twice is a circuit and not a cycle. Some books use the two words as synonyms, so check the definition in use.

Is an Eulerian path really a path?

Not in the strict sense. An Eulerian path uses every edge of a graph exactly once, and it usually passes through some vertices several times, so it is a trail rather than a path. That is why many authors prefer the name Eulerian trail. A Hamiltonian path, which visits every vertex exactly once, is a path.

Why do textbooks define path differently?

The vocabulary of graph theory was never fully standardised. Most graph theory books since the 1960s, such as those by Harary, West, Bondy and Murty, and Diestel, use walk for a route that may repeat anything and path for one that repeats no vertex. Rosen's Discrete Mathematics and Its Applications uses path for any walk and simple path for a route with no repeated edge. Always check the definition at the start of the book or paper.

How do you count the walks of length k between two vertices?

Raise the adjacency matrix A to the power k. The entry in row u and column v of A to the power k is the number of walks of length k from u to v. The diagonal of A squared lists the degrees, and the sum of the diagonal of A cubed, divided by 6, is the number of triangles. No such shortcut is known for counting paths, a problem Valiant proved #P-complete in 1979.

Is a single vertex a path?

Yes. A single vertex is a walk of length 0, and since nothing repeats it is also a path of length 0, called a trivial path. It is not a cycle, because a cycle in a simple graph needs at least 3 edges.

15. References

The definitions, theorems and attributions above come from these sources, listed in chronological order.

  1. Euler, L. (1741). "Solutio problematis ad geometriam situs pertinentis." Commentarii Academiae Scientiarum Petropolitanae 8, 128 to 140. Presented in 1736.
  2. Hierholzer, C. (1873). "Ueber die Möglichkeit, einen Linienzug ohne Wiederholung und ohne Unterbrechung zu umfahren." Mathematische Annalen 6, 30 to 32.
  3. Veblen, O. (1912). "An Application of Modular Equations in Analysis Situs." Annals of Mathematics, second series, 14, 86 to 94.
  4. Kőnig, D. (1916). "Über Graphen und ihre Anwendung auf Determinantentheorie und Mengenlehre." Mathematische Annalen 77, 453 to 465.
  5. Pólya, G. (1921). "Über eine Aufgabe der Wahrscheinlichkeitsrechnung betreffend die Irrfahrt im Straßennetz." Mathematische Annalen 84, 149 to 160.
  6. Berge, C. (1958). Théorie des graphes et ses applications. Paris: Dunod.
  7. Ore, O. (1962). Theory of Graphs. American Mathematical Society Colloquium Publications 38. Providence, RI: American Mathematical Society.
  8. Harary, F. (1969). Graph Theory. Reading, MA: Addison-Wesley.
  9. Garey, M. R. and Johnson, D. S. (1979). Computers and Intractability: A Guide to the Theory of NP-Completeness. San Francisco: W. H. Freeman.
  10. Valiant, L. G. (1979). "The Complexity of Enumeration and Reliability Problems." SIAM Journal on Computing 8(3), 410 to 421.
  11. Biggs, N. (1993). Algebraic Graph Theory, 2nd edition. Cambridge: Cambridge University Press.
  12. Brin, S. and Page, L. (1998). "The Anatomy of a Large-Scale Hypertextual Web Search Engine." Computer Networks and ISDN Systems 30(1 to 7), 107 to 117.
  13. West, D. B. (2001). Introduction to Graph Theory, 2nd edition. Upper Saddle River, NJ: Prentice Hall.
  14. Bondy, J. A. and Murty, U. S. R. (2008). Graph Theory. Graduate Texts in Mathematics 244. London: Springer.
  15. Chartrand, G. and Zhang, P. (2012). A First Course in Graph Theory. Mineola, NY: Dover.
  16. Rosen, K. H. (2012). Discrete Mathematics and Its Applications, 7th edition. New York: McGraw-Hill.
  17. Perozzi, B., Al-Rfou, R. and Skiena, S. (2014). "DeepWalk: Online Learning of Social Representations." Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 701 to 710.
  18. Diestel, R. (2017). Graph Theory, 5th edition. Graduate Texts in Mathematics 173. Berlin: Springer.

Find the shortest walk yourself

Draw the strip of triangles in the visualizer and run breadth-first search from A. It reaches F after 3 steps: the length of the shortest walk, and therefore of the shortest path.

Open the visualizer

Trace Every Edge Once

Draw the strip of triangles and run the Eulerian path tool. It finds a trail from B to E that uses all nine edges once, passing through four of the vertices twice on the way.

Launch the Eulerian Path Visualizer