Walks, Paths, and Repeated Vertices
A walk follows consecutive edges and can return to a vertex. A simple path visits each vertex at most once.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Read a repeated route
On links A–B, B–C, and C–A, A, B, C, A, B is a walk. It visits A and B repeatedly. The prefix A, B, C is a simple path. Vertices and edges determine whether each consecutive move is allowed.
Check what is being counted
A graph can have walks of unbounded length if cycles are permitted, even with few vertices. A query returning routes usually needs length limits or a simple-path rule. A visited set can avoid repeated expansion for reachability.[1]
Track repeated vertices independently from repeated edges
On a triangle A, B, C with an extra edge C–D, the walk A, B, C, A, C, D repeats vertices. Even if repeated edges were forbidden, a traversal could still revisit A through a cycle. A simple path from A to D can use A, C, D. See cycle witnesses.
Walk lengths: A–B–C–A–C–D has 5 edges
Simple path A–C–D has 2 edges
A–B–C–A is a closed walk and a simple cycle
Start by choosing exactly which repetition is allowed
Reachability can usually be witnessed by a simple path because repeated portions can be removed from a walk. Counting walks of a fixed length is a different question and can include repeated vertices.