Question: Suppose you are given a directed graph G-(V, E) with costs on the edges ce for e e E and a sink t (costs may

Suppose you are given a directed graph G-(V, E) with costs on the edges ce for e e E and a sink t (costs may be negative). Assume that you also have finite values d(v) for v e V. Someone claims that, for each node ve V, the quantity d(v) is the cost of the minimum-cost path from node v to the sink t (a) Give a linear-time algorithm (time O(m) if the graph has m edges) that verifies whether this claim is correct. (b) Assume that the distances are correct, and d(v) is finite for all v e V. Now you need to compute distances to a different sink t'. Give an O(m log n) algorithm for computing distances d'(v) for all nodes v E V to the sink node t'. (Hint: It is useful to consider a new cost function defined as follows: for edge e-(v, w), let c-ce - d(v) +d(w). Is there a relation between costs of paths for the two different costs c and c'?) Suppose you are given a directed graph G-(V, E) with costs on the edges ce for e e E and a sink t (costs may be negative). Assume that you also have finite values d(v) for v e V. Someone claims that, for each node ve V, the quantity d(v) is the cost of the minimum-cost path from node v to the sink t (a) Give a linear-time algorithm (time O(m) if the graph has m edges) that verifies whether this claim is correct. (b) Assume that the distances are correct, and d(v) is finite for all v e V. Now you need to compute distances to a different sink t'. Give an O(m log n) algorithm for computing distances d'(v) for all nodes v E V to the sink node t'. (Hint: It is useful to consider a new cost function defined as follows: for edge e-(v, w), let c-ce - d(v) +d(w). Is there a relation between costs of paths for the two different costs c and c'?)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
