Apply the Floyd–Warshall algorithm to the following adjacency matrix of a directed graph with vertices 1, 2, 3:
D(0)=02∞301∞50
Compute the all‐pairs shortest‐path distance matrix D(3).
Question 2
Skill question
A graph has adjacency matrix
D(0)=0∞4∞50∞∞∞30∞10∞10
After running Floyd–Warshall, what is the distance from 3 to 2? Show the key update steps.
Question 3
Skill question
The graph below has 4 vertices and edge weights (∞ means no direct edge):
D(0)=02∞∞10∞∞∞30∞5∞20
Perform the Floyd–Warshall algorithm and give D(4).
Question 4
Skill question
Using Floyd–Warshall, find the shortest‐path distance from vertex P to Q in this graph of 5 nodes given by
D(0)=0∞∞1∞20∞∞∞∞302∞12∞0∞∞∞450
and specify the path.
Question 5
Skill question
Given the weighted directed graph with vertices A, B, C, D and adjacency matrix
D(0)=0∞∞∞40∞∞∞30∞10∞10
use Floyd–Warshall to find the matrix of shortest distances.
Question 6
Skill question
Apply the Floyd–Warshall algorithm to detect whether the following graph has a negative‐weight cycle. The adjacency matrix is
D(0)=0∞410∞∞−20
Question 7
Skill question
Construct the transitive closure matrix of the graph
D(0)=0∞∞110∞∞∞10∞∞∞10
and compare it to the reachability after Floyd–Warshall.
Question 8
Skill question
In a network of 6 nodes, the distance matrix at iteration k=0 is given. Describe generally how Floyd–Warshall would process k from 1 to 6, and explain the time complexity.
Question 9
Skill question
Given the following weighted directed graph on vertices {1,2,3,4}, compute the predecessor matrix Π(4) alongside the distance matrix by running Floyd–Warshall on
D(0)=06∞∞802∞∞40∞1∞30.
Question 10
Skill question
Apply Floyd–Warshall to find the shortest‐path distance matrix for the following 5×5 matrix, and then reconstruct the shortest path from vertex 1 to 5:
D(0)=0∞∞1∞20∞∞∞∞302∞12∞0∞∞∞450
Question 11
Skill question
A graph on vertices {A,B,C,D,E} has negative edge weights but no negative cycles. Its initial matrix is
D(0)=0∞∞2∞304∞∞8∞0−5∞∞1∞06−47∞∞0
Use Floyd–Warshall to compute all‐pairs distances.