Question: 1 . Examine the pseudo code below: let path [ V ] [ V ] = { 0 } let weight [ V ] [

1.Examine the pseudo code below:
let path [V][V ]={0}
let weight [V][V ]= 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
Q1: What algorithm is this?
Q2: After the algorithm has completed, I want to be able to print the path from i = v1 to j = v2
Give pseudo code to print the discovered path from v1 to v2.
2.Examine the pseudo code below:
// a and b are nodes in a graph
// path[a,b] defines the next node on the shortest route from a to b.
// If there is no in-between node then path[a,b]== b
function PrintPath(a,b)//start and end points in graph
k = path[a,b]//the in-between point
while k != b //if k == b then there's no in-between
while path[a,k]!= k //search for second stop
k = path(a, k)
print (a)//print first point
a = k //second point becomes first point
k = path[a, b]//set the in-between point for next iteration
print (a)
print (b)
end
This recovers the path from Floyd-Warshall APSP. Assume a suitable adjacency matrix. Give the Floyd-Warshall 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 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!