Walks, Trails, Paths, Cycles, and Circuits are different ways of moving through a graph by following its vertices and edges. They differ in whether vertices or edges can be repeated and are used to analyze routes, networks, and graph structures.
Example:
In a road network, a walk may revisit roads and places, a trail does not repeat any road, a path does not repeat any place, and a cycle (or circuit) starts and ends at the same vertex.
Question 1. Find a trail from A to D for below graph below
A - B
| |
C - D
One possible trail is: A → B → D.
Question 2. Find the shortest path from A to C.
A - B - C
| |
D - E
The shortest path is: A → B → C.
Question 3. Finding All Possible Paths
A - B - C
| |
D - E
The path is : A → B → C
Practice Problems
Graph for Reference:
A
/ | \
B C D
\ | /
E
|
F
- Find a path from A to F.
- Find a simple path from B to F.
- Find a trail that uses every edge exactly once.
- Identify a cycle in the graph.
- Find the shortest path from A to E.
- List all possible paths from E to F.
- Find a trail from C to F.
- Find the longest simple path in the graph.
- Count the number of distinct cycles in the graph.
- Find a path from A to F that consists of exactly 3 edges.