Data Structures & AlgorithmsHardICPC regional · GATE CS
Simple undirected graph on vertices 0 to 4 with edges: 1–2, 0–1, 0–3, 0–2, 2–4, 3–4. How many simple cycles does it contain? A cycle has at least 3 distinct vertices and is counted once however it is traversed.
- A. 3
- B. 2
- C. 1
- D. 6
Correct answer: A. 3
Enumerating each cycle from its smallest vertex gives 3 simple cycles. The cycle rank (2) counts independent cycles only, the triangles (1) are a subset, and doubling for direction is a slip.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- 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…
- Simple undirected graph on vertices 0 to 4 with edges: 0–4, 0–2, 1–4, 2–4, 1–2, 0–1, 2–3. How many simple cycles does it contain? A cycle…
- Simple undirected graph on vertices 0 to 6 with edges: 1–2, 0–5, 1–6, 0–3, 0–1, 5–6, 0–4, 1–4, 0–6, 4–6. How many simple cycles does it…
- Simple undirected graph on vertices 0 to 5 with edges: 0–5, 1–2, 1–5, 4–5, 2–5, 0–3, 2–3. How many simple cycles does it contain? A cycle…
- 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…
- Simple undirected graph on vertices 0 to 4 with edges: 0–1, 1–4, 1–3, 3–4, 2–3, 0–4, 0–2, 0–3. How many simple cycles does it contain? A…