Question: 1 . Examine the pseudo code below: let path [ V ] [ V ] = { 0 } let weight [ V ] [
Examine the pseudo code below:
let path VV
let weight VV initialWeights
for all k in V
for all i in V
for all J in V
if i j or i k or j k
continue;
let wt weight i k weight k j
if wt weight i j
weight i j wt
path i j k
Q: What algorithm is this?
Q: After the algorithm has completed, I want to be able to print the path from i v to j v
Give pseudo code to print the discovered path from v to v
Examine the pseudo code below:
a and b are nodes in a graph
pathab defines the next node on the shortest route from a to b
If there is no inbetween node then pathab b
function PrintPathabstart and end points in graph
k pathabthe inbetween point
while k b if k b then there's no inbetween
while pathak k search for second stop
k patha k
print aprint first point
a k second point becomes first point
k patha bset the inbetween point for next iteration
print a
print b
end
This recovers the path from FloydWarshall APSP. Assume a suitable adjacency matrix. Give the FloydWarshall algorithm for building the path table used above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
