How a kidney exchange is a matching problem Image: Newtown grafitti, CC BY 2.0

How a kidney exchange is a matching problem

About 90,000 people in the United States are waiting for a kidney transplant at any time, and a living donor's kidney lasts longer than one from a deceased donor. Many patients have a relative willing to give one. In roughly a third of those cases the kidney cannot be used, because the blood groups do not match or because the patient's immune system carries antibodies against the donor's tissue. Until the 2000s such a pair went home. Now their names go into a graph.

The graph

Each incompatible pair, a patient and the donor who cannot help them, is one vertex. Draw an arrow from pair 1 to pair 2 when donor 1 could give a kidney to patient 2. A two-way exchange is a pair of arrows in both directions: donor 1 gives to patient 2 and donor 2 gives to patient 1, and both patients are transplanted. A three-way exchange is a directed cycle of length three. Every cycle in the graph is a set of transplants in which each donor gives and each patient receives, and nobody gives without their own patient receiving, which is the condition the donors insist on.

The surgeries of a cycle have to happen at the same time. If donor 1 gives on Monday and donor 2 is meant to give on Tuesday, donor 2 can withdraw on Monday night, and patient 1 has lost a donor and gained nothing. Simultaneous surgery for a cycle of three needs six operating theatres and six surgical teams, which is why cycles longer than three are rarely attempted.

Chains

A donor who wants to give a kidney to anyone at all, with no patient of their own, changes the picture. Such a donor starts a chain: they give to patient 1, donor 1 gives to patient 2, donor 2 to patient 3, and so on, with the last donor giving to someone on the waiting list. A chain can be done in sequence rather than at once, because if a donor withdraws after their own patient has been transplanted, the chain simply stops and nobody is left worse off than before. Chains of ten and more transplants have been carried out over several months. In the graph, a chain is a directed path that starts at the altruistic donor's vertex.

The optimization problem is then: given the graph, choose a set of vertex-disjoint cycles of length at most three and chains such that the number of transplanted patients is as large as possible, or such that a weighted sum is, with weights for how long a patient has waited and how hard they are to match. For cycles of length two only, this is a maximum matching problem in an undirected graph, which Unit 5 of the Graph Theory Masterclass solves with augmenting paths. With cycles of length three it becomes NP-hard in general, and exchange programs solve it with integer programming on graphs of a few thousand vertices, which is feasible.

Where the idea came from

Alvin Roth, Tayfun Sönmez, and Utku Ünver published Kidney Exchange in the Quarterly Journal of Economics in 2004; the working paper is free to read. They were economists who had studied markets without prices, and their starting point was a problem from 1974: Shapley and Scarf had asked how to reallocate houses among people who each own one and have preferences over all the others, with no money allowed, and had found the top trading cycles method, which produces an allocation that no group of people can improve by trading among themselves. Replace houses by kidneys and the method applies, with two changes: patients may also be happy to wait for a deceased donor, and cycles must be short. The 2004 paper handles both, and shows that the resulting mechanism cannot be gamed, so that no patient or hospital does better by hiding a donor.

The New England Program for Kidney Exchange, founded in 2004 by Roth and his coauthors with the transplant surgeons Francis Delmonico and Susan Saidman, was the first to run on these ideas. Large national programs followed in the United States, the United Kingdom, the Netherlands, and elsewhere, and thousands of transplants a year now come from exchanges.

Stability, and the other half of the prize

The deeper idea behind all of this is stability, from a paper of David Gale and Lloyd Shapley of 1962, College Admissions and the Stability of Marriage. Suppose n students and n colleges each rank the other side. A matching is stable if no student and college prefer each other to what they got. Gale and Shapley gave a procedure, deferred acceptance, in which students propose to colleges in order of preference and colleges hold their best offer while rejecting the rest, and proved that it always ends in a stable matching, in at most n squared proposals, and that the proposing side gets the best stable partner it could have. Unit 5 proves all three statements.

Roth discovered in 1984 that the clearing house that assigns American medical graduates to hospital residencies, in operation since 1952, was running deferred acceptance without knowing the name, and he redesigned it in 1997 with Elliott Peranson to handle couples. He went on to design the school choice systems of New York City and Boston on the same principle. The Nobel Memorial Prize in Economic Sciences for 2012 went to Roth and Shapley for the theory of stable allocations and the practice of market design. Gale had died in 2008 and could not share it.

What graph theory contributes

Three things in the kidney problem are theorems about graphs. That a maximum matching can be found quickly, and that a matching is maximum exactly when no augmenting path exists, is Berge's theorem of 1957. That the pairs in a two-way exchange can be found by searching for alternating paths is the algorithm of Unit 5. And that the same problem with longer cycles is as hard as the hard problems of Unit 8 tells the programs where the computational cost will be. Roth's own account of the subject, in his research spotlight in Unit 5, is written for economists, and the first ten pages of the 2004 paper can be read by anyone who has followed the unit.

The vertices of this graph are people, two per vertex, and an edge is a possible transplant. It is the clearest example the masterclass has of a matching problem whose answer changes lives.

Study graph theory properly

The Graph Theory Masterclass: weekly units, quizzes, a final exam, and a certificate.
About the program