Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
A connected undirected graph has the vertices A, D, J, M, S, Z and the edges M–Z, Z–S, Z–J, Z–A, S–D, S–A, D–A. How many bridges does it have (edges whose removal disconnects the graph)?
- A. 4
- B. 2
- C. 1
- 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 1 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
- A flow network has source S and sink T, with directed arcs and capacities in brackets: S→E (4), S→T (9), C→D (8), C→T (3), B→E (6), B→T…
- A tree has the vertices A, E, G, I, K, L, N, O, W and the edges G–W, W–O, O–E, E–L, G–I, G–A, A–K, O–N. A centroid is a vertex whose…
- A tree has vertices A, B, F, H, I, K, M, Q, S and weighted edges (weights in brackets): Q–S (5), Q–M (4), Q–K (1), S–H (3), Q–A (7), K–B…
- A flow network has source S and sink T, with directed arcs and capacities in brackets: S→E (8), S→T (3), B→E (6), B→T (7), E→T (9), C→E…
- Floyd–Warshall runs on vertices 1 to 4 with these arcs u→v (weight): 1→3 (1), 1→4 (4), 2→1 (1), 2→3 (3), 3→1 (12), 3→2 (11), 3→4 (3), 4→1…
- A directed acyclic graph has the vertices C, D, H, I, U, X and the arcs U→I, U→H, U→C, D→I, D→C, X→I, X→C, H→C. Two players alternately…