(seed = 194047)
Consider the following edge-weighted digraph with 8 vertices and 13 edges.
v->w weight
------------
A->F 3
A->E 2
B->A 27
B->C 1
C->F 4
D->C 56
D->H 32
F->E 16
F->B 13
G->F 10
G->C 18
H->C 19
H->G 6
Here is a graphical representation of the same edge-weighted digraph:
(A)<-----27-----(B)------1----->(C)<-----56-----(D)
|\ ^ /^^ |
| \ | / | \ |
| \ | / | \ |
| \ | / | \ |
| \ | / | \ |
| \ | / | \ |
| \ | / | \ |
2 3 13 4 18 19 32
| \ | / | \ |
| \ | / | \ |
| \ | / | \ |
| \ | / | \ |
| \ | / | \ |
| \ | / | \ |
v v|v | \v
(E)<-----16-----(F)<-----10-----(G)<-----6------(H)
Suppose that you run the Bellman-Ford algorithm to compute the shortest paths
from D to every other vertex. Give the sequence of 8 integers in the distTo[]
array immediately after the end of three passes of the algorithm (pass 0, 1, and 2).
Each pass consists of relaxing the 13 edges in the order given above.
Here is the distTo[] array before the beginning of pass 0:
v A B C D E F G H
------------------------------------------
distTo[v] - - - 0 - - - -