GATE / CS ARCHIVE

GATE CSE 1996 / QUESTION 17(b)

Recover the shortest path

Algorithms · Graph Algorithms · Full GATE CSE 1996 paper

GATE 1996, Q17(b) Descriptive
Report issue

Graph Algorithms

Question 17(b), GATE 1996: In the GFG p9 directed graph, edges with weights are A→B:6, A→C:90, A→F:2, A→E:70, B→D:41, C→B:12, C→E:10, D→C:12, F→B:22, F→C:60, F→D:50, E→F:15. GateForum p15 swaps the names E and F while keeping these positions and weights. Start at A. Give the shortest A→E vertex sequence.
Question 17(b), GATE 1996: In the GFG p9 directed graph, edges with weights are A→B:6, A→C:90, A→F:2, A→E:70, B→D:41, C→B:12, C→E:10, D→C:12, F→B:22, F→C:60, F→D:50, E→F:15. GateForum p15 swaps the names E and F while keeping these positions and weights. Start at A. Give the shortest A→E vertex sequence.
Tap to enlarge
Answer & solution

Answer: A, B, D, C, E (no official key was published)

Use the the paper labels first. Initialize d(A)=0 and all other labels to infinity. Settle A: tentative B=6,C=90,F=2,E=70. Settle F (2): B via F would be 24 and does not improve 6; C improves to 62 and D becomes 52. Settle B (6): D improves to 6+41=47. Settle D (47): C improves to 47+12=59. Settle C (59): E improves to 59+10=69; the edge back to B gives 71 and changes nothing. Finally settle E (69), whose edge to F gives 84 and changes nothing.

Thus the settlement order is A,F,B,D,C,E, with final distances 0,2,6,47,59,69 in that order. Predecessors for the E path are E←C←D←B←A, giving A→B→D→C→E and cost 6+41+12+10=69. This improves on the direct A→E cost 70 and the route A→F→C→E cost 72. All weights are nonnegative, so Dijkstra's settled distances are final.

A material the paper difference changes the answer to the named destination. Applying that relabelling, its settlement order is A,E,B,D,C,F. Its shortest A→E path is the direct edge of weight 2; the 69-cost bottom-vertex path ends at F there. The answers must remain tied to the chosen diagram. Decimal labels 90,60,50,70,10 contain zero glyphs, not an added symbolic variable.

Original paper, page 9