Let be a directed, weighted graph with weight function . For some function , for each edge, define as .
Which one of the options completes the following sentence so that it is TRUE?
“The shortest paths in under are shortest paths under too,_____________”.
View worked solution
Answer: A
Let be any path from a start vertex to an end vertex . The weight of the path under the new weight function is given by:
Expanding this sum, the terms involving form a telescoping series:
For any two vertices and , the term is a constant that depends only on the endpoints and , and not on the specific path chosen between them.
Therefore, for any two paths and from to :
This preservation of relative path weights ensures that a path is a shortest path under if and only if it is a shortest path under . Since this property holds regardless of the values assigned by , it is true for every .
Free practice · Your answers on this page are not saved.
