A cycle is a path in a graph that begins and ends at the same node. In other words, the cycle does not visit any node more than once and returns to its starting node; more technically, the subgraph formed by the cycle is such that each node has degree 2.
In the graph below, the edges connecting nodes 2, 3, 4, and 5 form a cycle, as do the edges
connecting nodes 1, 2, and 5. Furthermore,
For cycles in directed graphs, see directed cycle.