CS FundamentalsVery hardWipro · Accenture pattern

Run Dijkstra's algorithm on this undirected weighted graph (edges given as node-node:weight): A-B:1, A-C:4, B-C:2, B-D:6, C-D:1. Starting from A, what is the shortest-path distance to D?

  1. A. 3
  2. B. 6
  3. C. 4
  4. D. 5

Correct answer: C. 4

Dijkstra from A settles nodes in increasing distance order; the shortest-path distance it finds to D is 4.

More Computer Networks questions

Exams that ask this topic