LOGBOOK

HELP

Quiz Entry - updated: 2026.11.27

What is a cycle in a graph, and when is it simple?

A cycle is a circular sequence of alternating vertices and edges: it starts with a vertex and ends with an edge that leads back to that first vertex. It is simple if all its vertices and edges are distinct: C1 = (V, b, X, g, Y, f, W, c, U, a) is simple; C2 = (U, c, W, e, X, g, Y, f, W, d, V, a) is not, because W appears twice.

Cycle C1 through V, X, Y, W and U highlighted, next to cycle C2 that passes W twice

* A cycle's last edge, a in both examples, closes the circle back to the start. *

Unlike a path, a cycle's sequence ends with an edge, not with a vertex: in C1 the closing edge a leads from U back to V, where the cycle began. Because the sequence is circular, it can be started anywhere: (X, g, Y, f, W, c, U, a, V, b) describes the same cycle as C1.

Cycles are what separate trees from other graphs: a tree is exactly a connected graph without any cycle. A directory tree turns into a graph with a cycle as soon as a symbolic link (a shortcut) points back up the tree; a program that walks the directories and follows links then runs in circles unless it detects the loop. In a directed graph of dependencies ("task A needs task B first"), a directed cycle means the tasks wait for each other in a circle, so no valid order exists.

Go deeper:

From Quiz: ADS / Graphs: Basics, Representations and Spanning Trees | Updated: Nov 27, 2026