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.
- A. 3
- B. 4
- C. 7
- 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.
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 4 with edges: 2–3, 1–3, 0–2, 0–3, 1–4, 0–4, 0–1, 3–4. How many simple cycles does it contain? A…
- Undirected weighted graph on letters A to G with edges: E–F (34), E–G (31), A–G (25), B–G (14), D–E (11), A–F (17), C–G (35), F–G (21)…
- Undirected weighted graph on letters A to G with edges: C–D (32), D–E (10), A–E (12), F–G (9), B–G (1), D–G (6), E–G (14), B–F (21), B–D…
- Undirected weighted graph on letters A to F with edges: C–D (8), A–E (13), B–C (26), A–F (11), B–E (22), D–E (27), A–C (32), B–D (5), D–F…
- Undirected weighted graph on letters A to F with edges: C–D (24), B–C (31), D–F (26), B–F (11), B–D (9), A–B (6), C–F (16), D–E (8)…
- Undirected weighted graph on letters A to G with edges: D–F (23), A–C (16), C–G (36), C–F (12), A–G (10), B–D (8), E–F (34), A–E (18), A–D…