Proofs where you need them
Each theorem carries the argument that makes it true — the exchange step, the invariant, the counting — so you can re-derive the algorithm instead of memorising it.
Content width
Text size
Figure grid
80 pages · 15 chapters · free to read
Every idea from a first DFS to centroid decomposition, Hopcroft–Karp and min-cost flow — written from scratch with the proof next to the code, a complexity badge on every technique, and 13 interactive widgets you can step through.
Each theorem carries the argument that makes it true — the exchange step, the invariant, the counting — so you can re-derive the algorithm instead of memorising it.
Complete C++ snippets with the trap list next to them: the emit-then-reverse in Hierholzer, the
inverted priority_queue comparator, the doubled pos array in a lazy segment tree.
Every technique is badged with time and memory, and every multi-method page ends with a table that says which one to write and why.
Graphs and Models. Most graph problems are won or lost at modelling: deciding what the vertices *are*. This chapter builds the vocabulary that the rest of the book assumes, and the two representations you will type in a contest.
Trees. Trees are where graph algorithms become honest: no cycles means every traversal is a proof. Learn the six equivalent definitions, then the two traversals, and you already own a surprising share of olympiad problems.
Directed Graphs. Orientation breaks symmetry — and gives you order. Once you can collapse a digraph to its DAG of strongly connected components, half of “impossible ordering” problems become plain DP on a DAG.
Proof Toolkit. Olympiad graph theory is barely about algorithms; it is about three proof moves used relentlessly. Name them and you can attack a problem with no idea where to start.
Euler Tours and Hamilton Cycles. Traverse every *edge* and the problem is linear; traverse every *vertex* and it is NP-complete. The border between those two is the most instructive line in the subject.
Shortest Paths. Four algorithms, one shared idea: keep a frontier of tentative distances and relax edges until the frontier is honest. What differs is what you are allowed to assume about the weights.
Matrices. A graph written as a matrix is a linear recurrence in disguise. Multiply it by itself log k times and you have counted every walk of length k — or computed the number of spanning trees with a determinant.
Data Structures on Trees. The five structures in this chapter appear in the majority of graph problems that are not purely graph-theoretic. Know them cold: the code below is the code you type in a contest.
Hardness and Escape Routes. Proving hardness is a research field; recognising it in a contest is a 30-second pattern match. The useful skill is knowing which escape route the constraints are hinting at.
Lowest Common Ancestor. LCA is the hinge between trees and queries. Four solutions, four different ideas — DSU, sparse tables, DFS order, and decomposition — which is why it is the best practice topic in the book.
Advanced Tree Algorithms. Two structural ideas carry this whole chapter: sort-and-merge (MST, Kruskal) and split-at-a-good-vertex (centroid, HLD). Everything else is bookkeeping.
Cuts and Flows. Max-flow min-cut is the most reusable theorem in combinatorial optimisation: every problem whose answer is “the smallest set of things blocking the largest number of paths” is a flow problem in disguise.
Matching. Matching is where duality becomes visible: every max matching has a min vertex cover, and the proof of one is an algorithm for the other.
Special Topics. A toolbox of one-off ideas that keep showing up in finals: Euler's formula, greedy colouring bounds, the implication graph, hitting times, and Ramsey's unavoidable order.
Appendix. The pages you want open in the last hour: what runs in time, what the code skeleton looks like, and what every symbol in the book means.
search.json