Data Structures & AlgorithmsHardICPC regional · GATE CS

Simple undirected graph on vertices 0 to 5 with edges: 0–2, 1–5, 2–5, 1–4, 1–3, 0–1, 3–5, 1–2, 0–5. 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. 4
  2. B. 12
  3. C. 5
  4. D. 24

Correct answer: B. 12

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic