The GATE Grind

GATE 2012 CS (CS1) – Question 50

Algorithms · Graph Algorithms: Traversals, Minimum Spanning Trees, Shortest Paths · 2 marks · Multiple choice

For the shown directed weighted graph, several S-to-T shortest paths exist. Dijkstra updates a vertex’s predecessor only on finding a strictly shorter distance. Which path does it report?

Diagram for GATE 2012 CS (CS1) question 50
  1. SDT
  2. SBDT
  3. SACDT
  4. SACET

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (D) SACET

Explanation

Distances from S settle B=3, A=4, C=5, E=6 and D=7. C improves E to six, giving predecessor C. E is settled before D and sets T to ten via E→T. D later offers the same T distance ten, which the strict-update rule does not adopt. Thus S→A→C→E→T, D.

More Graph Algorithms: Traversals, Minimum Spanning Trees, Shortest Paths questions

All Graph Algorithms: Traversals, Minimum Spanning Trees, Shortest Paths questions →