Systems ruled by "wait for the slowest" — assembly lines, timetables, project plans — look like tangles of special cases. In max-plus algebra they are linear systems: one matrix, one eigenvalue, one eigenvector, and the whole schedule is explained.
↓ Start with the two-machine line — watch a schedule find its own rhythm.
Max-plus algebra is ordinary linear algebra with its two operations replaced. "Addition" becomes take the larger, and "multiplication" becomes add. Nothing else changes: matrices, powers, eigenvalues, and eigenvectors all survive; they just mean something new.
Read a matrix entry A[i][j] as "event i must wait A[i][j] time units after event j" (and −∞ when i does not depend on j at all). Then the tropical matrix product is exactly the scheduling rule start as soon as every prerequisite allows, a matrix power collects the heaviest path of a given length, and the eigenvalue is the pace the whole system settles into. Everything below runs live in your browser: edit any number and every consequence updates.
Enter waiting times below, or load a sample system. Leave a cell blank for −∞ (no dependence). Everything on this page recomputes as you type: the eigenvalue λ, the eigenvector, the matrix powers, and the schedule simulation in the next section all describe the matrix in this grid.
The recurrence x(k+1) = A ⊗ x(k) is "every event fires as soon as its slowest prerequisite allows." Iterate it from any starting times and the gaps between firings settle into a pattern whose average is exactly the eigenvalue λ of the matrix above. Change the matrix or the start and watch the rhythm reassert itself.
A[i][j] is the delay event i must leave after event j. Drawing an arrow j → i for every finite entry turns the matrix into the dependence graph of the system, and every statement below is a statement about that graph.
Take any cycle in the graph, divide its total weight by its length, and λ is the largest such mean. It is the pace the schedule settles into: one full round of the system every λ time units, no matter how it starts. The cycle that achieves it is the bottleneck; highlighted amber in the star table above.
The eigen-relation A ⊗ v = λ + v says: start the events at the times in v and every one of them repeats exactly λ later, forever. Differences between components of v are the steady phase offsets between events, which is why v is displayed with its smallest entry shifted to 0.
Entry (i, j) of the Kleene star is the best weight over paths of every length from j to i, which on a project graph is the critical path method. It exists exactly when no cycle has positive weight; otherwise weights grow without bound, and the tool says so rather than pretending.
Swap the max for a min and the same algebra computes cheapest routes. Now a ⊕ b = min(a, b), a blank cell means +∞ (no road), and smaller is better. The slider runs Bellman–Ford before your eyes: paths of at most k edges, with the entries that just improved highlighted. When nothing changes from one k to the next, value iteration has converged and you are looking at the all-pairs shortest distances, the min-plus Kleene star, computed by Floyd–Warshall.
The Bellman update "try every predecessor, keep the cheapest" is one min-plus matrix–vector product. Matrix powers are optimal k-step costs, so Bellman–Ford is repeated multiplication. The Kleene star is all-pairs shortest paths, and computing it by allowing one more intermediate node at a time is Floyd–Warshall: Gaussian elimination over the semiring. The eigenvalue, the minimum cycle mean, is the best achievable average cost per stage. Viterbi decoding and edit distance run the same identities in neighboring semirings.
Machines wait for parts and for each other. The eigenvalue is the line's throughput ceiling; the critical cycle names the bottleneck worth investing in, and the eigenvector schedules everything else around it.
Trains wait for connections. National timetables have been analyzed as max-plus systems: λ is the shortest sustainable period of the whole network, and delay propagation is the transient the simulator above displays.
Tasks wait for prerequisites. The Kleene star of the precedence graph is the critical path method: longest paths give earliest starts, and the residuated system runs the dates backward from a deadline.
Packets wait for links and buffers. Network calculus bounds delays through min-plus convolutions, the continuous sibling of the matrix products on this page.
Shortest paths, Viterbi decoding, sequence alignment, and reinforcement-learning value iteration all iterate a tropical matrix product to a fixed point. Even rhythmic stepping in biology, from legged gaits to molecular motors, has been modeled with the same eigenvalue.
Everything on this page runs on a dependency-free JavaScript library of about two hundred lines, a direct port of the original MicroPython tropmat. It works in any browser or in Node, carries both semirings, and is MIT licensed. The download button hands you exactly the code this page is executing.
| MAXPLUS, MINPLUS | the two semirings; every function takes one as its last argument |
| zeros(n,m,S), identity(n,S) | the semiring zero matrix and identity |
| fromEdges(n,edges,S) | build a matrix from [from, to, weight] triples (0-indexed) |
| madd(A,B,S), mmul(A,B,S) | ⊕ entrywise, and the tropical matrix product |
| mvmul(A,x,S), mpow(A,k,S) | matrix–vector product and fast matrix power |
| closure(A,S) | the Kleene star A* by Floyd–Warshall; check divergence first with cycleMean |
| maxCycleMean(A), minCycleMean(A) | the eigenvalue by Karp's algorithm |
| eigenvector(A) | [λ, v] with mmul(A,[v]) = λ + v, from the critical column of the star |
| criticalNodes(A) | the nodes on a heaviest-mean cycle: the bottleneck |
| isIrreducible(A,S) | strong connectivity, the hypothesis behind the unique rhythm |
| ldiv(A,b) | residuation: the greatest x with A ⊗ x ≤ b (latest starts under a deadline) |
| orbit(A,x0,k,S), transient(A) | simulate x(k+1)=A⊗x(k); detect when it turns exactly periodic |
Baccelli, Cohen, Olsder and Quadrat's standard reference (Wiley, 1992), made freely available online by its authors. Everything on this page, with proofs.
Heidergott, Olsder and van der Woude (Princeton, 2006): a gentler course built around the railway example, with exercises.
A full MATLAB-syntax linear algebra playground with a max-plus command set (tropmul, tropeig, tropstar, minstar) and a guided tour of these ideas next to the classical ones.