The Floyd-Warshall algorithm for all-pair shortest paths computation is based on
View worked solution
Answer: C
The Floyd-Warshall algorithm is a classic Dynamic Programming algorithm used to find the shortest paths between all pairs of vertices in a weighted graph (which may contain negative edge weights, but no negative cycles).
Reasoning:
- The algorithm breaks the problem down into overlapping subproblems.
- Let represent the shortest path weight from vertex to vertex using only vertices from the set as intermediate nodes.
- The optimal substructure is defined by the recurrence relation:
- By computing and storing the solutions to these subproblems in a bottom-up manner (from to ), it avoids redundant computations, which is the defining characteristic of the Dynamic Programming paradigm.
Therefore, the correct option is C.
Free practice · Your answers on this page are not saved.
