Data Structures & AlgorithmsHardCodeforces Div 2 C · GATE CS
A connected undirected graph has the vertices B, D, I, N, O, P, Z and the edges I–P, I–B, I–Z, I–N, P–N, P–O, B–D, Z–N. How many bridges does it have (edges whose removal disconnects the graph)?
- A. 3
- B. 2
- C. 4
- D. 5
Correct answer: A. 3
Removing each edge in turn and testing connectivity finds 3 bridges. The cyclomatic number m − n + 1 = 2 counts independent cycles, not bridges; there are 3 articulation vertices, and 2 vertices of degree 1.
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
- An undirected connected graph on 6 vertices has the edges (weights in brackets, all distinct): U–O (17), F–O (26), O–P (18), U–V (10), F–P…
- A directed weighted graph has the arcs u→v (weight): X→L (9), X→K (15), L→X (11), L→O (3), L→K (1), L→M (15), O→X (11), O→L (5), O→M (7)…
- The directed acyclic graph has the vertices A, Q, T, V, W, Z and the arcs A→T, Z→Q, A→Q, W→T, Q→T, V→T, Z→V, A→V, V→Q. How many distinct…
- Two unmarked jugs hold 3 litres and 7 litres. Allowed operations: fill a jug completely, empty a jug completely, or pour one jug into the…
- A tree on the vertices E, H, N, U, W, Z has the arcs H→N, N→Z, U→N, U→E, W→Z (each undirected edge is directed as shown). You may reverse…
- A directed graph with no directed cycles has arcs u→v (weight) : V→K (4), V→X (3), K→F (-1), K→X (-2), F→X (8), X→W (8). Weights may be…