Question: Floyd's algorithm is applied to the directed graph of problem 1. What will be the content of array P after it finishes execution? procedure Floyd(

Floyd's algorithm is applied to the directed graph of problem 1. What will be the content of array P after it finishes execution?

procedure Floyd( var A: array[1 ..n, 1 ..n] of real; var P: array[1..n, 1..n] of integer; C: array[1..n, 1..n] of real); var i, j, k: integer; begin for i := 1 to n do for j := 1 to n do begin A[i,j] := C[i,j]; P[i,j] := 0 end; for i := 1 to n do A[i,i] := 0; for k := 1 to n do for i := 1 to n do for j := 1 to n do if A[i,k]+A[k,j]then begin A[i,j] := A[i,k]+A[k,j]; P[i,j] := k end; end;

(I solved problem 1 already, here's the question for reference)

Floyd's algorithm is applied to the directed graph of problem 1. What

1. Trace the execution of Dijkstra's algorithm applied to a directed graph described by the following cost matrix. Choose vertex 1 as the source C[3,2]-1, CI4,51-1, CI5,6]-1. procedure Dijkstra; begin for i :-2 to n do begin D[i] := C[Li]; P[i] := 1 end; for i-= 1 to n-1 do begin choose a vertex win V-S such that DIW] is minimum, add w to S; for each vertex vin V-S do if D[v] > D[w]+ C[w,v] then begin D[y] := D[w] + C[w,y]; end end end; 1. Trace the execution of Dijkstra's algorithm applied to a directed graph described by the following cost matrix. Choose vertex 1 as the source C[3,2]-1, CI4,51-1, CI5,6]-1. procedure Dijkstra; begin for i :-2 to n do begin D[i] := C[Li]; P[i] := 1 end; for i-= 1 to n-1 do begin choose a vertex win V-S such that DIW] is minimum, add w to S; for each vertex vin V-S do if D[v] > D[w]+ C[w,v] then begin D[y] := D[w] + C[w,y]; end end end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!