Data Structures & AlgorithmsHardICPC regional · GATE CS

Simple undirected graph on vertices 0 to 4 with edges: 0–2, 0–4, 0–3, 3–4, 0–1, 1–3, 1–4. How many simple cycles does it contain? A cycle has at least 3 distinct vertices and is counted once however it is traversed.

  1. A. 3
  2. B. 4
  3. C. 7
  4. D. 14

Correct answer: C. 7

Enumerating each cycle from its smallest vertex gives 7 simple cycles. The cycle rank (3) counts independent cycles only, the triangles (4) are a subset, and doubling for direction is a slip.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic