Data Structures & AlgorithmsVery hardCodeforces Div 2 D · ICPC regional
A connected undirected graph has the vertices D, H, J, K, L, T and the edges J–L, J–D, J–H, D–K, D–T, K–T, T–H. How many bridges does it have (edges whose removal disconnects the graph)?
- A. 0
- B. 1
- C. 3
- D. 2
Correct answer: B. 1
Removing each edge in turn and testing connectivity finds 1 bridges. The cyclomatic number m − n + 1 = 2 counts independent cycles, not bridges; there are 1 articulation vertices, and 1 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 tree has the vertices D, E, G, H, I, T, U, X, Z and the edges D–T, D–H, T–G, H–E, E–X, D–Z, T–U, Z–I. What is the minimum number of…
- An undirected graph has the vertices E, J, K, M, X and the edges X–M, X–K, X–J, M–J, K–J, K–E. A walk may repeat vertices and edges. How…
- Cities I, P, S, U, X are joined by roads with these travel costs: U–S 12, U–I 1, U–P 20, U–X 18, S–I 11, S–P 13, S–X 7, I–P 19, I–X 6, P–X…
- An undirected connected graph on 5 vertices has the edges (weights in brackets, all distinct): J–I (26), C–W (25), X–W (27), I–W (24), I–X…
- A tree has vertices with weights in brackets: D[7], N[2], H[11], W[9], L[10], T[5], F[14]. The edges are D–N, N–H, D–W, N–L, W–T, N–F. A…
- A connected undirected graph has the vertices I, K, N, P, U, W and the edges U–W, U–N, U–P, W–K, W–I, N–K, N–I. How many bridges does it…