Tropical Arithmetic and Shortest Paths

Similar documents
Tropical Islands. Jan Verschelde

x y = x + y. For example, the tropical sum 4 9 = 4, and the tropical product 4 9 = 13.

Single Source Shortest Paths

CS 241 Analysis of Algorithms

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk

Groups. s t or s t or even st rather than f(s,t).

Designing Information Devices and Systems I Spring 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

7 Matrix Operations. 7.0 Matrix Multiplication + 3 = 3 = 4

A Generalized Eigenmode Algorithm for Reducible Regular Matrices over the Max-Plus Algebra

Graph fundamentals. Matrices associated with a graph

An Introduction to Tropical Geometry

Designing Information Devices and Systems I Fall 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

CS173 Lecture B, November 3, 2015

A Solution of a Tropical Linear Vector Equation

(x 1 +x 2 )(x 1 x 2 )+(x 2 +x 3 )(x 2 x 3 )+(x 3 +x 1 )(x 3 x 1 ).

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

Lecture Notes for Chapter 25: All-Pairs Shortest Paths

Introduction to Algorithms

Dynamic Programming: Shortest Paths and DFA to Reg Exps

A Tropical Extremal Problem with Nonlinear Objective Function and Linear Inequality Constraints

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011

arxiv: v2 [math.oc] 28 Nov 2015

* 8 Groups, with Appendix containing Rings and Fields.

Lecture 3: graph theory

Tropical Algebra. Notes by Bernd Sturmfels for the lecture on May 22, 2018, in the IMPRS Ringvorlesung Introduction to Nonlinear Algebra

MATH SOLUTIONS TO PRACTICE MIDTERM LECTURE 1, SUMMER Given vector spaces V and W, V W is the vector space given by

arxiv: v1 [math.co] 13 May 2016

CMPSCI 250: Introduction to Computation. Lecture #11: Equivalence Relations David Mix Barrington 27 September 2013

All-Pairs Shortest Paths

CS103 Handout 08 Spring 2012 April 20, 2012 Problem Set 3

Introduction to Algorithms

Analysis of Algorithms. Outline. Single Source Shortest Path. Andres Mendez-Vazquez. November 9, Notes. Notes

Matching Polynomials of Graphs

Analysis of Algorithms I: All-Pairs Shortest Paths

CS 246 Review of Linear Algebra 01/17/19

CS 4407 Algorithms Lecture: Shortest Path Algorithms

THE BOOLEAN IDEMPOTENT MATRICES. Hong Youl Lee and Se Won Park. 1. Introduction

Dynamic Programming: Shortest Paths and DFA to Reg Exps

Graph Theory. Thomas Bloom. February 6, 2015

Tropical Graph Signal Processing

Design and Analysis of Algorithms

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

Lecture 2: Connecting the Three Models

Recitation 8: Graphs and Adjacency Matrices

Spectra of Semidirect Products of Cyclic Groups

Detailed Proof of The PerronFrobenius Theorem

Relations Graphical View

Definition 2.3. We define addition and multiplication of matrices as follows.

Dot Products, Transposes, and Orthogonal Projections

1 Review of Vertex Cover

5 Flows and cuts in digraphs

A linear algebra proof of the fundamental theorem of algebra

Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur. Lecture - 20 Travelling Salesman Problem

A linear algebra proof of the fundamental theorem of algebra

MATH 22 HAMILTONIAN GRAPHS. Lecture V: 11/18/2003

DETERMINANTS IN WONDERLAND: MODIFYING DODGSON S METHOD TO COMPUTE DETERMINANTS

A proof of the Graph Semigroup Group Test in The Graph Menagerie

Peter Kahn. Spring 2007

Ngày 20 tháng 7 năm Discrete Optimization Graphs

Introduction to Finite Automaton

This section is an introduction to the basic themes of the course.

Linear Algebra II. 2 Matrices. Notes 2 21st October Matrix algebra

Linear Algebra (part 1) : Matrices and Systems of Linear Equations (by Evan Dummit, 2016, v. 2.02)

Commutative Rings and Fields

Using DERIVE to Interpret an Algorithmic Method for Finding Hamiltonian Circuits (and Rooted Paths) in Network Graphs

Discrete Applied Mathematics

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

Sparse spectrally arbitrary patterns

Group, Rings, and Fields Rahul Pandharipande. I. Sets Let S be a set. The Cartesian product S S is the set of ordered pairs of elements of S,

Modeling and Stability Analysis of a Communication Network System

Combinatorial Types of Tropical Eigenvector

1. Introduction to commutative rings and fields

Central Groupoids, Central Digraphs, and Zero-One Matrices A Satisfying A 2 = J

Lecture 6: Finite Fields

Characterization of Fixed Points in Sequential Dynamical Systems

1 Sequences and Summation

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y.

arxiv:math/ v1 [math.oa] 9 May 2005

Data Gathering and Personalized Broadcasting in Radio Grids with Interferences

1.10 Matrix Representation of Graphs

On the maximum positive semi-definite nullity and the cycle matroid of graphs

Shortest paths with negative lengths

Kleene Algebras and Algebraic Path Problems

Combinatorial types of tropical eigenvectors

Spectral Properties of Matrix Polynomials in the Max Algebra

Connectedness. Proposition 2.2. The following are equivalent for a topological space (X, T ).

CS1800: Mathematical Induction. Professor Kevin Gold

Math 291-1: Lecture Notes Northwestern University, Fall 2015

Sparsity of Matrix Canonical Forms. Xingzhi Zhan East China Normal University

Linear Algebra, Summer 2011, pt. 2

Graph coloring, perfect graphs

x 1 x 2. x 1, x 2,..., x n R. x n

Graph G = (V, E). V ={vertices}, E={edges}. V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)}

Math 443/543 Graph Theory Notes 5: Graphs as matrices, spectral graph theory, and PageRank

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

Infinite Continued Fractions

Reverse mathematics of some topics from algorithmic graph theory

Homework Problems Some Even with Solutions

CS261: A Second Course in Algorithms Lecture #8: Linear Programming Duality (Part 1)

Transcription:

Lecture 14 Tropical Arithmetic and Shortest Paths This lecture introduces tropical arithmetic 1 and explains how to use it to calculate the lengths of all the shortest paths in a graph. Reading: The material here is not discussed in any of the main references for the course. The lecture is meant to be self-contained, but if you find yourself intrigued by tropical mathematics, you might want to look at a recent introductory article David Speyer and Bernd Sturmfels (004), Tropical mathematics. Lecture notes from a Clay Mathematics Institute Senior Scholar Lecture, Park City, Utah, July 004. Available as preprint 0408099 from the arxiv preprint repository. Very keen, mathematically sophisticated readers might also enjoy Diane Maclagan and Bernd Sturmfels (015), Introduction to Tropical Geometry, Vol. 161 of Graduate Studies in Mathematics, American Mathematical Society, Providence, RI. ISBN: 978-0-818-5198- while those interested in applications might prefer B. Heidergott, G. Olsder, and J. van der Woude (006), Max Plus at Work, Vol. 1ofthePrinceton Series in Applied Mathematics, Princeton Univ Press. ISBN: 978-0-6911-176-8. The book by Heidergott et al. includes a tropical model of the Dutch railway network and is more accessible than either the book by Maclagan and Sturmfels or the latter parts of the article by Speyer and Sturmfels. 1 Maclagan & Sturmfels write: The adjective tropical was coined by French mathematicians, notably Jean-Eric Pin, to honor their Brazilian colleague Imre Simon, who pioneered the use of min-plus algebra in optimization theory. There is no deeper meaning to the adjective tropical. It simply stands for the French view of Brazil. 14.1

14.1 All pairs shortest paths In a previous lecture we used Breadth First Search (BFS) to solve the single-source shortest paths problem in a weighted graph G(V,E,w) wheretheweightsaretrivial in the sense that w(e) =18e E. Today we ll consider the problem where the weights can vary from edge to edge, but are constrained so that all cycles have positive weight. This ensures that Bellman s equations have a unique solution. Our approach to the problem depends on two main ingredients: a result about powers of the adjacency matrix and a novel kind of arithmetic. 14. Counting walks using linear algebra Our main result is very close in spirit to the following, simpler one. Theorem 14.1 (Powers of the adjacency matrix count walks). Suppose G(V,E) is a graph (directed or undirected) on n = V vertices and that A is its adjacency matrix. If we define A`, the `-th matrix power of A, by where ` N, then for `>0, A`+1 = A`A and A 0 = I n, Aìj = the number of walks of length ` from vertex i to vertex j, (14.1) where Aìj is the i, j entry in A`. Proof. We ll prove this by induction on `, thenumberofedgesinthewalk. The base case is ` =1andsoA` = A 1 = A and A ij certainly counts the number of one-step walks from vertex i to vertex j: there is either exactly one such walk, or none. Now suppose the result is true for all ` apple `0 and consider A`0+1 ij = X A`0 A kj. 1applekapplen The only nonzero entries in this sum appear for those values of k for which both A`0 and A kj are nonzero. Now, the only possible nonzero value for A kj is 1, which happens when the edge (k, j) ispresentinthegraph. Thuswecouldalsothinkof the sum above as running over vertices k such that the edge (k, j) isine: A`0+1 ij = X {k (k,j)e} A`0. By the inductive hypothesis, A`0 is the number of distinct, length-`0 walks from i to k. And if we add the edge (k, j) totheendofsuchawalk,wegetawalk from i to j. All the walks produced in this way are clearly distinct (those that pass through di erent intermediate vertices k are obviously distinct and even those that have the same k are, by the inductive hypothesis, di erent somewhere along the i to k segment). Further, every walk of length `0 +1fromi to j must consist of a length-`0 walk from i to some neighbour k of j, followedbyastepfromk to j, so we have completed the inductive step. 14.

G 1 1 H Figure 14.1: In G, the graph at left, any walk from vertex 1 to vertex must have even length while in H, the directed graph at right, there are no walks of length or greater. Two examples The graph at left in Figure 14.1 contains six walks of length. If we represent them with vertex sequences they re (1,, 1), (1,, ), (, 1, ), (,, ), (,, 1), and (,, ), (14.) while the first two powers of A G, G s adjacency matrix, are 0 1 0 1 0 1 A G = 4 1 0 1 5 A G = 4 0 0 5 (14.) 0 1 0 1 0 1 Comparing these we see that the computation based on powers of A G agrees with the list of paths, just as Theorem 14.1 leads us to expect: A 1,1 = 1 and there is a single walk, (1,, 1), from vertex 1 to itself; A 1, =1: countsthesinglewalk,(1,,),fromvertex1tovertex; A, =: countsthetwowalksfromvertextoitself,(,1,)and(,,); A,1 =1: countsthesinglewalk,(,,1),fromvertextovertex1; A, =1: countsthesinglewalk,(,,),fromvertextoitself. Something similar happens for the directed graph H that appears at right in Figure 14.1, but it has only a single walk of length two and none at all for lengths three or greater. A H = 4 0 1 0 0 0 1 5 A H = 4 0 0 1 5 A H = 4 5 (14.4) An alternative to BFS The theorem we ve just proved suggests a way to find all the shortest paths in the special case where w(e) =18e E. Ofcourse,inthiscasetheweightofapathis the same as its length. (1) Compute the sequence of powers of the adjacency matrix A, A,,A n 1. 14.

() Observe that a shortest path has length at most n 1 () To find the length of a shortest path from v i to v j,lookthroughthesequence of matrix powers and find the smallest ` such that Aìj > 0. This ` is the desired length. In the rest of the lecture we ll generalise this strategy to graphs with arbitrary weights. 14. Tropical arithmetic Tropical arithmetic acts on the set R [ {1} and has two binary operations, and, definedby x y =min(x, y) and x y = x + y (14.5) where, in the definition of, x + y means ordinary addition of real numbers supplemented by the extra rule that x 1 = 1 for all x R [ {1}. These novel arithmetic operators have many of the properties familiar from ordinary arithmetic. In particular, they are commutative. Foralla, b R [ {1} we have both and a b =min(a, b) =min(b, a) =b a a b = a + b = b + a = b a. The tropical arithmetic operators are also associative: and a (b c) = min(a, min(b, c)) = min(a, b, c) =min(min(a, b),c)=(a b) c a (b c) =a + b + c =(a b) c. Also, there are distinct additive and multiplicative identity elements: a 1=min(a, 1) =a and b 0=0+b = b. Finally, the multiplication is distributive: a (b c) =a +min(b, c) =min(a + b, a + c) =(a b) (a c). There are, however, important di erences between tropical and ordinary arithmetic. In particular, there are no additive inverses in tropical arithmetic and so one cannot always solve linear equations. For example, there is no x R [ {1} such that ( x) 5=11. Toseewhy,rewritetheequationasfollows: ( x) 5=(+x) 5=min(+x, 5) apple 5. Students who did Algebraic Structures II might recognise that this collection of properties means that tropical arithmetic over R [ {1} is a semiring. 14.4

14..1 Tropical matrix operations Given two m n matrices A and B whose entries are drawn from R [ {1}, we ll define the tropical matrix sum A B by: (A B) ij = A ij B ij =min(a ij,b ij ) And for compatibly-shaped tropical matrices A and B we can also define the tropical matrix product by (A B) ij = nm k=1 A B kj = min 1applekapplen (A + B kj ). Finally, if B is an n n square matrix, we can define tropical matrix powers as follows: B k+1 = B k B and B 0 = În. (14.6) where În is the n n tropical identity matrix, 0 1... 1 1 0 1. Î n =.......... (14.7) 6 7 4. 1 0 1 5 1... 1 0 It has zeroes on the diagonal and 1 everywhere else. It s easy to check that if A is an m n tropical matrix then Î m A = A = A În. Example 14. (Tropical matrix operations). If we define two tropical matrices A and B by apple apple 1 1 1 A = and B = 0 1 1 1 then A B = apple 1 1 1 0 1 1 1 = apple min(1, 1) min(, 1) min(0, 1) min(1, 1) = apple 1 1 0 1 and apple (1 1) ( 1) (1 1) ( 1) A B = (0 1) (1 1) (0 1) (1 1) apple min(1 + 1, +1) min(1+1, +1) = min(0 + 1, 1 + 1) min(0 + 1, 1 + 1) apple =. 1 1 14.5

14.. A tropical version of Bellman s equations Recall Bellman s equations from Section 1... Given a weighted graph G(V,E,w) in which all cycles have positive weight, we can find u j = d(v 1,v j )bysolvingthe system u 1 =0 and u j =min k6=j u k + w k,j for apple j apple n, where w k,j is an entry in a weight matrix w given by w k,j = w(vk,v j ) if (v k,v j ) E 1 otherwise. (14.8) We can rewrite Bellman s equations using tropical arithmetic u j = min k6=j u k + w k,j = min k6=j u k w k,j = M k6=j u k w k,j which looks almost le the tropical matrix product u w: we llexploitthisobservation in the next section. 14.4 Minimal-weight paths in a tropical style We ll now return to the problem of finding the weights of all the minimal-weight paths in a weighted graph. The calculations are very similar to those in Section 14., but now we ll take tropical powers of a weight matrix W whose entries are given by: 8 < 0 if j = k W k,j = w(v k,v j ) if (v k,v j ) E. (14.9) : 1 otherwise Note that W is very similar to the matrix w defined by Eqn. (14.8): the two di er only along the diagonal, where w ii = 1 for all i, whilew ii =0. Lemma 14.. Suppose G(V,E,w) is a weighted graph (directed or undirected) on n vertices. If all the cycles in G have positive weight and a matrix W is defined as in Eqn. (14.9), then the entries in W `, the `-th tropical power of W, are such that and, for i 6= j, either W ` ij W ` ii =0for all i = weight of a minimal-weight walk from v i to v j containing at most ` edges when G contains such a walk or W ` ij = 1 if no such walks exist. Proof. We proceed by induction on `. Thebasecaseis` =1andit sclearthatthe only length-one walks are the edges themselves, while W ii =0byconstruction. 14.6

Now suppose the result is true for all ` apple `0 and consider the case ` = `0 +1. We will first prove the result for the o -diagonal entries, those for which i 6= j. For these entries we have W `0+1 i,j = nm k=1 W `0 W k,j = min 1applekapplen W `0 + W k,j (14.10) and inductive hypothesis says that W `0 is either the weight of a minimal-weight walk from v i to v k containing `0 or fewer edges or, if no such walks exist, W `0 = 1. W k,j is given by Eqn. (14.9) and so there are three possibilities for the terms that appear in the tropical sum (14.10): W `0 + W k,j (14.11) They are infinite for all values of k, and so direct calculation gives W `0 i,j = 1. This happens when, for each k, wehaveoneorbothofthefollowing: W `0 = 1, inwhichcasetheinductivehypothesissaysthatthereareno walks of length `0 or less from v i to v k or W k,j = 1 in which case there is no edge from v k to v j. And since this is true for all k, it implies that there are no walks of length `0 +1orlessthatrunfromv i to v j. Thus the lemma holds when i 6= j and W `0+1 ij = 1. The expression in (14.11) is finite for at least one value of k, but not for k = j. Then we know W `0 ij = 1 and so there are no walks of length `0 or less running from v i to v j.further, W `0+1 i,j =min W `0 + W k,j k6=j = min {k (v k,v j )E} W `0 ij + w(v k,v j ). (14.1) and reasoning such as we used when discussing Bellman s equations a minimalweight walk from v i to v j consists of a minimal weight walk from v i to some neighbour (or, in a digraph, some predecessor) v k of v j,plustheedge(v k,v j ) means that the (14.1) gives the weight of a minimal-weight walk of length `0 + 1 and so the lemma holds here too. The expression in (14.11) is finite for case k = j and perhaps also for some k 6= j. When k = j we have W `0 + W k,j = W `0 ij + W j,j = W `0 ij +0 = W `0 ij, which, by the inductive hypothesis, is the weight of a minimal-weight walk of length `0 or less. If there are other values of k for which (14.11) is finite, then they give rise to a sum over neighbours (or, if G is a digraph, over predecessors) such as (14.1), which computes the weight of the minimal-weight walk of length `0 +1. TheminimumofthisquantityandW `0 ij is then the minimal weight for any walk involving `0 + 1 or fewer edges and so the lemma holds in this case too. 14.7

Finally, note that reasoning above works for W ` ii too: W ` ii is the weight of a minimal-weight walk from v i to itself. And given that any walk from v i to itself must contain a cycle and that all cycles have positive weight, we can conclude that the tropical sum W `0+1 i,i is minimised by k = i, whenw `0 W i,i =0(byconstruction)so = minw `0 + W k,i k = W `0 i,i =0(bytheinductivehypothesis)and min W `0 + W k,i = W `0 i,i + W i,i = 0+0 = 0 k and the theorem is proven for the diagonal entries too. Finally, we can state our main result: Theorem 14.4 (Tropical matrix powers and shortest paths). If G(V,E,w) is a weighted graph (directed or undirected) on n vertices in which all the cycles have positive weight, then d(v i,v j ), the weight of a minimal-weight path from v i to v j, is given by (n 1) d(v i,v j )=Wi,j (14.1) Proof. First note that for i 6= j, anyminimal-weightwalk from v i to v j must actually be a minimal weight path. Onecanprovethisbycontradictionbynotingthatany walk that isn t a path must revisit at least one vertex. Say that v? is one of these revisited vertices. Then the segment of the walk that runs from the first appearance of v? to the second must have positive weight (it s a cycle and all cycles in G have positive weight) and so we can reduce the total weight of the walk by removing this cycle. But this contradicts our initial assumption that the walk had minimal weight. Combining this with the previous lemma and the observation that a path in G contains at most n 1edgesestablishestheresult. An example The graph illustrated in Figure 14. is small enough that we can just read o the weights of its minimal-weight paths. If we assemble these results into a matrix D whose entries are given by 8 < 0 if i = j D ij = d(v i,v j ) if i 6= j and v j is reachable from v i : 1 otherwise we get D = 4 0 1 0 1 0 0 To verify Theorem 14.4 we need only write down the weight matrix and its tropical square, which are 0 1 0 1 W = 4 1 0 1 5 and W = 4 0 1 5. 1 0 0 0 14.8 5.

v 1-1 v 1 v Figure 14.: The graph above contains two directed cycles, (v 1,v,v,v 1 ), which has weight 1, and (v 1,v,v 1 ), which has weight. Theorem 14.4 thus applies and we can compute the weights of minimal-weight paths using tropical powers of the weight matrix. The graph has n =verticesandsoweexpectw (n distance matrix D, whichitdoes. 1) = W to agree with the 14.9