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?

  1. A. 6
  2. B. 4
  3. C. 5
  4. 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

Exams that ask this topic