What is difference between cycle, path and circuit in Graph Theory
All of these are sequences of vertices and edges. They have the following properties :
- Walk : Vertices may repeat. Edges may repeat (Closed or Open)
- Trail : Vertices may repeat. Edges cannot repeat (Open)
- Circuit : Vertices may repeat. Edges cannot repeat (Closed)
- Path : Vertices cannot repeat. Edges cannot repeat (Open)
- Cycle : Vertices cannot repeat. Edges cannot repeat (Closed)
NOTE : For closed sequences start and end vertices are the only ones that can repeat.
Usually a path in general is same as a walk which is just a sequence of vertices such that adjacent vertices are connected by edges. Think of it as just traveling around a graph along the edges with no restrictions.
Some books, however, refer to a path as a "simple" path. In that case when we say a path we mean that no vertices are repeated. We do not travel to the same vertex twice (or more).
A cycle is a closed path. That is, we start and end at the same vertex. In the middle, we do not travel to any vertex twice.
It will be convenient to define trails before moving on to circuits. Trails refer to a walk where no edge is repeated. (Observe the difference between a trail and a simple path)
Circuits refer to the closed trails, meaning we start and end at the same vertex.