How slow can Algorithm 7.5.1H be?
Rounds, staircases, and Tchoukaillon graphs
Knuth’s Algorithm 7.5.1H (Algorithm H for short) is his implementation of the Hopcroft–Karp algorithm for maximum bipartite matching. It works in rounds, and Knuth’s Corollary K bounds their number by about , where is the size of a maximum matching. Exercise 15 proposes a family of slow inputs, Tchoukaillon graphs; exercise 16 asks whether they exist; and its answer asks something harder: can any graph force more rounds?
It can. With edges in a maximum matching, some input makes Algorithm H take exactly rounds, and none takes more. A Tchoukaillon graph would take about . The chart compares the two; hover over it, or tap.
1Algorithm H, one step at a time
Algorithm H keeps a matching between girls and boys. Matched pairs are couples, drawn as double lines; unmatched vertices are free. An augmenting path runs from a free girl to a free boy, alternating between edges outside and inside the matching. Swapping its two kinds of edges adds a couple. A path with edges has level .
Step H1 builds a greedy matching. Then each round does two things:
- a breadth-first search (steps H2–H10) builds a dag of all shortest augmenting paths (SAPs), level by level;
- a depth-first search (H11–H17) takes SAPs out of the dag one by one, augmenting along each and deleting its vertices, until none is left.
What the algorithm does depends on the input in only two ways: the numbering of the girls, which fixes the order in which H1 scans them, and the order of each girl’s list of boys. The reverse lists that the search follows are built by the algorithm, and new entries go to the front. Watch that happen below. In round 2 of this nine-pair example, the first round with a dag, the search finds just one SAP, although three disjoint ones exist: the one it finds meets all three.
We count step H1 as the first round, as Knuth’s answer to exercise 15(c) does (report §2.5), so a run whose dags have levels has rounds. The three counters measure work: adjacency entries examined in step H5, arcs consumed in step H13 (including arcs it skips), and marks reset in step H11.
2Tchoukaillon graphs
Suppose the graph has a perfect matching () and the current matching leaves girls free. If the round’s dag has level and there are disjoint SAPs, then any maximal set of disjoint SAPs has at least members, because one SAP can meet at most of them. Exercise 15(c) asks for a graph that starts with the largest possible number of free girls, , and removes only that minimum at levels . The numbers then follow the Tchoukaillon schedule
Knuth noticed that this is the arithmetic of a solitaire game, Tchoukaillon (exercise 11), a one-player relative of mancala. Pit may be emptied only when it holds exactly stones, which are sown one each into pits and the store. For each number of stones there is exactly one winning position. Play it below; the number of moves made from pit is .
A Tchoukaillon graph needs rounds exactly when , where the Tchoukaillon numbers grow like (OEIS A002491; Broline and Loeb). Knuth’s answer to exercise 15(d) describes a 16-pair example by a sequence of matrices. Each row lists the girl–boy pairs that a basic path visits, and each round’s SAPs splice several rows into longer ones. With the input order given in Appendix A of the report, Algorithm H passes through exactly these matrices:
Read literally, exercise 15 also asks that every augmenting path have the current shortest level. Knuth’s graph does not satisfy this: right after H1 it has augmenting paths of levels 2 and 3 from the same free girl. The report separates three readings of the definition: literal (every augmenting path has the shortest level), basic-row ( disjoint SAPs in every round), and operational (just the numbers).
3How many rounds can there be?
Before a round at level with free girls, a maximum matching supplies disjoint augmenting paths, each using at least of its edges. So : every round of every run is a point on or below the hyperbola . With rounds, the th round after H1 has level at least and at least free girls, and maximizing gives the whole answer:
The Tchoukaillon schedule starts at the top of the hyperbola and must shed free girls fast. A worst case starts lower and slides down along it, one free girl per round.
4Staircase graphs
The bound is attained by the staircase graphs . They are planar, have maximum degree three, and come with an input order under which every step of Algorithm H can be predicted. The cells form left-justified rows, plus one extra corner cell at the bottom. Each cell holds a girl and a boy; a boy is joined to his own girl, to the girl of the next cell in his row, and to the girl of the cell below, except that the edge into the corner is left out (it would only complicate the proofs; the explorer below lets you add it).
When girls are free, the basic paths are hooks, one starting at the first cell of each of rows . Hook runs east along row to column and then turns south down column ; a row with fewer than cells is a hook by itself, and the last hook ends at the corner.
The trick is to keep some hooks longer than the shortest level. They count as free girls but are not SAPs, so at most disjoint SAPs exist. Because new entries go to the front of the reverse lists, the first search takes the first arc at every boy and descends a staircase through every shortest hook. That one SAP blocks all the others: if hooks have the shortest level, the dag contains SAPs, and every one of them meets it.
On these graphs the breadth-first searches alone examine adjacency entries, so Corollary K is tight even for sparse planar graphs. Since always, a staircase graph is never faster than a Tchoukaillon graph would be. It is strictly slower for , for every , and for all sizes in between except , , , , , , and ; asymptotically .
5The literal definition
Suppose a round has disjoint SAPs of level , and the next round has the literal property: every augmenting path has level . Then the first of the two rounds removes at least half of the free girls. The heart of the proof is a splice. After augmenting along a selected path , its new couples can only be used in position: a new augmenting path that uses uses it as its th couple. If two new disjoint paths crossed at and , then following one, walking back along , and finishing along the other would give an augmenting path with more edges, although every augmenting path of the next round has level .
The Tchoukaillon schedule asks the round at level 2 to remove only about a third of the free girls. So, for , literal Tchoukaillon graphs exist only when .
6The open question
Can the Tchoukaillon schedule be realized for every , with no condition on the paths? Computer search has found inputs for every , and all of them even keep disjoint SAPs in every round. Any family that works for unboundedly large needs at least independent cycles (cycle rank).
The input order is a genuine obstacle. The six-pair graph below admits a run in which each of the rounds at levels 2, 3, 4 removes a maximal set consisting of a single SAP, which is exactly the schedule for . But Algorithm H chooses its SAPs by its own rules: its queue order, the insertion at the front in step H6, and the replacement rule of step H16. Try to find a numbering and list orders that make it follow the schedule, or let the computer try all 103,680 of them.
The computed realizations for even can be explored here; each one runs Algorithm H live and compares the numbers of SAPs with the schedule.
7Try your own graph
Write one line per girl, , listing her boys in the order of her list. Algorithm H runs on exactly that input, so changing the order of a list, or swapping two girls’ numbers, can change what it does.
Page, exercise, and step numbers refer to the zeroth printing of Pre-Fascicle 14A, revision −88, dated 18 September 2026. A pre-fascicle is a working draft, so these numbers may change.