Data Structures & AlgorithmsModerateGATE CS · ICPC regional
A connected undirected graph has the vertices A, I, J, N, O, X, Z and the edges A–X, A–O, X–O, X–I, O–Z, O–N, I–N, I–J. How many bridges does it have (edges whose removal disconnects the graph)?
- A. 1
- B. 2
- C. 4
- D. 3
Correct answer: B. 2
Removing each edge in turn and testing connectivity finds 2 bridges. The cyclomatic number m − n + 1 = 2 counts independent cycles, not bridges; there are 2 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 graph has the vertices D, G, L, Q, R, X, Y and the edges R–G, Y–R, L–X, Y–G, D–R, Y–L, D–G. How many simple cycles does it…
- Grid with 3 rows and 3 columns (top to bottom). A cell marked G is a gate; '.' is a normal cell: .G. G.. ... Each step, which is a move to…
- Two unmarked jugs hold 7 litres and 9 litres. Allowed operations: fill a jug completely, empty a jug completely, or pour one jug into the…
- A tree has vertices E, H, I, K, L, M, V, Z and weighted edges (weights in brackets): I–E (5), I–L (9), I–H (9), E–K (6), K–Z (7), E–M (1)…
- A directed acyclic graph has the vertices D, E, I, Q, R, U, Z and the edges D→R, D→E, Z→D, Z→R, Z→Q, Z→E, R→U, Q→D, I→D. A topological…
- A directed graph has the vertices H, J, M, T, X, Y and the arcs M→T, M→X, T→X, J→Y, X→Y, Y→T, Y→J. How many strongly connected components…