GATE CSE
First time here? Checkout the FAQ!
x
+4 votes
95 views

asked in Algorithms by Active (1.4k points)   | 95 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.

 

answered by Veteran (22.7k points)  
selected by
Nice explanation @Gabbar..
+3 votes

 

Consider above graph,

S1)

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

S2)

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)

answered by Boss (7.8k points)  


Top Users May 2017
  1. akash.dinkar12

    3140 Points

  2. pawan kumarln

    1606 Points

  3. sh!va

    1580 Points

  4. Arjun

    1316 Points

  5. Devshree Dubey

    1230 Points

  6. Angkit

    1020 Points

  7. Debashish Deka

    1012 Points

  8. Bikram

    970 Points

  9. LeenSharma

    796 Points

  10. srestha

    658 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. pawan kumarln

    232 Points

  2. jjayantamahata

    106 Points

  3. joshi_nitish

    106 Points

  4. Ahwan

    96 Points

  5. Aditya GN

    63 Points


22,717 questions
29,045 answers
65,029 comments
27,454 users