Log In
5 votes

in Algorithms 557 views
C, 1st statement false because if distance b/w  s-a is 1, a-b=1, b-t=1 & s-t=4; So shortest distance is s-a-b-t= 3; & if we add 1 in every edge so s-a-b-t=6 & s-t=5 .In this case shortest path is change.          2nd statement is true; take same data now double each edge so new distance s-a-b-t=6 & s-t=8; So shortest distance remain same.

2 Answers

5 votes
Best answer

By using counter Example:

Here shortest path from s TO t is A to B and B to D. Let's increase edge weight of each edge by 3. Now the shortes path from s To t is A to D that is 7. So S1 is false.

if we multiply edge weights with same number the edge weights are increased in same ratio so No change in path but total weight has been changed.

So ans is option C.

selected by
Nice explanation @Gabbar..
4 votes

Consider above graph,


Now suppose shortest path from S to A was S-B and then B-A. shortest path length = SB + BA = 5+5 =10

Now if we increase weight of each edge by 1, then new shortest path will be

shortest path length = min (SB + BA, SA)= min(6+6,11) =11

that means shortest path has changed. So S1 is wrong


Now even if we double the edge weight shortest path remains the same

shortest path length = min(SB + BA, SA) = min(10+10,20) = 20

that means shortest path is still S-B and then B-A

So S2 is correct

Hence answer should be C)

Related questions

1 vote
1 answer
Read the following statements below For all the below questions consider the graph as simple and has positive weight edges. (i) Let the cost of the shortest path between two nodes is S.If the weight of every edge in the graph is doubled then weight of the shortest ... iii) We can use Kruskal's algorithm to find Minimum spanning tree of a directed graph . How many of the above statements are true.
asked Dec 13, 2017 in Algorithms VIKAS TIWARI 345 views
1 vote
3 answers
For a given undirected weighted graph G with V number of vertices, if you want to find all pair shortest paths then which one of the following is true ? a) run dijkstra's shortest path algorithm only once. b) run dijkstra's shortest path algorithm V times. What if the given graph is directed ?
asked Jun 26, 2017 in Algorithms Abhisek Saha 397 views
0 votes
0 answers
I have a small doubt. Chapter 25 All pairs shortest path of CLRS says following: To solve the all-pairs shortest-paths problem on an input adjacency matrix, we need to compute not only the shortest-path weights but also a predecessor matrix $\Pi=(\pi_{ij})$, where $\pi_{ij}$ ... $i$ and predecessor subgraph of $G$ for $i$) the same?
asked Mar 24, 2018 in Programming GateAspirant999 116 views