GATE Computer ScienceHardGATE CS (PYQ pattern)
In the undirected weighted graph with edges SA 1, SB 1, SC 2, AD 2, BD 2, CD 1, AE 3, BE 3, CE 2, DT 2, ET 1 and AB 1, how many distinct simple paths from S to T have the minimum total weight?
- A. 6
- B. 4
- C. 5
- D. 8
Correct answer: A. 6
The shortest distance is 5, and enumerating all simple paths shows six that achieve it (shortest-path counting by cnt[v] = Σ cnt[u] over tight edges u→v gives the same). Counting only paths through distinct middle vertices undercounts them.
More Algorithms questions
- Bellman–Ford is run from A on a 6-vertex graph with directed edges relaxed in this fixed order in every pass: E→F 2, D→E 3, C→D 2, B→C 4…
- A weighted undirected graph has vertices A–F and edges AB 1, BC 1, CA 1, CD 2, DE 2, EC 2, EF 3, FD 3, AF 7. How many distinct minimum…
- 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…
- 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?