The floyd-warshall algorithm for all pair shortest path problem is based on ______________ paradigm.
Design and analysis of algorithms
Raqeeb_uddin
#2
Floyd Warshall Algorithm is a Dynamic Programming based algorithm.
It finds all pairs shortest paths using recursion.
For every pair (a, b) of source and destination, there are two possible cases.
- c is not an intermediate vertex in shortest path from a to b. We keep the value of dist[a][b] as it is.
- c is an intermediate vertex in shortest path from a to b. We update the value of dist[a][b] as dist[a][c] + dist[c][b].