## Posts Tagged ‘**Tropical Geometry**’

## Tropical Representation of the All-Pairs Shortest Path Problem

### Motivation

While I was doing my Abstract Algebra research the other month, I came across an interesting way of simplifying the representation of the all-pairs shortest path problem using Tropical Geometry. I thought it was pretty clever, so I thought I’d do a quick write-up.

### Problem Statement

The all-pairs shortest path problem is to identify the minimum path cost, , out of the possible paths between vertices and .

### Proposition

Consider a weighted directed graph (digraph), , consisting of vertices, , and directed edges (arcs), , and a function, , yielding the weight of an edge. Only those weights from the positive affinely extended real numbers, , are allowed per the problem statement. The adjacency matrix representation, , of is given by the following matrix:

Now, consider a semi-ring over whose additive operator, , is given by the minimum function, , and whose multiplicative operator, , is given by addition, . The additive unit is given by infinity, , and the multiplicative unit by zero, . This semi-ring is the Tropical Semi-ring . (The namesake of *tropical* is in honor of Brazilian Imre Simon who developed this branch of mathematics.)

Linear algebra constructs can be tropicalized to yield the familiar definitions for matrix addition and multiplication for matricies and .

Given the two prior statements, the elegant solution to the all-pairs shortest path problem is given by taking powers of the adjacency matrix: .

### Proof

To see how this works out, start with . The matrix represents the minimum cost between any two adjacent vertices. In other words, the minimum cost for all paths containing a single edge. The next inductive step is to consider paths containing at most two adjacent edges. Squaring the adjacency matrix yields all such paths. When the matrix is squared, each edge is concatenated to all other adjacent edges and the minimum weight of the paths is selected. This thought process can iterated as follows:

The result is a typical Bellman equation. A graph can have at most edges between any two vertices, thus, the solution to the all-pairs shortest path problem is given by .

### Example

As a worked example, consider the following graph whose set of vertices is given by the set , set of arcs by and weight function, , as labeled on the graph.

The all-pairs shortest paths are given by the following calculations where the row and column coordinates correspond to the vertices of . Values in **bold** denote a change in the shortest path between two vertices.

### Computational Complexity

From asymptotic standpoint, tropical matrix multiplication is still on the order of traditional matrix multiplication of . Computing the all-pairs shortest path problem using this approach is on the order of since we must perform the tropical matrix multiplication times. Now, This can be improved slightly since tropical matrix multiplication is associative, so we can leverage the repeated squaring approach and reduce the time complexity down to .

The time complexity can be further reduced to using the Floyd-Warshall Algorithm, which is another dynamic programming approach that is similar in form to the tropical representation of the problem. In essence, it follows the same base case, but it’s recurrence statement only considers a range of vertices with respect to the two vertices being considered. A more in depth review of the algorithm can be found in the references.

### References

“Floyd-Warshall’s Algorithm.” *Algorithmist*. Web. 12 Apr. 2012.

Cormen, Thomas H., Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. “25.2 The Floyd-Warshall Algorithm.” *Introduction to Algorithms*. 2nd ed. Cambridge, MA: MIT, 2001. 629-35. Print.

Diestel, Reinhard. *Graph theory*. Heidelberg New York: Springer, 2010.

Laface, Antonio. *Introduction to Tropical Geometry* [pdf]. 29 Nov. 2006. Web. 11 Apr. 2012.

Maclagan, Diane, and Bernd Sturmfels. *Introduction to Tropical Geometry* [pdf]. 4 Nov. 2009. Web. 9 Apr. 2012.

Mohri, Mehryar. “Semiring Frameworks and Algorithms for Shortest-Distance Problems” [pdf]. *Journal of Automata, Languages and Combinatorics* 7 (2002) 3: 321-50. 8 Aug. 2002. Web. 31 Mar. 2012.