Mathematical Programming

, Volume 161, Issue 1–2, pp 389–417

# Nash equilibria in the two-player kidney exchange game

• Margarida Carvalho
• Andrea Lodi
• João Pedro Pedroso
• Ana Viana
Full Length Paper Series A

## Abstract

Kidney exchange programs have been set in several countries within national, regional or hospital frameworks, to increase the possibility of kidney patients being transplanted. For the case of hospital programs, it has been claimed that hospitals would benefit if they collaborated with each other, sharing their internal pools and allowing transplants involving patients of different hospitals. This claim led to the study of multi-hospital exchange markets. We propose a novel direction in this setting by modeling the exchange market as an integer programming game. The analysis of the strategic behavior of the entities participating in the kidney exchange game allowed us to prove that the most rational game outcome maximizes the social welfare and that it can be computed in polynomial time.

### Keywords

Kidney exchange Nash equilibrium Social welfare  Matching

### Mathematics Subject Classification

91A80 05C85 90C27

## 1 Introduction

The Kidney Exchange Problem can be described as follows. A patient suffering from renal failure can see her life quality improved through the transplantation of a healthy kidney. Typically, a patient receives a kidney transplant from a deceased donor, or from a living donor that is a patient’s relative or friend. Unfortunately, these two possibilities of transplantation can only satisfy a tiny fraction of the demand, since deceased donors are scarce and patient–donor incompatibilities may occur.

To potentially increase the number of kidney transplants, some countries’ recent legislation (e.g., United Kingdom [16], Netherlands [10]) allows a pairwise exchange: e.g., for two patient–donor pairs $$P_1$$ and $$P_2$$ the patient of pair $$P_1$$ receives a kidney from the donor of pair $$P_2$$ and vice versa, forming a cycle of size 2. The idea can be extended to allow more than two pairs to be involved in an exchange (for L-pairs, $$P_2$$ receives a kidney from the donor $$P_1$$, $$P_3$$ from the donor of $$P_2$$, etc, and, finally, $$P_1$$ from the donor of $$P_L$$, closing a cycle), and to include undirected (altruistic) donors, as well as pairs with other characteristics [9]. The general aim is to define a match that maximizes the number of transplants in a pool. Because in most cases the operations must take place at the same time, for logistic reasons the number of pairs that can be involved in an exchange is limited to a maximum value, say L. Furthermore, because additional compatibility tests that must be performed prior to transplant may lead to new incompatibilities, resulting in the cancellation of all transplants involved in the cycle it is preferable for the cycles to be shorter.

Abraham et al. [1] formulated the kidney exchange problem (KEP) as an integer program with an exponential number of variables, which maximizes the number of vertices covered in a digraph by vertex-disjoint cycles of size at most L. In this model the vertices of the digraph represent patient–donor pairs and the arcs represent the compatibilities between pairs. A compact model, where the number of variables and constraints increases polynomially with the problem size, is proposed by Constantino et al. [9].

In the previous models, there is a centralized decision maker deciding the exchange program. However, there are other potential decision makers to be considered that can influence the exchange program. In Cechlárová et al. [8], patient–donor pairs are the players in a cooperative kidney exchange game that is structurally different from what is presented in this paper because the players, the set of actions and utilities interact differently, as will be clear after our game model description.

Multi-agent kidney exchange Although some countries have a national kidney exchange pool with the matches being done by a central authority, other countries have regional (or hospital) pools, where the matches are performed internally with no collaboration between the different entities. Since it is expected that as the size of a patient–donor pool increases more exchanges can take place, it became relevant to study kidney exchange programs involving several hospitals or even several countries. In such cases each entity is a self-interested agent that aims at maximizing the number of its patients receiving a kidney [3, 4].

To the extent of our knowledge, work in this area concentrates on the search of a strategyproof mechanism that decides all exchanges to be performed in a multi-hospital setting. A mechanism is strategyproof if the participating hospitals do not have incentive to hide information from a central authority that decides through that mechanism the exchanges that are to be executed. For the 2-hospital kidney exchange program with pairwise exchanges, the deterministic strategyproof mechanism in [2] provides a 2-approximation ratio on the maximum number of exchanges, while the randomized strategyproof mechanism in [7] guarantees a $$\frac{3}{2}$$-approximation ratio. Additionally, Ashlagi et al. [2] built a randomized strategyproof mechanism for the multi-hospital case with approximation ratio 2, again only for pairwise exchanges. In these mechanisms, in order to encourage the hospitals to report all their incompatible pairs, the social welfare is sacrificed. In fact, the best lower bound for a strategyproof (randomized) mechanism is 2 ($$\frac{8}{7}$$), which means that no mechanism returning the maximum number of exchanges is strategyproof [2]. In this context, the question is whether, analysing the hospitals interaction from a standpoint of a non-cooperative game, Nash equilibria would improve the program’s social welfare.

We can formalize and generalize KEP to a competitive N-player kidney exchange game ($$N$$-KEG) with two sequential moves: first, simultaneously, each player n, for $$n=1,\ldots ,N$$, decides the internal exchanges to be performed; second, an independent agent (IA) takes the first-stage unused pairs and decides the external exchanges to be done such that the number of pairs participating on it is maximized. Let us define $$V^n$$ as the vertex set of player n, $$V=\bigcup _{n=1}^N V^n$$ and C as the set of cycles with size at most L. Let $$C^n = \{ c \in C : c \cap V^n = c\}$$ be the subset of cycles involving only player n’s patient–donor pairs, and $$I = C \setminus \bigcup _{n=1}^N C^n$$ be the subset of cycles, involving at least two patient–donor pairs of distinct players. Each player solves the following bilevel programming:
\begin{aligned} \mathop {\mathrm {maximize}}_{x^n \in \{ 0,1\}^{\vert C^n \vert } }&\ \sum _{c \in C^n} w_c^n x_c^n + \sum _{c \in I} w_c^n y_c\end{aligned}
(1.1a)
\begin{aligned} \text{ subject } \text{ to }&\sum _{c \in C^n: i \in c} x_c^n \le 1 \quad \forall i \in V^n \end{aligned}
(1.1b)
\begin{aligned}&\hbox {where }y\hbox { solves the problem} \nonumber \\&\mathop {\mathrm {maximize}}_{y \in \{ 0,1\}^{\vert I \vert }} \ \ \sum _{c \in I} \sum _{n=1}^N w_c^n y_c \end{aligned}
(1.1c)
\begin{aligned}&\hbox {s.t.}\qquad \qquad \sum _{c \in I: i \in c} y_c \le 1 - \sum _{n=1}^N \sum _{c \in C^n: i \in c} x_c^n \quad \forall i \in V \end{aligned}
(1.1d)
Player n controls a binary decision vector $$x^n$$ with size equal to the cardinality of $$C^n$$. An element $$x^n_c$$ of $$x^n$$ is 1 if cycle $$c \in C^n$$ is selected, 0 otherwise. Similarly, the IA controls the binary decision vector y with size equal to the cardinality of I. The objective function (1.1a) translates on the maximization of player n’s patients receiving a kidney: $$w_c^n$$ the number of player’s n patient–donor pairs in cycle c (which is the size of c if it is an internal). Constraints (1.1b) ensure that every pair is in at most one exchange. The IA objective function (1.1c) represents the maximization of patient–donor pairs receiving a kidney in the second-stage. Constraints (1.1d) are analogous to (1.1b), but also ensure that pairs participating in the first-stage exchanges are not selected by the IA.

In the way that we defined $$N$$-KEG, it is implicit that it is a complete information game. Initially, every player decides the pairs to reveal, and only revealed pairs will be considered in each player utility as well as in the second stage IA decision process. Note that there is no incentive for hiding information, as each player has complete control over her internal exchanges, and, therefore, can guarantee to be at least as good as if it was by herself. Moreover, if there are hidden pairs, they will not be considered in the IA decision, and thus, the players will not benefit from external exchanges including them. Consequently, this is intrinsically a complete information game.

The formulation above brings up the following research question: is the generalization of KEP to $$N$$-KEG relevant? In particular, it is worth noting that the special case of KEP with $$L=2$$ can be formulated as a maximum matching problem and consequently, solved in polynomial time. Moreover, the multi-agent kidney exchange literature focuses mainly in exchanges with size 2. Thus, the most natural and relevant extension to look at is 2-KEG with pairwise exchanges.

Our contributions In this paper we concentrate on the non-cooperative 2-player kidney exchange game (2-KEG) with pairwise exchanges. A player can be a hospital, a region or even a country. Under this setting it is inefficient to follow the classical normal-form game approach [13] by specifying all the players’ strategies. Note also that in our formulation of $$N$$-KEG, players’ strategies are lattice points inside polytopes described by systems of linear inequalities. Thus, according to [15], $$N$$-KEG and, in particular, 2-KEG belongs to the class of integer programming games.

We show that 2-KEG has always a pure Nash equilibrium (NE) and that it can be computed in polynomial time. Furthermore, we prove the existence of a NE that is also a social optimum, i.e., the existence of an equilibrium where the maximum number of exchanges is performed. Finally, we show how to determine a NE that is a social optimum, always the preferred outcome of both players, and can be computed in polynomial time.

Our work indicates that studying the players interaction through 2-KEG turns the exchange program efficient both from the social welfare and players’ point of view. In contrast, as mentioned before, there is no centralized mechanism that is strategyproof and at the same time guarantees a social optimum. Although we provide strong evidence that under 2-KEG the players’ most rational strategy is a social optimum, we note the possibility of multiple equilibria. We show that the worst case Nash equilibrium in terms of social welfare is at least $$\frac{1}{2}$$ of the social optimum. Thus, the worst case outcome for our game is comparable with the one for the best deterministic strategyproof mechanism (recall that it guarantees a 2-approximation of the social optimum). Therefore, the 2-KEG opens a new research direction in this field that is worth being explored.

Organization of the paper Section 2 formulates 2-KEG in mathematical terms. Section 3 proves the existence of a Nash equilibrium that maximizes the social welfare and measures the Nash equilibria quality enabling the comparison of our game with strategyproof mechanisms. Section 4 proves that the players have incentive to choose Nash equilibrium that are socially optimal. Section 5 refines the concept of social welfare equilibria motivating for a unique rational outcome for the game. Section 6 discusses extensions to our model and Sect. 7 draws some conclusions.

## 2 Definitions and preliminaries

Let the players of 2-KEG be labeled player A and player B. The operator $$(\cdot )^{-n}$$ for some $$n \in \lbrace A,B \rbrace$$ denotes the opponent of player n. For representing a 2-KEG as a graph, let V be a set of vertices representing the incompatible patient–donor pairs of players A and B, and E be the set of possible pairwise exchanges, i.e., the set of edges (ij) such that the patient of $$i \in V$$ is compatible with the donor of $$j \in V$$ and vice versa. For each player n, $$V^n \subseteq V$$ and $$E^n \subseteq E$$ are her patient–donor pairs and internal compatibilities, respectively. A subset $$M^n$$ of $$E^n$$ is called a matching of graph $$G^n=(V^n,E^n)$$ if no two edges of it share the same vertex. A player n’s strategy set is the set of matchings in graph $$G^n=(V^n,E^n)$$. A profile of strategies is the specification of a matching for all players. The independent agent controls the external exchanges $$E^I \subseteq E$$, i.e., $$(a,b) \in E^I$$ if $$a \in V^A$$ and $$b \in V^B$$. Let $$E^I(M^A,M^B)$$ be a subset of $$E^I$$ such that no edge is incident upon a vertex covered by $$M^A$$ or $$M^B$$. For a player B’s matching $$M^B$$ define the player A’s reaction graph$$G^A ( M^B ) = (V, E^A \cup E^I(\emptyset ,M^B) )$$ and for a player A’s matching $$M^A$$ define the player B’s reaction graph$$G^B ( M^A ) = (V, E^B \cup E^I(\emptyset ,M^A) )$$. We will represent vertices that belong to $$V^A$$ as gray circles and vertices that belong to $$V^B$$ as white diamonds.

On the first stage of 2-KEG, each player n decides simultaneously a matching $$M^n$$ of graph $$G^n$$ to be executed. On the second stage of the game, given player A’s first-stage decision $$M^A$$ and player B’s first-stage decision $$M^B$$, the IA decides the external exchanges to be performed such that the number of pairs covered by its decision is maximized. In other words, the IA finds a maximum matching$$M^I(M^A,M^B)$$ of $$E^I(M^A,M^B)$$, i.e., a matching of maximum cardinality. In the end of the game, player A’s utility is $$2 \vert M^A \vert + \vert M^I(M^A,M^B) \vert$$ and player B’s utility is $$2 \vert M^B \vert + \vert M^I(M^A,M^B) \vert$$.

An important factor for a game is that its rules are executed efficiently. For 2-KEG this means that the IA optimization problem must be easy to solve. Edmonds [12] proved that the problem of computing a maximum matching can be solved in polynomial time for any graph. Therefore, given the players’ decisions, the IA optimization problem is solved in polynomial time.

A legitimate question that must be answered is if the game is well defined in the sense that the rules are unambiguous. Note that the utility of each player depends on the IA decision rule. In the general $$N$$-KEG case, there might be situations where there are multiple optimal IA’s decisions that benefit the players differently. However, for 2-KEG that is not possible, because only pairwise exchanges are considered. That is, any IA matching leads to equal benefits for both players.

### Proposition 1

2-KEG is well defined.

One apparent difficulty in the treatment of the game has to do with the bilevel optimization problem (1.1) of each player. However, computing a player’s optimal strategy to a fixed matching of the other player can be simplified. From the standpoint of player A, the best reaction$$M^A$$ to a player B’s fixed strategy $$M^B$$ can be computed by dropping the IA objective function (1.1c) (game rule) and solving the single level matching problem in the reaction graph $$G^A ( M^B )$$. Basically, we are claiming that player A best reaction predicts the appropriate IA decision given $$M^A$$ and $$M^B$$. This holds because IA’s edges have a positive impact on the utility of player A.

### Lemma 1

Let $$M^B$$ be a matching of player B in 2-KEG. Player A’s best reaction to $$M^B$$ can be achieved by solving a maximum weight matching problem on the graph $$G^A ( M^B )$$, where the edges of $$G^A$$ in $$E^A$$ have weight 2 and those in $$E^I(\emptyset ,M^B)$$ weight 1. The equivalent for player B also holds.

## 3 Nash equilibria and social welfare

Normal form games are a class of finite games for which the players’ strategies are explicitly specified. Unlike these games, the literature on integer programming games is almost nonexistent and the intuition is that they are more difficult to treat, since players’ set of feasible strategies can have exponential size.

A Nash equilibrium is a widely accepted solution for a game. Nash [18] proved, in a non-constructive way, that any finite game has a NE. General algorithms to compute NE for normal form games were devised, but they fail to be polynomial [19]. In particular, these algorithms are inappropriate for integer programming games, as they require the explicit enumeration of all feasible strategies and here, the set of feasible matchings grows exponentially with the number of patient–donor pairs (vertices of the graph).

In this paper, we will concentrate on pure equilibria. A player A’s matching $$M^A$$ of $$G^A$$ and a player B’s matching $$M^B$$ of $$G^B$$ is a pure Nash equilibrium for 2-KEG if
\begin{aligned}&2 \vert M^A \vert + \vert M^I(M^A,M^B) \vert \ge 2 \vert {R}^A \vert + \vert M^I({R}^A,M^B) \vert \quad \forall \text { matching } {R}^A \text { of } G^A\\&2 \vert M^B \vert + \vert M^I(M^A,M^B) \vert \ge 2 \vert {R}^B \vert + \vert M^I(M^A,{R}^B) \vert \quad \forall \text { matching } {R}^B \text { of } G^B. \end{aligned}
Along the paper we use NE to refer to pure Nash equilibria. Under 2-KEG, each player seeks to choose an internal matching that leads to the maximization of the number of its patients receiving a transplant in the end of the game. Hence, a rational profile of strategies is one that simultaneously maximizes each players’ utility. The NE satisfies this goal.

A mixed-strategy Nash equilibrium attributes a probability distribution over the players’ feasible decisions; therefore, its description may involve an exponential number of players’ strategies, which is computationally unsuitable.

In Sect. 3.1, we prove the existence of NE for 2-KEG and that it can be computed in polynomial time. Through these results, in Sect. 3.2 we prove the existence of a NE that maximizes the social welfare (sum of the players’ utilities or, equivalently, number of vertices matched). In Sect. 3.3, we measure the quality of the NE in terms of social welfare. This analysis allow us to conclude that the worst case Nash equilibrium to 2-KEG and the best deterministic strategy proof mechanism guarantee that at least $$\frac{1}{2}$$ of the number of vertices matched in a social optimum is achieved.

### 3.1 Existence of a pure Nash equilibrium

In order to prove the existence of a pure NE we will use the concept of potential function to games, as defined in [17]. For 2-KEG, a potential function $${\varPhi }$$ is a real-valued function over the set of player A’s matchings in $$G^A$$ and player B’s matchings in $$G^B$$ such that the value of $${\varPhi }$$ increases strictly when a player switches to a new matching that improves its utility. In particular, a potential function is exact when this increase is equal to the player’s utility increase when she unilaterally deviates to a new matching.

Observe that a player A’s decision does not interfere in the set of player B’s matchings in $$G^B$$. In particular, player A cannot influence the part of player B’s utility related with a matching in $$G^B$$. The symmetric observation holds for player B’s decision. With this in mind, it is not difficult to find an exact potential function to 2-KEG.

### Proposition 2

Function $${\varPhi } (M^A,M^B) = 2 \vert M^A \vert + 2 \vert M^B \vert + \vert M^I(M^A,M^B) \vert$$ is an exact potential function of 2-KEG.

A profile of strategies for which the potential function maximum is attained is a NE (Lemma 2.1 of [17]). Otherwise, at least one of the players would have advantage in switching to a new strategy, which would imply that the potential function would strictly increase its value in this new profile. However, that contradicts the fact that the previous profile was a potential function optimum.

### Theorem 1

There exists at least one pure Nash equilibrium to 2-KEG and it can be computed in polynomial time.

### Proof

A matching corresponding to the maximum of the function $${\varPhi }$$ of Proposition 2 is a NE of 2-KEG. Computing a maximum to $${\varPhi }$$ is equivalent to solving a maximum weight matching problem, where the edges in $$E^A$$ and $$E^B$$ weight 2 and the edges in $$E^I$$ weight 1. This can be done in polynomial time (see, e.g., [20]). Observe that the set of external matchings associated with the solution of this maximum weight matching problem is a maximum matching in $$E^I$$ except edges incident with internal matchings of that solution. $$\square$$

Consider the 2-KEG instance represented in Fig. 1. In this case, the NE achieved by computing the potential function maximum is $$M^A=\lbrace (4,5) \rbrace$$, $$M^B = \lbrace (2,3) \rbrace$$ (and thus, $$M^I(M^A,M^B) = \emptyset$$). There is another NE that does not correspond to a potential function maximum: $$R^A = \emptyset$$, $${R}^B= \emptyset$$ and consequently $$M^I({R}^A,{R}^B) = \lbrace (1,2), (4,3 ), (5,6) \rbrace$$. The latter helps all the patient–donor pairs, and thus is more appealing to the players. This observation motivates the need of studying efficient Nash equilibria that are possibly not achieved through the potential function maximum.

### 3.2 Social welfare equilibrium

In what follows, we introduce a refinement of the NE concept in 2-KEG: the social welfare equilibrium.

A social optimum of 2-KEG is a maximum matching of the overall graph game $$G=(V, E)$$, corresponding to an exchange program that maximizes the number of patients receiving a kidney. A social welfare equilibrium (SWE) is a NE that is also a social optimum.

Observe that any NE, and thus any SWE, is a local maximum of $${\varPhi }$$ if the neighborhood of a strategy profile consists of a player’s unilateral deviation. In what follows, we will use this fact to prove the existence and efficient computation of a SWE.

Let us define some concepts of graph theory in matching (see Chapter 5 of [6] for details). For a matching M in graph $$G=(V,E)$$, an M-alternating path is a path whose edges are alternately in $$E \setminus M$$ and M. An M-augmenting path is an M-alternating path whose origin and destination are M-unmatched vertices. The next property will be used often in what we will develop.

### Property 1

Let M be a maximum matching of a graph $$G=(V,E)$$. Consider an arbitrary $$R\subset M$$ and the subgraph H of G induced by removing the $$R$$-matched vertices. The union of any maximum matching of H with $$R$$ is a maximum matching of G.

Next, we recall Berge’s theorem [5].

### Theorem 2

(Berge [5]) A matching M of a graph G is maximum if and only if it has no augmenting path.

Berge’s theorem is constructive, leading to an algorithm to find a maximum matching: start with an arbitrary matching M of G; while there is an M-augmenting path p, switch the edges along the path p from in to out of M and vice versa: update M to $$M\oplus p$$, where $$\oplus$$ represents the symmetric difference of two sets. The updated M is a matching with one more edge, where the previously matched vertices are maintained matched.

We have now the tools to prove the existence of a SWE.

### Theorem 3

There is always a social welfare equilibrium to 2-KEG.

### Proof

Let M be a maximum matching (and thus, a social optimum) of the graph G representing a 2-KEG, where $$E^A \cap M$$ and $$E^B \cap M$$ are players’ A and B strategies, respectively. If M is not a NE, let us assume, without loss of generality, that player A has incentive to deviate from $$E^A \cap M$$, given player B’s strategy $$E^B \cap M$$. Let $$M^A$$ be player A’s best reaction to $$E^B \cap M$$. Observe that we can assume that $$M^A \cup M^I(M^A, E^B \cap M)$$ is a maximum matching of A in the reaction graph $$G^A(E^B \cap M )$$. If it is not, by Berge’s theorem, there is a maximum matching such that it does not decrease the number of player A’s matched vertices. Therefore, by Property 1, $$\vert M^A \vert + \vert M^I(M^A, E^B \cap M) \vert +\vert E^B \cap M \vert = \vert M \vert$$.

Given that A has incentive to deviate, it holds by definition of potential function that $${\varPhi }(E^A \cap M, E^B \cap M) < {\varPhi } (M^A, E^B \cap M)$$. If $$M^A$$ together with $$E^B \cap M$$ is not a NE, then we can repeat the procedure above (alternating the player) until a NE is obtained. Note that the value of the potential function increases strictly, which means that no feasible profile of strategies is visited more than once. In addition, players have a finite number of feasible matchings, which implies that this process will terminate in an equilibrium. $$\square$$

Besides the fact that a SWE is an appealing NE to the players, it also has the advantage of being computable in polynomial time through the algorithm of the last proof (translated to pseudo-code in Algorithm 3.2.1). It is a well-known result that weighed matching problems can be solved in polynomial time (see, e.g., [20]). Therefore, it remains to prove that the number of iterations is polynomially bounded in the size of the instance. The next trivial result can be used to this end.

### Lemma 2

An upper bound to the maximum value of the 2-KEG potential function $${\varPhi } (M^A,M^B) = 2\vert M^A \vert + 2\vert M^B \vert + \vert M^I (M^A,M^B ) \vert$$ is $$\vert V^A \vert + \vert V^B \vert .$$

As noted before, the potential function $${\varPhi }$$ strictly increases whenever a player has incentive to unilaterally change her strategy. Therefore, our algorithm will in the worst case stop once the maximum value to $${\varPhi }$$ is reached, which is bounded by $$\vert V^A \vert + \vert V^B \vert$$. Taking into account that the value of $${\varPhi }$$ is always an integer number, the number of evaluations of $${\varPhi }$$ through the process is also bounded by $$\vert V^A \vert + \vert V^B \vert$$.

### Theorem 4

The computation of a social welfare equilibrium to 2-KEG can be done in polynomial time.

### 3.3 Price of stability and price of anarchy

In order to measure the quality of the Nash equilibria of a given game, we use the standard measures: price of stability and price of anarchy (see Chapter 17 of [19]). The price of stability (PoS) is the ratio between the highest total utilities value of one of its equilibria and that of a social optimum; the price of anarchy (PoA) is the ratio between the lowest total utilities value within its equilibria and that of a social optimum.

The following two results set PoS and PoA for 2-KEG.

### Corollary 1

The price of stability of the 2-KEG is 1.

### Proof

Since we proved existence of a social welfare equilibrium:
\begin{aligned} \text {PoS} = \frac{\text {highest total utilities value among all Nash equilibria}}{\text {social optimum}} = 1. \end{aligned}
$$\square$$

### Theorem 5

The price of anarchy is $$\frac{1}{2}$$ for the 2-KEG.

### Proof

By the definition of price of anarchy
\begin{aligned} \text {PoA} = \frac{\text {lowest total utilities value among all Nash equilibria}}{\text {social optimum}}. \end{aligned}
Let $$M^A$$, $$M^B$$ and $$M^I (M^A,M^B )$$ be the matchings of player A, B and the IA, respectively, that lead to the Nash equilibrium with lowest total utilities value, that is
\begin{aligned} z^* = 2 \vert M^A \vert + 2 \vert M^B \vert + 2 \vert M^I(M^A,M^B) \vert . \end{aligned}
Let M be a maximum matching of the game graph G. Therefore, the social optimum is equal to
\begin{aligned} {\overline{z}} = 2 \vert M \cap E^A \vert + 2 \vert M \cap E^B \vert + 2 \vert M \cap E^I \vert . \end{aligned}
By the definition of NE, we know that under $$M^A$$ and $$M^B$$, none of the players has incentive to deviate, thus
\begin{aligned} z^*\ge & {} 2 \vert M \cap E^A \vert + \vert M^I (M \cap E^A,M^B ) \vert +2 \vert M \cap E^B \vert +\vert M^I (M^A,M\cap E^B) \vert \nonumber \\ \Leftrightarrow z^*\ge & {} 2 \vert M \cap E^A \vert + 2 \vert M \cap E^B \vert + 2 \vert M \cap E^I \vert - 2 \vert M \cap E^I \vert \nonumber \\&+ \vert M^I (M \cap E^A,M^B ) \vert + \vert M^I (M^A,M\cap E^B) \vert \nonumber \\ \Leftrightarrow z^*\ge & {} {\overline{z}}- \left( 2 \vert M \cap E^I \vert - \vert M^I (M^A,M\cap E^B) \vert - \vert M^I (M \cap E^A,M^B) \vert \right) . \end{aligned}
(3.1a)
The set $$M \cap E^I$$ may include matchings of vertices also matched under $$M^A$$ or $$M^B$$, therefore
\begin{aligned} 2 \vert M \cap E^I \vert \le 2 \vert M^A \vert + 2 \vert M^B \vert + \vert R^A \vert + \vert R^B \vert \end{aligned}
where $$R^n$$ is a subset of E considering all the edges in $$M \cap E^I$$ but not in $$M^n$$ and incident with a vertex of $$V^n$$, for $$n=A,B$$. See Fig. 2. The number of player B’s vertices matched in $$M^I \left( M\cap E^A, M^B \right)$$ is equal or greater than $$R^B$$, because this external matching has available the vertices incident with the edges of $$R^B$$ and can match them with any vertex not in $$M \cap E^A$$, thus
\begin{aligned} \vert R^B \vert - \vert M^I (M^A,M\cap E^B) \vert \le 0. \end{aligned}
In a completely analogous way, it can be shown that
\begin{aligned} \vert R^A \vert - \vert M^I (M \cap E^A,M^B) \vert \le 0. \end{aligned}
The inequalities above imply
\begin{aligned} 2 \vert M \cap E^I \vert -\vert M^I (M^A,M\cap E^B) \vert - \vert M^I (M \cap E^A,M^B) \vert \le 2 \vert M^A \vert + 2 \vert M^B \vert \le z^*, \end{aligned}
which together with inequality (3.1a) results in
\begin{aligned} z^* \ge {\overline{z}}- z^* \Leftrightarrow \frac{z^*}{{\overline{z}}}\ge \frac{1}{2}. \end{aligned}
Now, we will use an instance to prove that the bound $$\frac{1}{2}$$ is tight.
Consider a 2-KEG represented by the graph of Fig. 3. It is easy to see that the worst Nash equilibrium in terms of total utilities is $$M^A = \lbrace \left( 1,2\right) \rbrace$$, $$M^B = \emptyset$$ and $$M^I \left( M^A,M^B\right) = \emptyset$$ with a total of $$z^* =2$$. On the other hand, the social optimum is $$M=\lbrace \left( 1,3 \right) , \left( 2,4 \right) \rbrace$$ with a value of $${\overline{z}} = 4$$. In this instance the price of anarchy is $$\frac{z^*}{{\overline{z}}}= \frac{2}{4}= \frac{1}{2}$$.$$\square$$

## 4 Rational outcome: social welfare equilibrium

A profile of strategies is dominated if there is another profile in which all the players are equal or better, with at least one of them strictly better. A profile of strategies is said to be Pareto efficient if it is not dominated [21]. In this section, we will prove that the social welfare equilibria are Pareto efficient and any NE that is not social optimal is dominated by a SWE. Consequently, from both the social welfare and the players’ point of view, these equilibria are the most desirable game outcomes. Moreover, recall that in Sect. 3.2, we presented an algorithm that computes a SWE in polynomial time emphasizing its practicality.

Below we show that no SWE is dominated, i.e., all SWE are Pareto efficient.

### Lemma 3

In 2-KEG any social welfare equilibrium is Pareto efficient.

### Proof

Let $$M^A$$ and $$M^B$$ be players’ A and B strategies, respectively, in a SWE. Assume that this SWE is not Pareto efficient, that is, there is a player A’s feasible strategy $${R}^{A}$$ and a player B’s feasible strategy $${R}^{B}$$ that dominate this equilibrium. Without loss of generality, these assumptions translate into
\begin{aligned}&2 \vert M^A \vert + \vert M^I(M^A,M^B) \vert \le 2 \vert {R}^{A} \vert + \vert M^I({R}^{A},{R}^{B}) \vert \\&2 \vert M^B \vert + \vert M^I(M^A,M^B) \vert < 2 \vert {R}^{B} \vert + \vert M^I({R}^{A},{R}^{B}) \vert . \end{aligned}
Summing the two inequalities above and simplifying, we obtain
\begin{aligned} \vert M^A \vert + \vert M^I(M^A,M^B) \vert + \vert M^B \vert < \vert {R}^{A} \vert + \vert M^I({R}^{A},{R}^{B}) \vert + \vert {R}^{B} \vert , \end{aligned}
which contradicts the assumption that the equilibrium given by $$M^A$$ and $$M^B$$ is a social optimum (maximum matching). $$\square$$

Note that this result also holds for more than two players which reinforces the interest of studying SWE.

In the next section, we prove any NE that is not a social optimum is dominated by a SWE. In order to achieve this result we need the following theorem, which fully characterizes an optimal reaction of a player.

### Theorem 6

In 2-KEG, let $$M^B$$ be a player B’s fixed matching. A player A’s matching $$M^A$$ can be improved if and only if there is a $$M^A\cup M^I(M^A,M^B)$$-alternating path in $$G^A (M^B)$$ whose origin is a vertex in $$V^A$$, unmatched in this path, and the destination is a
1. i.

$$M^A\cup M^I(M^A,M^B)$$-unmatched vertex belonging to $$V^A$$, or

2. ii.

$$M^I(M^A,M^B)$$-matched vertex in $$V^B$$, or

3. iii.

$$M^I(M^A,M^B)$$-unmatched vertex in $$V^B$$.

The symmetric result for player B also holds.

### Proof

Consider a fixed match $$M^B$$ of $$G^B$$.

(Proof of “if”). Let $$M^A$$ be a player A’s strategy. Recall Lemma 1 in which we state that given $$M^B$$, we can assume that player A controls the IA decision. If there is a path p in $$G^A(M^A)$$ satisfying i., ii. or iii., then, $$(M^A \cup M^I(M^A,M^B)) \oplus p$$ improves player A’s profit in comparison with $$M^A \cup M^I(M^A,M^B)$$; see Fig. 4 for an illustration.

(Proof of “only if”). Let $$M^A$$ be player A’s best reaction to $$M^B$$ and consider a feasible player A’s strategy $$R^A$$ that is not her best reaction to $$M^B$$. We will show that assuming that there is no $$R^A\cup M^I(R^A,M^B)$$-alternating path of $$G^A(M^B)$$ as stated in the theorem leads to a contradiction.

Note that given any two matchings $$M^1$$ and $$M^2$$ of a graph, in the induced subgraph with edges $$M^1 \oplus M^2$$, each vertex can be incident to at most two edges; hence, any connected component of $$M^1 \oplus M^2$$ is either an even cycle with edges alternately in $$M^1$$ and $$M^2$$, or a path with edges alternately in $$M^1$$ and $$M^2$$. Let us define $$H^A$$ as the subgraph of $$G^A$$ that results from considering the edges in $$M^A \oplus R^A$$, and H as the subgraph of $$G^A(M^B)$$ that results from considering the edges in $$(M^A \cup M^I(M^A,M^B) ) \oplus (R^A \cup M^I(R^A,M^B) )$$. Connected components of $$H^A$$ and of H are either even cycles or paths.

If $$\vert M^A \vert > \vert R^A \vert$$, $$H^A$$ has more edges of $$M^A$$ than of $$R^A$$, and therefore there exists a path p of $$H^A$$ that starts and ends with edges of $$M^A$$. If the origin and destination of p are $$M^I(R^A,M^B)$$-unmatched, then p is an $$R^A\cup M^I(R^A,M^B)$$-alternating path as stated in i., which contradicts our assumption. Thus, for all paths of $$H^A$$ starting and ending with edges of $$M^A$$, it holds that all their vertices are both $$M^A$$-matched and $$R^A \cup M^I(R^A,M^B)$$-matched (see Fig. 5). Therefore, the advantage of $$M^A \cup M^I(M^{A},M^B )$$ over $$R^A \cup M^I (R^A, M^B)$$ must be outside $$H^A$$. Analogously, if $$\vert M^A \vert \le \vert R^A \vert$$, we also conclude that the advantage of $$M^A \cup M^I(M^{A},M^B )$$ over $$R^A \cup M^I (R^A, M^B)$$ must be outside $$H^A$$.

In this way, there is $$a \in V^A$$ and $$b \in V^B$$ such that $$(a,b) \in M^I (M^{A},M^B )$$, but a is $$R^A \cup M^I (R^A, M^B)$$-unmatched. Then, since we assumed that there is no $$R^A \cup M^I( R^A,M^B )$$-alternating path as stated in the theorem (and the IA does not violate the game rules), the path of H starting in a must end in a vertex $$a' \in V^A$$ that is $$R^A \cup M^I(R^A,M^B)$$-matched and $${M}^A \cup M^I({M}^A,M^B)$$-unmatched. Therefore, the number of $$V^A$$ vertices covered by $$M^A \cup M^I ( M^A,M^B)$$ and $$R^A \cup M^I ( R^A,M^B)$$ on this component is the same (see Fig. 6). In conclusion, any path of H starting in a vertex of $$V^A$$ that is $$R^A \cup M^I ( R^A,M^B)$$-unmatched and $$M^I(M^A,M^B)$$-matched does not give advantage to $$M^A \cup M^I ( M^A,M^B)$$ over $$R^A \cup M^I ( R^A,M^B)$$. This contradicts the fact that strategy $$R^A$$ is not a player A’s best reaction to $$M^B$$. $$\square$$

### 4.1 Computation of a dominant SWE

We present in Algorithm 4.1.1 a method that, given a 2-KEG graph and a socially suboptimal Nash equilibrium, computes a SWE that we claim dominates the given equilibrium.

In what follows we provide a proof of the correctness of this algorithm. For sake of clarity, first of all, we provide an illustration of how the algorithm works by applying it to a 2-KEG instance.

### Example 1

Consider the 2-KEG instance represented in Fig. 7.

A Nash equilibrium M that is not a maximum matching is represented by bold edges in the top-left graph of Fig. 8. The matching M is a Nash equilibrium, since there is no M-alternating path as stated in Theorem 6; and it is not a maximum matching because there are M-augmenting paths, e.g., (25, 24, 5, 6, 20, 21, 22, 23). We will apply Algorithm 4.1.1 to this NE in order to achieve one that is a SWE and dominates it.

The algorithm starts by computing an arbitrary maximum matching $$S$$, represented in the top-right graph of Fig. 8; the symmetric difference between M and $$S$$ is represented in the center-left graph of that figure. There are 6 connected components in $$M \oplus S$$, three of which include M-augmenting paths, namely
\begin{aligned} \mathcal {P}^1= & {} \lbrace (33,32,31,30,3,4,26,27,28,29), (25,24,5,6,20,21,22,23),\\&(15,14,13,12,11,10,19,18,17,16) \rbrace . \end{aligned}
Therefore, at the end of step 7 we obtain a maximum matching $$M^1$$, represented at the center-right of Fig. 8.
The algorithm proceeds searching for an $$M^1$$-alternating path of type ii. in $$G^n(M^1 \cap E^{-n})$$ for some $$n \in \lbrace A, B\rbrace$$, i.e., the algorithm will check if $$M^1$$ is a NE. In this step, path $$x=(1,2,3,4,5,6,7,8,9)$$ is found, which shows that $$M^1$$ is not an equilibrium. The M-augmenting path $$y= (25,24,5,6,20,21,22,23)$$ is replaced by $$z=(9,8,7,6,20,21,22,23)$$, leading to matching $$M^2$$ represented at the bottom-left graph of Fig. 8. Next, step 17 is used to verify if there is an $$M^2$$-alternating path of type ii. considering only the edges (1, 2), (2, 3), (3, 4), (4, 5), (5, 24), (24, 25) . There is one, namely path (1, 2, 3, 4, 5, 24, 25). The M-augmenting path $$(33,32,31,30,3,4,26,27,28,29)$$ is modified into (25, 24, 5, 4, 26, 27, 28, 29), obtaining $$M^3$$ represented in the lower-right graph of Fig. 8. In the next iteration no $$M^3$$-alternating path of type ii. can be found, and thus the algorithm terminates. $$M^3$$ is a SWE that dominates M.

Next we will prove that for any socially suboptimal NE, the Algorithm 4.1.1 returns a dominant SWE.

The algorithm starts by computing a maximum matching S. If the Nash equilibrium from the input is a maximum matching, the algorithm returns it and stops. Otherwise, it proceeds. At iteration t, $$\mathcal {P}^t$$ is the set of M-augmenting paths used to compute the maximum matching $$M^t$$. In this way, step 7 augments M in order to obtain a maximum matching $$M^1$$. Note that $$\vert \mathcal {P}^1 \vert$$ augmenting paths of M are used in order to get $$M^1$$ and that the symmetric difference of a matching with an associated augmenting path only adds additional covered vertices. Therefore, none of the M-matched vertices is $$M^1$$-unmatched, which shows that the players’ utilities associated with $$M^1$$ are equal to or greater than the ones achieved through M.

Note that if there is an $$M^1$$-alternating path of type i. or iii., then it is also an augmenting path of $$M^1$$ contradicting the fact that $$M^1$$ is a maximum matching. Therefore, by Theorem 6, if $$M^1$$ is not a Nash equilibrium then there is an $$M^1$$-alternating path of type ii. in $$G^A(M^1 \cap E^B)$$ or $$G^B(M^1 \cap E^A)$$. In this case, the algorithm will remove the $$M^1$$-alternating path of type ii. through steps 8–15. In these steps an M-augmenting path $$y \in \mathcal {P}^1$$ is replaced by a new M-augmenting path z. Thus, it is obvious that the new maximum matching $$M^2$$ dominates the utilities achieved through M.

Suppose that in step 8 an $$M^t$$-alternating path x of type ii. is found. Since M is a NE, the path x cannot be M-alternating. Thus, x intersects at least one $$M^t$$-matched edge of a $$y \in \mathcal {P}^t$$. The algorithm picks such y accordingly with the one closest to $$v_{2m}$$, since this rule ensures that y never intersects x from $$v_{j+1}=u_{k+1}$$ to $$v_{2m}$$. Then, through step 13, $$v_{2m}$$ is made $$M^{t+1}$$-matched, which eliminates the $$M^t$$-alternating path x of type ii. See Fig. 9 for illustration.

So far, we proved that at any iteration t of Algorithm 4.1.1, the current maximum matching $$M^t$$ dominates M and that if there is an $$M^t$$-alternating path of type ii., we eliminate it in the next maximum matching $$M^{t+1}$$. It remains to show that the elimination of paths of type ii. will stop, leading to a SWE.

By construction, the size of the augmenting path sets is maintained during the algorithm execution. Indeed, in each iteration, an M-augmenting path is replaced by a new one.

### Lemma 4

$$\vert \mathcal {P}^t \vert = \vert \mathcal {P}^{k} \vert \quad \forall t,k \ge 1.$$

For an M-augmenting path $$y=(u_0,u_1, \ldots , u_f)$$, define $$\sigma (y)$$ as the number of times that y switches the player’s graph plus one unit if the first internal edge that follows the extreme $$u_0 \in V^i$$ is in $$E^{-i}$$, and plus one unit if the last internal edge that precedes the extreme $$u_f \in V^j$$ is in $$E^{-j}$$. For instance, the path

has $$\sigma$$-value equal to 3: count two unities because, the first extreme vertex, 1, is in $$V^B$$ while the following internal edge, (2, 3), is in $$E^A$$ and add 1 unit because the rest of the path is in $$E^B$$. Indeed, the $$\sigma$$-value of M-augmenting paths has to be greater or equal to two, otherwise it is not a Nash Equilibrium (i.e., there is an M-alternating path as described in Theorem 6, or the independent agent is not choosing a maximum matching as obliged by the game rule). The following lemma states that the $$\sigma$$-value of the paths in $$\mathcal {P}^t$$ is non-increasing.

### Lemma 5

In an iteration t of Algorithm 4.1.1 $$\sigma (y) \ge \sigma (z)$$.

### Proof

Consider an arbitrary iteration t of Algorithm 4.1.1. Without loss of generality, assume that the $$M^t$$-alternating path x of type ii. found is in $$G^A(M^t \cap E^B)$$.

In step 11, $$y=(u_0, u_1, \ldots , u_f)$$ is the selected augmenting path in $$\mathcal {P}^t$$. In order to get z, the part of y from $$u_0$$ to $$u_k$$ is replaced by a path that has all the edges in $$E^A \cup E^I$$. Note that there must be an internal edge in y after $$u_{k+1}$$, otherwise M is not an equilibrium: the path $$(u_f, u_{f-1}, \ldots , u_{k+1}, v_{j+2}, v_{j+3}, \ldots , v_{2m})$$ would be an M-alternating path in $$G^A(M \cap E^B)$$ satisfying one of the conditions of Theorem 6. Thus, we continue the proof by distinguishing two possible cases: the first internal edge in y after $$u_{k+1}$$ is in $$E^B$$ or $$E^A$$.
Case 1:

The first internal edge in y after $$u_{k+1}$$ is in $$E^B$$. Then, $$\sigma (z)$$ is equal to one plus the number of times that the path y from $$u_{k+1}$$ to $$u_f$$ switches the player’s graph plus one unit if the last internal edge before $$u_f \in V^i$$ is in $$E^{-i}$$. Observe that $$\sigma (y)$$ is greater or equal to the number of times that the path y from $$u_{k+1}$$ to $$u_f$$ switches the player’s graph plus one unit if the last internal edge before $$u_f \in V^i$$ is in $$E^{-i}$$. In order to get equal, the part of y from $$u_0$$ to $$u_{k+1}$$ must have the edges in $$E^B \cup E^I$$ and $$u_0 \in E^B$$. However, this contradicts the fact that M is a Nash equilibrium: one of the vertices $$u_k$$ or $$u_{k+1}$$ has to be in $$V^A$$, otherwise y is not in player A’s graph. If $$u_{k+1} \in V^A$$, then $$u_{k+2} \in V^B$$, which means that the part of x from $$v_{2m}$$ to $$(u_{k+1},u_{k+2})$$ is an M-alternating path of type ii. in $$G^A(M \cap E^B)$$. Otherwise, if $$u_{k} \in V^A$$, then $$u_{k-1} \in V^B$$ and the part of y from $$u_0$$ to $$u_{k}$$ is an M-alternating path of type ii. in $$G^B(M \cap E^A)$$. In conclusion, $$\sigma (y) \ge \sigma (z)$$.

Case 2:

The first internal edge in y after $$u_{k+1}$$ is in $$E^A$$. Then, $$\sigma (z)$$ is equal to the number of times that the path y from $$u_{k+1}$$ to $$u_f$$ switches the player’s graph plus one unit if the last internal edge before $$u_f \in V^i$$ is in $$E^{-i}$$. Note that $$\sigma (y)$$ is greater or equal to the number of times that the path y from $$u_{k+1}$$ to $$u_f$$ switches the player’s graph plus one unit if the last internal edge before $$u_f \in V^i$$ is in $$E^{-i}$$. In conclusion, $$\sigma (y) \ge \sigma (z)$$. $$\square$$

An immediate consequence it the following corollary.

### Corollary 2

If $$\sigma (y) > \sigma (z)$$ holds in iteration t, then z will never evolve during the rest of the algorithm to be equal to y.

### Proof

Assume that $$\sigma (y) > \sigma (z)$$ in iteration t. By Lemma 5, if z is selected in a forthcoming iteration then the resulting (modified) path has a $$\sigma$$-value less or equal to $$\sigma (z)$$ and, in particular, less than $$\sigma (y)$$. Therefore, it is impossible that from iteration z this path evolves to y, since that contradicts Lemma 5. $$\square$$

Whenever Algorithm 4.1.1 at iteration t modifies y such that $$\sigma (y)>\sigma (z)$$, we get that the maximum matching $$M^t$$ will never be computed again in later iterations.

### Corollary 3

Algorithm 4.1.1 can only cycle after iteration t if $$\sigma (y)=\sigma (z)$$.

Now, we will prove that when a modification of an augmenting path y to z has $$\sigma (y)=\sigma (z)$$, then the algorithm finds an $$M^{t+1}$$-alternating path of type ii. in step 17. This particular search for such a path is the important ingredient for the algorithm to stop after a finite number of iterations. If we remove this step from Algorithm 4.1.1 and we simply arbitrarily search for the elimination of paths of type ii. then the algorithm can cycle. For instance, in Example 1, when we are in iteration 2 and we do not perform the search as stated in step 17, then we can compute the $$M^2$$-alternating path (1, 2, 11, 10, 7, 6, 5, 24, 25) that would lead us to $$M^3=M^1$$, making the algorithm to cycle.

### Lemma 6

If $$\sigma (y)=\sigma (z)$$ at the end of step 15 of Algorithm 4.1.1, then a path of type ii. is found in step 17.

### Proof

Suppose that the algorithm is in the end of step 15. Without loss of generality, the proof concentrates only on the case for which x is in $$G^A(M^{t-1} \cap E^B)$$, since for x in $$G^B(M^{t-1} \cap E^A)$$ the proof is analogous.

We will make use of Lemma 5 proof in order to conclude that under the lemma hypothesis, $$\sigma (y)=\sigma (z)$$, the edges of y from $$u_0$$ to $$u_k$$ are in $$E^A \cup E^I$$. Case 1 of that proof implies that in order to get $$\sigma (y)=\sigma (z)$$, the edges of the path y from $$u_0$$ to $$u_k$$ should be in $$E^A \cup E^I$$ and $$u_0 \in V^A$$. In order to get $$\sigma (y)=\sigma (z)$$ in case 2, we also get that the edges of the path y from $$u_0$$ to $$u_k$$ should be in $$E^A \cup E^I$$ and $$u_0 \in V^A$$.

Next, we will show that there is an $$M^t$$-alternating path of type ii. from $$(v_0,v_1)$$ to $$u_0$$ that only uses the edges of x from $$v_0$$ to $$v_j$$ and y from $$u_0$$ to $$u_k$$. Therefore, for sake of clarity, consider $$y' = (u_0, u_1, \ldots , u_k)$$ and $$x' = (v_0,v_1, v_2, \ldots , v_j)$$. Recall that $$u_k=v_j$$.

In step 17, the new $$M^t$$-alternating path of type ii.x can be built as follows. Start to follow $$x'$$ from $$v_0$$ until it intersects a vertex $$u_{j_1}$$ in $$y'$$ (note that $$y'$$ intersects $$x'$$ at least in $$u_k=v_j$$). Consider the following possibilities.
Case 1:

If $$(u_{j_1}, u_{j_1-1}) \in M^t$$, then $$x=(v_0,v_1,\ldots , u_{j_1},u_{j_1-1}, \ldots , u_0)$$ is an $$M^t$$-alternating path of type ii.

Case 2:

If $$(u_{j_1},u_{j_1+1}) \in M^t$$, then $$(u_{j_1},u_{j_1-1}) \in M^{t-1}$$ and $$(u_{j_1},u_{j_1-1}) \in x'$$, which implies $$u_{j_1+1} \notin x'$$. Follow $$y'$$ by index increasing order starting in $$u_{j_1+1}$$ until it is reached a vertex $$u_{j_2}=v_{i_1}$$ of $$x'$$ (note that such vertex exists since at least $$u_k = v_j \in x'$$, with $$k>j_1+1$$). The vertex $$u_{j_2-1} \notin x'$$, otherwise, we would have stopped in $$u_{j_2-1}$$. Thus, $$(u_{j_2},u_{j_2-1}) \notin M^{t-1}$$. Otherwise, $$x'$$ would not be an $$M^{t-1}$$-alternating path. In conclusion, $$(u_{j_2},u_{j_2-1}) \in M^t$$. Next, we follow $$x'$$ by index decreasing order starting in $$u_{j_2}=v_{i_1}$$ until we intersect a vertex $$u_{j_3}$$ of $$y'$$ (which has to occur, since we noted before that at least $$u_{j_1-1}$$ is in $$x'$$). If $$(u_{j_3}, u_{j_3-1}) \in M^t$$, then the rest of the $$M^t$$-alternating is found as in case 1. Otherwise, $$(u_{j_3},u_{j_3+1}) \in M^t$$ and we proceed as in the beginning of case 2. This process will terminate in $$u_0$$ since we are always adding new vertices to our $$M^t$$-alternating path and the number of vertices is finite. $$\square$$

### Corollary 4

The algorithm can only cycle if it remains in steps 15–17.

### Theorem 7

After a finite number of executions of steps 15–17, the algorithm fails to find such a path in step 17.

### Proof

The length of the path $$(v_0,v_1, v_2, \ldots , v_j)$$ considered in step 17 strictly decreases in each consecutive executation of steps 15–17. $$\square$$

As a corollary of the above Theorem we can now state the desired result.

### Corollary 5

After a finite number of iterations, the Algorithm 4.1.1 stops and finds a SWE that dominates the NE given in the input.

## 5 Refinement of SWE

Although Algorithm 3.2.1 computes a SWE, the results obtained in Sect. 4 (see Theorem 6) allow the definition of a simpler polynomial time algorithm returning a SWE. Furthermore, the algorithm will solve another aspect left open in the previous sections where we discussed the advantage of SWE among the set of NE for 2-KEG. This refinement to select a NE is still not sufficient to get uniqueness, i.e., there are 2-KEG instances for which there is more than one SWE. The algorithm presented in this section will solve this issue.

### Example 2

Consider the 2-KEG instance represented in Fig. 10. There are four maximum matchings $$M^1$$ to $$M^4$$, of which matchings $$M^1$$ and $$M^2$$ are NE (SWE). Under $$M^1$$ player A has utility 4 and player B has utility 2; in contrast, under $$M^2$$ both players have utility 3.

This instance has two distinct SWE, and by repeating the relevant pattern we can create instances with multiple distinct SWE. For example, the game of Fig. 11 has eight SWE.

In this context it seems rational to search for the social welfare equilibrium that minimizes the number of external exchanges, since that decreases the dependency of the players on each other; in practice, this seems to be a more desirable solution. Therefore, in what follows, we will show how to find such an equilibrium in polynomial time.

Consider Algorithm 5.0.2. This algorithm based on the number of vertices, $$\vert V \vert$$, it associates weight $$2+2 \vert V \vert$$ for internal edges and weight $$1+ 2\vert V \vert$$ for external edges. Then, a maximum weight matching is returned. We will prove that this algorithm can be executed in polynomial time and that it computes a social welfare equilibrium that minimizes the number of external exchanges.

### Lemma 7

Algorithm 5.0.2 can be executed in polynomial time.

### Proof

It is a well-known result that weighed matching problems can be solved in polynomial time (see, e.g., [20]). Therefore, step 7 can be executed in polynomial time. Additionally, the attribution of weights for the graph edges is linear in the number of edges. Therefore, the algorithm can run in polynomial time. $$\square$$

In order to prove that Algorithm 5.0.2 outputs a SWE we need to prove that M is a maximum matching and a NE.

### Lemma 8

Algorithm 5.0.2 returns a maximum matching.

### Proof

In step 7 of the algorithm, the maximum weight on an edge in the maximum weight matching problem considered is $$2+2\vert V \vert$$. Thus, any matching of size k has a total weight not greater than $$k(2+2 \vert V \vert )$$. If that is not a maximum matching, i.e., if $$k<\vert S \vert$$, where S is a maximum matching for G, the total weight is bounded above by
\begin{aligned} k(2+2 \vert V \vert )=2k(1+\vert V \vert )\le & {} 2(\vert S \vert -1)(1+\vert V \vert )\nonumber \\= & {} 2 \vert S \vert \vert V \vert +2(\vert S \vert - \vert V \vert -1) \nonumber \\< & {} 2 \vert S \vert \vert V \vert , \end{aligned}
where the last inequality comes from the fact that $$\vert S \vert < \vert V \vert$$.

A maximum matching on the graph game has a total weight at least equal to $$\vert S \vert (1+2 \vert V \vert )= \vert S \vert +2 \vert S \vert \vert V \vert$$. Therefore, a maximum matching has always a total weight greater than any non maximum matching. In conclusion, a maximum weight matching with the proposed edge weights is also a matching with maximum cardinality. $$\square$$

### Lemma 9

Algorithm 5.0.2 returns a NE.

### Proof

Let M be the output of Algorithm 5.0.2.

By Lemma 8 we know that M is a maximum matching. If M is not a NE, then some player must have incentive to deviate; without loss of generality, assume that player A has incentive to deviate from $$M \cap E^A$$. Then, there must be an M-alternating path p of type ii. in $$G^A(M \cap E^B)$$ such that $$M \oplus p$$ increases player A’s utility
\begin{aligned} 2 \vert (M \oplus p ) \cap E^A\vert + \vert (M \oplus p) \cap E^I \vert > 2 \vert M \cap E^A \vert + \vert M \cap E^I \vert . \end{aligned}
On the other hand, the matching $$\vert M \oplus p \vert$$ must have a total weight not greater than the one associated with M, i.e.,
\begin{aligned}&(2+2 \vert V \vert ) \vert M \cap E^A \vert +(2+2 \vert V \vert ) \vert M \cap E^B \vert +(1+2 \vert V \vert ) \vert M \cap E^I \vert \nonumber \\&\quad \ge (2+2 \vert V \vert ) \vert (M \oplus p) \cap E^A \vert +(2+2 \vert V \vert ) \vert (M \oplus p) \cap E^B \vert \nonumber \\&\qquad +\,(1+2 \vert V \vert ) \vert (M \oplus p) \cap E^I \vert . \end{aligned}
Since the path p only uses the edges in $$E^A \cup E^I$$, the set $$M \cap E^B$$ is equal to $$(M \oplus p) \cap E^B$$. Hence, in this inequality, we can remove the second term of both sides and rewrite as
\begin{aligned}&\overbrace{2 \vert M \cap E^A \vert + \vert M \cap E^I \vert -2 \vert (M \oplus p) \cap E^A \vert -\vert (M \oplus p) \cap E^I \vert }^{<0} \nonumber \\&\quad + \,2 \vert V \vert \left( \vert M \cap E^A \vert + \vert M \cap E^I \vert - \vert (M \oplus p) \cap E^A \vert - \vert (M \oplus p) \cap E^I \vert \right) \ge 0. \end{aligned}
Player A’s utility is bigger with $$M \oplus p$$ than with M. Thus, in this inequality the first four terms lead to a negative number. This implies that
\begin{aligned}&\vert M \cap E^A \vert + \vert M \cap E^I \vert > \vert (M \oplus p) \cap E^A \vert + \vert (M \oplus p) \cap E^I \vert \ge 0,\end{aligned}
which is impossible since, M and $$M \oplus p$$ have the same cardinality and, in particular, $$\vert M \cap (E^A \cup E^I) \vert = \vert (M \oplus p) \cap (E^A \cup E^I) \vert$$. $$\square$$

Finally, it remains to prove that Algorithm 5.0.2 returns a matching that minimizes the number of external edges on it among the set of SWE.

### Lemma 10

Algorithm 5.0.2 outputs a matching that minimizes the number of external edges among the set of social welfare equilibria.

### Proof

Let M be the matching returned by Algorithm 5.0.2. We will prove by showing that assuming another SWE $$M'$$ contains more internal exchanges than M leads to a contradiction. Since both M and $$M'$$ are maximum matchings, $$M'$$ has a total weight greater than M; but this contradicts the fact that the algorithm returns a maximum weight matching (where the internal edges weight more than the external ones). $$\square$$

The next theorem concludes this section.

### Theorem 8

Algorithm 5.0.2 computes a SWE that minimizes the number of external exchanges in polynomial time.

Unfortunately, for some 2-KEG instances this refinement of the SWE still does not lead to an unique solution.

### Example 3

Consider the 2-KEG instance of Fig. 12. There are two SWE that minimize the number of external exchanges, $$M^1$$ and $$M^2$$. These matchings lead both players to an utility of 3.

However, the players utilities under social welfare equilibria that minimize the number of external exchanges are unique as we will prove next.

### Lemma 11

In any SWE that minimizes the number of external exchanges, for a fixed instance, the player’s utilities are always the same.

### Proof

Consider an instance of 2-KEG for which there are two different SWE minimizing the number of external exchanges, say $$M^1$$ and $$M^2$$, of Algorithm 5.0.2. The proof is by contradiction, by assuming that player A’s utilities with $$M^1$$ and $$M^2$$ are different. Without loss of generality,
\begin{aligned} 2 \vert M^1 \cap E^A \vert + \vert M^1 \cap E^I \vert > 2 \vert M^2 \cap E^A \vert + \vert M^2 \cap E^I \vert . \end{aligned}
Build the subgraph H of G induced by the edges in the set $$(M^1 \oplus M^2) \cap (E^A \cup E^I).$$ As player A covers more of her vertices through $$M^1$$ than through $$M^2$$, there must be at least one vertex $$a \in V^A$$ such that a is $$M^1$$-matched and $$M^2$$-unmatched. Consider each distinct component p of H; p is a path starting in, say, vertex a. There are three possible cases. Namely,
Case 1:

path p terminates in an $$M^2$$-matched vertex of $$V^A$$. Then, it is not this component that gives advantage to $$M^1$$.

Case 2:

path p terminates in an $$M^2$$-matched vertex of $$V^B$$. Then, p is an $$M^2$$-alternating path of type ii.; by Lemma 9, this contradicts the fact that $$M^2$$ is a NE.

Case 3:

path p terminates in an $$M^1$$-matched vertex. Then, p is an augmenting path to $$M^2$$; by Lemma 9, this contradicts the fact that $$M^2$$ is a maximum matching.$$\square$$

We finish this section by noting that another desirable SWE is that in which the difference of players’ utilities is minimized, i.e., the discrepancy of the players’ utilities is minimized traducing in a more “fair” outcome. It is easy to show that the social welfare equilibrium introduced in this section, i.e., that minimizing the number of external matchings achieves simultaneously the goal of minimizing the difference of players’ utilities.

### Theorem 9

If M is the SWE with minimum number of external matchings then, it also the SWE that minimizes the difference of players’ utilities.

### Proof

Let $$M^A$$, $$M^B$$ and $$M^I(M^A,M^B)$$ be the social welfare equilibrium that minimizes the number of external matchings. Let $$R^A$$, $$R^B$$ and $$M^I(R^A,R^B)$$ be the social welfare equilibrium that minimizes the difference in the players utilities, i.e., the value of $$\vert 2\vert R^A \vert +\vert M^I(R^A,R^B) \vert - 2\vert R^B \vert -\vert M^I(R^A,R^B) \vert \vert =\vert \vert R^A \vert - \vert R^B \vert \vert$$ is the minimum among all social welfare equilibria.

If $$\vert M^I(M^A,M^B) \vert = \vert M^I(R^A,R^B) \vert$$, then the matching $$R^A \cup R^B \cup M^I(R^A,R^B)$$ is also a SWE that minimizes the number of external matchings. Thus, by the uniqueness of the players’ utilities under this refinement of the SWE, $$M^A \cup M^B \cup M^I(M^A,M^B)$$ also minimizes the difference of players’ utilities.

If $$\vert M^I(M^A,M^B) \vert \ne \vert M^I(R^A,R^B) \vert$$ then, $$\vert M^A \vert + \vert M^B \vert > \vert R^A \vert + \vert R^B \vert$$ since, by hypothesis $$\vert M^I(M^A,M^B) \vert < \vert M^I(R^A,R^B) \vert$$ and both matchings have maximum cardinality. Without loss of generality, there must be a path p that starts and ends in $$M^A$$-matched vertices and alternates between edges in $$M^A$$ and edges in $$R^A$$. Matching $$R^A \cup R^B \cup M^I(R^A,R^B)$$ is a NE which implies that p cannot be a path as described in Theorem 6. Therefore, the extreme vertices of p must be $$M^I(R^A,R^B)$$-matched which does not show any advantage of $$M^A \cup M^I(M^A,M^B)$$ and $$R^A \cup M^I(R^A,R^B)$$ over each other in terms of player A’s utility. In this way, it follows that both matchings lead to the same profit for both players. $$\square$$

In conclusion, one may argue that the players will converge to social welfare equilibria since, given any Nash equilibrium, both players can improve their utilities through a SWE. Additionally, choosing a SWE that minimizes the number of external exchanges is a desirable propriety for both players, and we demonstrated that such equilibrium can be found in polynomial time. Moreover, players are indifferent among such equilibria, because utilities remain the same for any of them. Thus, it seems reasonable to consider that the players will agree in the SWE to be played.

## 6 Model extensions

In what follows, we discuss extensions to the results when our assumptions (exchanges size players’ objectives and number of players) are relaxed.

A common problem of these extensions is that the IA decision may become undefined (in contrast with Proposition 1), in the sense that there might exist more than one optimal solution maximizing the number of external exchanges that would benefit the players differently. In order to deal with this issue, we could, for example, impose a public preference on the external exchanges to the IA, associate a probability for each equivalent optimal solution of the IA or assume that the players are pessimistic/optimistic about the IA decision.

Relaxation of exchanges maximum size to$$L >2$$. In the literature about kidney exchange programs, besides cycles of size two (matchings), typically cycles of size three (3-way exchanges) are allowed. In the latter case, we conjecture that (recall the notation introduced to $$N$$-KEG in Problem 1.1)
\begin{aligned} {\varPhi }(x^A,x^B) = \sum _{c \in C^A} w_c x_c^A+ \sum _{c \in C^B} w_c x_c^B + \sum _{c \in I:w_c^A=w_c^B=1} y_c + \frac{3}{2} \sum _{c \in I: w_c^A= 2 \vee w_c^B=2} y_c \end{aligned}
is a (non-exact) potential function and thus, a maximum is a NE. However, for general values of L the game may fail to have a pure Nash equilibrium, as shown in Fig. 13. The main difference when $$L>3$$ is that in this case external cycles may help strictly more patients of a same player than an internal exchange, while for $$L=3$$ an external exchange helps at most as many patients as an internal one.
Besides cyclic exchanges, researchers have also included chains, where, there is an altruistic donor starting the exchange (see Fig. 14).

Allowing exchanges beyond matchings ($$L=2$$) is an extension with positive impact in the social optimum, and it calls for studying the existence of pure Nash equilibria with good social properties.

Change in players’ objective functions Investigating different players’ utilities is of crucial importance, the literature on the kidney exchange program being rich of examples analyzing different solution selection criteria (e.g., see [11]).

A simple extension would be to assume that the players prioritize maximum matchings that maximize “hard-to-match” vertices. In this case, we could still have a SWE. We first compute a SWE for 2-KEG. If this SWE is not an equilibrium for this extension, then, w.l.o.g., there is a M-unmatched vertex $$a \in V^A$$ hard-to-match and a $$M^A \cup M^I(M^A,M^B)$$-alternating path p that terminates in a player AM-matched vertex that is not hard-to-match. Because the maximum matching $$M'=M \oplus p$$ improves player A utility and does not create alternating paths of type ii. (see Theorem 6), we just need to repeat this process until no player has incentive to deviate.

However, for more complicated players’ utilities the game may fail to have pure Nash equilibria. For instance, consider the compatible graph of Fig. 15. The IA behavior remains as before: maximize the number of external exchanges among the available vertices; be indifferent between the players’ evaluation of the different matchings; have a deterministic decision, this is, for any combination of the players’ strategies (internal matchings) the external exchange selected by the IA is known. In Fig. 16, we have all the possible outcomes for the game. Observe that none of these 4 possible outcomes is a Nash equilibrium and thus, no pure equilibrium exists.

Another extension in this context is to Bayesian games. In this case, the players would not know their opponents evaluations/utilities for the exchanges. Under this incomplete information scenario, it would be interesting to explore how the players can build believes about the opponents’ objectives by repeatedly observing the game outcomes and, thus, use them to compute (Bayesian) equilibria.

Increase number of players to$$N>2$$. Extending our results about the existence of a NE and a SWE dominating it is immediate. Let $$\lbrace 1,2, \ldots , N \rbrace$$ be the set of players. Then, (by extending our notation in an obvious way)
\begin{aligned} {\varPhi }(M^1,M^2,\ldots ,M^N)=\sum _{P=1}^N 2 \vert M^P \vert + \vert M^I(M^1,M^2, \ldots ,M^N)\vert \end{aligned}
is a (non-exact) potential function, and a optimum of it is a NE. The function is potential, since whenever a player increases her utility it is because she is increasing the number of internal exchanges. An increase in the number of internal exchanges has a greater impact in the value of $${\varPhi }$$ than external exchanges. The results in Sect. 4 remain valid in this setting. The ideas presented analyze each player’s incentives for deviation, which hold for more than 2 players, because we can think of a player opponents’ as a single one (reducing the study to 2-KEG).

It remains to investigate, if there is a NE in which the players would agree to choose.

## 7 Conclusions

In this paper, we have shown that 2-KEG has always a pure Nash equilibrium and that it can be computed in polynomial time. Furthermore, we have proven the existence of a NE that is also a social optimum. Finally, and more importantly, we have shown that for any NE there is always a social welfare Nash equilibrium that is a preferred outcome for both players.

There is no uniqueness result for social welfare equilibria. In order to find rational guidelines for the players’ strategies, we add to the social welfare equilibrium the requirement that it must be the one that minimizes the number of external exchanges. For this type of solution, we were able to prove uniqueness in terms of the players’ utilities and to show that it can be efficiently computed, thus strengthening the fact that this is a realistic outcome for the game.

Although we show that a social welfare equilibrium can be computed in polynomial time, a full characterization of the Pareto frontier of social welfare equilibria (with respect to pure Nash equilibria) remains to be done. This is an interesting subject for future research.

Our work also indicates that studying the players interaction through 2-KEG turns the exchange program efficient both from the social welfare and the players’ point of view. These results motivate further research in the generalization of the game to more than two players, to exchanges including more than two patient–donor pairs and to different evaluation metrics of the exchanges. Some of these generalizations have been preliminarily discussed in Sect. 6.

Additional inspiration for future research is given by the recent paper [14], where a strategyproof mechanism for a multi-period dynamic model was shown to lead to a global maximum matching that cannot be guaranteed by a mechanism for the static case. Therefore, given that 2-KEG already provides such solution as a rational outcome in the static case, investigating the 2-KEG by playing it repeatedly as the players’ pools of patient–donor pairs change over time would be another line to explore in the future work.

## Notes

### Acknowledgments

We are indebted with Nicolás Stier-Moses for reading a preliminary version of the paper and providing useful feedbacks. This work was partially supported by national funds through Fundação para a Ciência e a Tecnologia (FCT) within projects PTDC/IIMGES/2830/ 2014 (mKEP - Models and optimisation algorithms for multi-country kidney exchange programs). The first author acknowledges the support of Fundação para a Ciência e a Tecnologia (FCT) through a PhD grant number SFRH/BD/79201/2011 (POPH/FSE program). The second author acknowledges the support of MIUR under the PRIN2012 grant. We would like to thank the anonymous referees for their valuable comments that significantly contributed to the improvement of this work.

### References

1. 1.
Abraham, D.J., Blum, A., Sandholm, T.: Clearing algorithms for barter exchange markets: enabling nationwide kidney exchanges. In: Proceedings of the 8th ACM Conference on Electronic Commerce EC ’07, pp. 295–304, ACM, New York, NY (2007)Google Scholar
2. 2.
Ashlagi, I., Fischer, F., Kash, I.A., Procaccia, A.D.: Mix and match: A strategyproof mechanism for multi-hospital kidney exchange. Games and Economic Behavior 91, 284–296 (2015)
3. 3.
Ashlagi, I., Roth, A.: Individual rationality and participation in large scale, multi-hospital kidney exchange. In: Proceedings of the 12th ACM Conference on Electronic Commerce, EC ’11, pp. 321–322, ACM, New York, NY (2011)Google Scholar
4. 4.
Ashlagi, I., Roth, A.: Individual rationality and participation in large scale, multi-hospital kidney exchange. Working Paper, http://web.mit.edu/iashlagi/www/papers/LargeScaleKidneyExchange_1_13 (2011)
5. 5.
Berge, C.: Two theorems in graph theory. Proc. Nat. Acad. Sci. 43(9), 842–844 (1957)
6. 6.
Bondy, J.A., Murty, U.S.R.: Graph Theory with Applications. Elsevier Science Publishing Co., Inc., Amsterdam (1976)
7. 7.
Caragiannis, I., Filos-Ratsikas, A., Procaccia, A.D.: An improved 2-agent kidney exchange mechanism. In: Chen, N., Elkind, E., Koutsoupias, E. (eds.) Internet and Network Economics, Vol. 7090 of Lecture Notes in Computer Science. Springer, Berlin, pp. 37–48 (2011)Google Scholar
8. 8.
Cechlárová, K., Fleiner, T., Manlove, D.: The kidney exchange game. In: Proceedings of the 8th International Symposium on Operational Research SOR, 5, pp. 77–83 (2005)Google Scholar
9. 9.
Constantino, M., Klimentova, X., Viana, A., Rais, A.: New insights on integer-programming models for the kidney exchange problem. Eur. J. Oper. Res. 231(1), 57–68 (2013)
10. 10.
de Klerk, M., Keizer, K.M., Claas, F.H., Haase-Kromwijk, B.J.J.M., Weimar, W.: The Dutch national living donor kidney exchange program. Am. J. Transpl. 5, 2302–2305 (2005)
11. 11.
Dickerson, J.P., Procaccia, A.D., Sandholm, T.: Price of Fairness in Kidney Exchange. In: Proceedings of the 2014 International Conference on Autonomous Agents and Multi-agent Systems AAMAS ’14, pp. 1013–1020 (2014)Google Scholar
12. 12.
Edmonds, J.: Paths, trees, and flowers. Canad. J. Math. 17, 449–467 (1965)
13. 13.
Fudenberg, D., Tirole, J.: Game Theory, 5th edn. MIT Press, Cambridge, MA (1996)
14. 14.
Hajaj, C., Dickerson, J.P., Hassidim, A., Sandholm, T., Sarne, D.: Strategy-proof and efficient kidney exchange using a credit mechanism. In: Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, January 25–30, pp. 921–928, Austin, TX (2015)Google Scholar
15. 15.
Köppe, M., Ryan, C.T., Queyranne, M.: Rational generating functions and integer programming games. Oper. Res. 59(6), 1445–1460 (2011)
16. 16.
Manlove, D.F., O’Malley, G.: Paired and altruistic kidney donation in the UK: algorithms and experimentation. In: Klasing, R., (ed.), Experimental Algorithms, Vol. 7276 of Lecture Notes in Computer Science. Springer, Berlin pp. 271–282 (2012)Google Scholar
17. 17.
Monderer, D., Shapley, L.S.: Potential games. Games Econ. Behav. 14(1), 124–143 (1996)
18. 18.
Nash, J.: Non-cooperative games. Ann. Math. 54(2), 286–295 (1951)
19. 19.
Nisan, N., Roughgarden, T., Tardos, E., Vazirani, V.V.: Algorithmic Game Theory. Cambridge University Press, New York, NY (2007)
20. 20.
Papadimitriou, C.H., Steiglitz, K.: Combinatorial Optimization: Algorithms and Complexity. Prentice-Hall Inc, Upper Saddle River, NJ (1982)
21. 21.
Scalzo, V.: Pareto efficient Nash equilibria in discontinuous games. Econ. Lett. 107(3), 364–365 (2010)

© Springer-Verlag Berlin Heidelberg and Mathematical Optimization Society 2016

## Authors and Affiliations

• Margarida Carvalho
• 1
• Andrea Lodi
• 2
• 3
• João Pedro Pedroso
• 1
• Ana Viana
• 4
1. 1.INESC TEC and Faculdade de Ciências daUniversidade do PortoPortoPortugal
2. 2.University of BolognaBolognaItaly
3. 3.École Polytechnique de MontréalMontrealCanada
4. 4.INESC TEC and Instituto Superior de Engenharia do PortoPortoPortugal