GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A weighted undirected graph on vertices A–G has edges AB 4, AC 8, BC 2, BD 5, CD 9, CE 10, DE 3, DF 11, EF 4, EG 7, FG 5, BG 20. Its MST has weight 23. What is the minimum weight among all spanning trees that differ from this MST (the second-best MST)?
- A. 24
- B. 26
- C. 25
- D. 27
Correct answer: C. 25
The MST is AB, BC, BD, DE, EF, FG. Adding a non-tree edge and deleting the heaviest tree edge on its cycle changes the weight by +4 (AC), +4 (CD), +5 (CE), +7 (DF) and +2 (EG replacing FG). The smallest change is +2, so the second-best weight is 25.
More Algorithms questions
- How many spanning trees does the wheel graph W₅ have (a hub joined to every vertex of a 5-cycle: 6 vertices, 10 edges)?
- How many spanning trees does the 3-dimensional hypercube Q₃ (8 vertices, 12 edges) have?
- A DAG on vertices 1–8 has edges 1→2, 1→3, 2→4, 3→4, 4→5, 4→6, 5→7, 6→7, 3→8, 8→7. How many different topological orderings does it have?
- A DFS on a directed graph processes vertices in alphabetical order and each adjacency list in alphabetical order. Edges: A→B, A→C, A→E…
- A directed graph on A–K has edges A→B, B→C, C→A, C→D, D→E, E→F, F→D, G→F, G→H, H→I, I→G, B→H, E→J, K→J, K→A. Let s be its number of…
- The directed graph on vertices A–K has edges A→B, B→A, C→D, D→C, E→F, F→G, G→E, A→H, C→H, E→H, H→I, H→J, I→K, J→K, B→J. What is the…