Menu

Let Simple Directed Graph D V V N Arc Costs Ca Given Consider Following Algorithm J V Set Q43834979

Let a simple directed graph D = (V, A) with |V | = n and arccosts ca, a ∈ A, be given. Consider the following algorithm:

for all i, j ∈ V set d(i, j) := 0 if i = j;

d(i, j) := c(i, j) if (i, j) ∈ A;

d(i, j) := ∞ else;

for k = 1, . . . , n do

for i = 1, . . . , n do

for j = 1, . . . , n do

if d(i, j) > d(i, k) + d(k, j), then set d(i, j) := d(i, k) +d(k, j).

Extend the Floyd–Warshall algorithm so that at the end, for alli, j ∈ V the variable p(i, j) indicates the predecessor of node jon some least-cost path from i. (This information can be used toreconstruct a least-cost path between any pair of nodes).

Do not need specific code, just write math ideas is fine.

Expert Answer


Answer to Let a simple directed graph D = (V, A) with |V | = n and arc costs ca, a ∈ A, be given. Consider the following algorit…

OR