Data Structures & AlgorithmsVery hardICPC regional · GATE CS

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

Correct answer: B. 6

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic