All-Pairs Shortest Path
         Theory and Algorithms


   Carlos Andres Theran Suarez
Program Mathematics and Scientific Computing
        University of Puerto Rico
            Carlos.theran@upr.edu

                October – 2011
             Mayaguez-Puerto Rico


                        Dr Marko Schütz
Introduction
Recall
What do you think?

Can we solve all-pair shortest paths by running a
single source-paths algorithms?
What do you think?

Can we solve all-pair shortest paths by running a
single source-paths algorithms?
What do you think?

Can we solve all-pair shortest paths by running a
single source-paths algorithms?
What do you think?

Can we solve all-pair shortest paths by running a
single source-paths algorithms?
What do you think?

Can we solve all-pair shortest paths by running a
single source-paths algorithms?
What do you think?

Can we solve all-pair shortest paths by running a
single source-paths algorithms?
Predecessor Matrix
Predecessor Matrix
Outline

1. Present a dynamic programming algorithms based on
   matrix multiplication to solve the problem.

2. Dynamic programming algorithms called Floyd-Warshall
   algorithms.

3. Unlike the others algorithms, Johnson's algorithms used
   adjacency-list representation of a graph.
Shortest path and matrix multiplication
Shortest path and matrix multiplication (cont.)
Shortest path and matrix multiplication (cont.)
Shortest path and matrix multiplication (cont.)
Shortest path and matrix multiplication (cont.)
Shortest path and matrix multiplication (cont.)
Shortest path and matrix multiplication (cont.)
Shortest path and matrix multiplication (cont.)
The Floyd-Warshall algorithm
The Floyd-Warshall algorithm (cont)
The Floyd-Warshall algorithm (cont)
The Floyd-Warshall algorithm (cont)
The Floyd-Warshall algorithm (cont)
The Floyd-Warshall algorithm (cont)
Johnson's algorithm for sparse graphs.


• It is asymtoticaly better than repeated squaring of matrices
  or the Floyd-Warshall algoritm.

• It use a subroutine both Dijkstra’s algorithm and Bellman-
  Ford algorithm.

• Johnson's algorithm use the technique of reweighting.
Johnson's algorithm for sparse graphs (cont.).
Johnson's algorithm for sparse graphs (cont.).
Johnson's algorithm for sparse graphs (cont.).
• Producing no negative weight by reweighting
Johnson's algorithm for sparse graphs (cont.).
Johnson's algorithm for sparse graphs (cont.).

My presentation all shortestpath