1 Introduction

Today’s metropolitan areas are populated by a diverse set of residential groups which differ along ethnical, socioeconomic and other traits. A common finding is that social groups within cities are not well-mixed, i.e., the different groups of agents tend to separate themselves into largely homogeneous neighborhoodsFootnote 1. This phenomenon is well-known as residential segregation and is a subject of study in sociology, mathematics and computer science for at least five decades. The most important scientific model addressing residential segregation was proposed by Schelling [35, 36] who simply considered two types of residential agents who are located on a line or on a checkerboard. Each agent is aware of the agents in her neighborhood and is content with her location, if and only if the fraction of neighbors being of her own type is above the tolerance parameter \(\tau\), for some \(0< \tau \le 1\). Discontent agents simply move to another location. Using this basic model Schelling showed that starting from an initially mixed state over time segregated neighborhoods will emerge. While this is to be expected for high \(\tau\), Schelling’s finding was that this also happens for tolerant agents, i.e., if \(\tau \le \tfrac{1}{2}\). Thus, only a slight bias towards favoring similar neighbors leads to the emergence of segregation.

Schelling proposed his model as a random process. This has led to an abundance of empirical studies that simulated this process, see, e.g., [14, 22] and Chapter 4 in [19]. In these studies, the commonly used underlying topology for modeling the residential area are grid graphs (often toroidal grids where vertices of borders on opposite sides are identified), paths and cycles. A recent line of work [5,6,7, 10, 23, 25, 33, 34, 38,39,40] rigorously analyzed variants of this random process on paths or grid graphs and it was shown that residential segregation occurs with high probability. However, in reality agents would not move randomly, instead they would move to a location that maximizes their utility.

To address this selfish behavior, a very recent line of work [1, 17, 20] initiated the study of residential segregation from a game-theoretic point of view. The residential area is modeled as a multi-agent system consisting of selfish agents who occupy vertices of an underlying graph and try to maximize their utility, which depends on the agents’ types in their immediate neighborhood, by strategically selecting locations. Also strategic segregation in social network formation was considered [2].

Schelling games are related to fractional hedonic games [4, 8, 13, 30, 31] and hedonic diversity games [11]. The latter already play a prominent role in coalition formation games and Schelling games represent a very recent complement to this class which constitutes an intensively-studied research area in Multiagent Systems, the sub-field of (Distributed) Artificial Intelligence devoted to the study of the interactions among intelligent agents. Thus, investigating Schelling games and, in particular, understanding the conditions in which stable outcomes are guaranteed to exist and exhibit provably-good efficiency performance is of natural interest to the Artificial Intelligence community.

This paper sets out to significantly improve and deepen the results on game-theoretic residential segregation for the model investigated in [1] which assumes that every vertex of the underlying graph serving as residential area is occupied by an agent and pairs of discontent agents can swap their locations, i.e., their occupied vertices, to increase their utility. Besides modeling housing swaps in residential areas without empty houses, this can also model the distribution of working spaces in firms. In the latter application the workers could be grouped by expertise, by task, or by the used type of tool or machine. The productivity of a worker could depend on the workers in surrounding work spaces. These nearby colleagues could provide additional support if they have similar expertise, work on similar tasks, or work with similar tools or machines.

For the model in [1] we consider the influence of the given topology that models the residential area on core game-theoretic questions like the existence of equilibria, the Price of Anarchy and the game dynamics. We thereby focus on popularly studied topologies like grids, (almost) regular graphs, paths and cycles. Moreover, we follow-up on a proposal by Schelling [36] to restrict the movement of agents locally and we investigate the influence of this restriction. Such local swaps are realistic since people want to stay close to their working place or important facilities like schools. This also holds when considering dynamics where agents repeatedly perform local moves since these dynamics can be understood as a process which happens over a long time span and agents adapt to their new neighborhoods over time.

1.1 Model, definitions and notation

We consider a strategic game played on a given underlying connected, unweighted and undirected graph \(G=(V,E)\), with V the set of vertices and E the set of edges. We denote the cardinalities of V and E with n and m, respectively.

For any vertex \(v \in V\) we denote the neighborhood of v in G as

$$\begin{aligned} N_v=\{u\in V:\{v,u\}\in E\} \end{aligned}$$

and \({\text{deg}} _v=|N_v|\) denotes the degree of v in G. Let \(\varDelta =\max _{v\in V}{\text{deg}} _v\) and \(\delta =\min _{v\in V}{\text{deg}} _v\) be the maximum and minimum degree of vertices in G, respectively. We call a graph G \(\alpha\)-almost regular if \(\varDelta -\delta =\alpha\) and we call \(\alpha\)-almost regular graphs regular if \(\alpha =0\) and almost regular when \(\alpha =1\). Grid graphs will play a prominent role. We will consider grid graphs with  4-neighbors (4-grids) which are formed by a two-dimensional lattice with l rows and h columns and every vertex is connected to the vertex on its left, , right and bottom, respectively, if they exist. In grid graphs with 8-neighbors (8-grids), vertices are additionally also connected to their top-left, top-right, bottom-left and bottom-right vertices, respectively, if they exist.

For a positive integer k, let [k] denote the set \(\{1,\ldots ,k\}\), moreover, given a graph \(G=(V,E)\), let \({{\mathcal {T}}}_k(G)\) denote the set of k-tuples of positive integers summing up to \(n=|V|\).

An instance \((G,{{\mathbf {t}}})\) of a Swap Schelling Game with k types (k-SSG) is defined by a graph \(G = (V,E)\) and a k-tuple \({\mathbf {t}} = (t_1,\dots ,t_k)\in {{\mathcal {T}}}_k(G)\). There are n strategic agents that need to choose vertices in V in such a way that every vertex is occupied by exactly one agent. Every agent belongs to exactly one of the k types and there are \(t_i\) agents of type i, for every \(i\in [k]\). When \(|t_i|=|t_j|\) for each \(i,j\in [k]\), we say that the game is balanced. For convenience and in all of our illustrations, we associate each agent type \(i\in [k]\) with a color. When \(k=2\), we use colors blue and orange and denote by b and \(o=n-b\) the number of blue and orange agents, respectively. Additionally, in case of a game with \(k=2\), we will assume that \(o \le b\), i.e., orange is the color of the minority type. For any graph G and any k-dimensional type vector \(\mathbf {t}\in {{\mathcal {T}}}_k(G)\), let \(c:[n] \rightarrow [k]\) denote the function which maps any agent \(i\in [n]\) to her color \(c(i) \in [k]\).

The strategy of an agent is her location on the graph, i.e., a vertex of G. A feasible strategy profile \({\varvec{\sigma }}\) is an n-dimensional vector whose i-th entry corresponds to the strategy of the i-th agent and where all strategies are pairwise disjoint, i.e., \({\varvec{\sigma }}\) is a permutation of V, and we will treat \({\varvec{\sigma }}\) as a bijective function mapping agents to vertices, with \({\varvec{\sigma }}^{-1}\) being its inverse function. Thus, any feasible strategy profile \({\varvec{\sigma }}\) corresponds to a coloring of G such that for each \(i\in [k]\) exactly \(t_i\) vertices of G are colored with the i-th color. We say that agent i occupies vertex v in \({\varvec{\sigma }}\) if the i-th entry of \({\varvec{\sigma }}\), denoted as \({\varvec{\sigma }}(i)\), is v and, equivalently, if \({\varvec{\sigma }}^{-1}(v) = i\). It will become important to distinguish if two agents ij occupy neighboring vertices under \({\varvec{\sigma }}\). For this, we will use the notation \(1_{ij}({\varvec{\sigma }})\) with \(1_{ij}({\varvec{\sigma }}) = 1\) if agents i and j occupy neighboring vertices under \({\varvec{\sigma }}\) and \(1_{ij}({\varvec{\sigma }}) = 0\) otherwise.

For an agent i and any feasible strategy profile \({\varvec{\sigma }}\), we denote by

$$\begin{aligned} C_i({\varvec{\sigma }})=\{v\in V:c({\varvec{\sigma }}^{-1}(v))=c(i)\} \end{aligned}$$

the set of vertices of G which are occupied by agents having the same color as agent i. The utility of agent i in \({\varvec{\sigma }}\) is defined as

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }})=\frac{|N_{{\varvec{\sigma }}(i)}\cap C_i({\varvec{\sigma }})|}{{\text{deg}} _{{\varvec{\sigma }}(i)}}, \end{aligned}$$

i.e., as the ratio of the number of agents with the same type which occupy neighboring vertices and the total number of neighboring vertices, and each agent aims at maximizing her utility.

Agents can change their strategies only by swapping vertex occupation with another agent. Consider two strategic agents i and j which occupy vertices \({\varvec{\sigma }}(i)\) and \({\varvec{\sigma }}(j)\), respectively. After performing a swap both agents exchange their occupied vertex which yields a new feasible strategy profile \({\varvec{\sigma }}_{ij}\), which is identical to \({\varvec{\sigma }}\) except that the i-th and the j-th entries are exchanged. Thus, in the induced coloring of G, the coloring corresponding to \({\varvec{\sigma }}_{ij}\) is identical to the coloring corresponding to \({\varvec{\sigma }}\) except that the colors of vertices \({\varvec{\sigma }}(i)\) and \({\varvec{\sigma }}(j)\) are exchanged. We say that a swap is local if the swapping agents occupy neighboring vertices, i.e., if \(1_{ij}({\varvec{\sigma }})=1\).

As agents are strategic and want to maximize their utility, we will only consider profitable swaps by agents, i.e., swaps which strictly increase the utility of both agents involved in the swap. It follows that profitable swaps can only occur between agents of different colors. We call a feasible strategy profile \({\varvec{\sigma }}\) a swap equilibrium, or simply, equilibrium, if \({\varvec{\sigma }}\) does not admit profitable swaps, that is, if for each pair of agents ij, we have

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }})\ge \mathsf{U}_i({\varvec{\sigma }}_{ij})\, {\text{or}}\, \mathsf{U}_j({\varvec{\sigma }})\ge \mathsf{U}_j({\varvec{\sigma }}_{ij}). \end{aligned}$$

We call \({\varvec{\sigma }}\) a local swap equilibrium, or simply local equilibrium, if no profitable local swap exists under \({\varvec{\sigma }}\). If agents are restricted to performing only local swaps, then we call the corresponding strategic game Local Swap Schelling Game with k types (local k-SSG). Clearly, any swap equilibrium \({\varvec{\sigma }}\) is also a local swap equilibrium but the converse is not true. Thus the set of local swap equilibria is a superset of the set of swap equilibria. See Example 1 for an illustration of the (local) k-SSG.

Example 1

Consider Fig. 1. There are \(n = 24\) strategic agents with \(k = 3\) types (orange, blue and green) placed on a 4-grid with \(l = 4\) rows and \(h = 6\) columns. The game is not balanced since \(|t_{blue}| = |t_{orange}| = 10\) but \(|t_{green}| = 4\). Agent i occupies vertex u and agent j occupies vertex v, hence \(1_{ij}({\varvec{\sigma }}) = 1\). \({\varvec{\sigma }}\) is a local swap equilibrium but not a swap equilibrium since agent j, occupying vertex v can swap with agent \(j'\) occupying vertex w to increase her utility from \(\frac{1}{3}\) to \(\frac{1}{2}\), while \(j'\) can improve her utility from \(\frac{1}{2}\) to \(\frac{2}{3}\). \(\triangleleft\)

Fig. 1
figure 1

Example of a strategy profile \({\varvec{\sigma }}\) in the (local) k-SSG

We measure the quality of a feasible strategy profile \({\varvec{\sigma }}\) by its social welfare \(\mathsf{U}({\varvec{\sigma }})\), which is the sum over the utilities of all agents, i.e.,

$$\begin{aligned} \mathsf{U}({\varvec{\sigma }}) = \sum _{i=1}^{n}\mathsf{U}_i({\varvec{\sigma }}). \end{aligned}$$

For any game \((G,{{\mathbf {t}}})\), let \({\varvec{\sigma }}^*(G,\mathbf {t})\) denote a feasible strategy profile which maximizes the social welfare and let \(SE(G,\mathbf {t})\) and \(LSE(G,\mathbf {t})\) denote the set of swap equilibria and local swap equilibria for \((G,{{\mathbf {t}}})\), respectively. We will study the impact of the agents’ selfishness on the obtained social welfare for games played on a given class of underlying graphs \({\mathcal {G}}\) with k agent types by analyzing the Price of Anarchy (PoA) [29], which is defined as

$$\begin{aligned} PoA({\mathcal {G}},k) = \max _{G \in {\mathcal {G}}} \max _{\mathbf {t} \in {\mathcal {T}}_{k}(G)}\frac{\mathsf{U}({\varvec{\sigma }}^*(G,\mathbf {t}))}{\min _{{\varvec{\sigma }}\in SE(G,\mathbf {t})}\mathsf{U}({\varvec{\sigma }})}. \end{aligned}$$

Analogously, we define the Local Price of Anarchy (LPoA) as the same ratio but with respect to local swap equilibria. It follows that, for any \(k\ge 2\) and class of graphs \({\mathcal {G}}\), we have \({\text {PoA}}({\mathcal {G}},k) \le {\text {LPoA}}({\mathcal {G}},k)\).

We will also investigate the dynamic properties of the (local) k-SSG, i.e., we analyze if the game has the finite improvement property (FIP) [32]. In our model, a game possesses the FIP if every sequence of profitable (local) swaps is finite. This is equivalent to the existence of an ordinal potential function which guarantees that sequences of profitable (local) swaps will converge to a (local) swap equilibrium of the game. The FIP can be disproved by showing the existence of an improving response cycle (IRC), which is a sequence of feasible strategy profiles \({\varvec{\sigma }}^0, {\varvec{\sigma }}^1,\ldots , {\varvec{\sigma }}^\ell\), with \({\varvec{\sigma }}^\ell = {\varvec{\sigma }}^0\), where \({\varvec{\sigma }}^{q+1}\) is obtained by a profitable swap by two agents in \({\varvec{\sigma }}^q\), for \(q\in \{0\} \cup [\ell -1]\). For investigating the FIP, the following function \(\varPhi\) mapping feasible strategy profiles to natural numbers will be important:

$$\begin{aligned} \varPhi ({\varvec{\sigma }}) = \left| \left\{ \{u,v\}\in E \mid c({\varvec{\sigma }}^{-1}(u)) = c({\varvec{\sigma }}^{-1}(v))\right\} \right| . \end{aligned}$$

Hence, \(\varPhi ({\varvec{\sigma }})\) is the number of edges of G whose endpoints are occupied by agents of the same color under the feasible strategy profile \({\varvec{\sigma }}\). We will denote such edges as monochromatic edges and \(\varPhi ({\varvec{\sigma }})\) as the potential of \({\varvec{\sigma }}\). We will see that potential-preserving profitable swaps exist. For analyzing such swaps, we will consider the extended potential \(\varPsi ({\varvec{\sigma }})\) which essentially is \(\varPhi ({\varvec{\sigma }})\) augmented with a tie-breaker. It is defined as

$$\begin{aligned} \varPsi ({\varvec{\sigma }}) = (\varPhi ({\varvec{\sigma }}),n-z({\varvec{\sigma }})), \end{aligned}$$

where \(z({\varvec{\sigma }})\) is the number of agents having utility 0 under \({\varvec{\sigma }}\). We compare \(\varPsi\) for different strategy profiles \({\varvec{\sigma }}\) and \({\varvec{\sigma }}'\) lexicographically, i.e., on the one hand we have \(\varPsi ({\varvec{\sigma }}) > \varPsi ({\varvec{\sigma }}')\) if

$$\begin{aligned} \varPhi ({\varvec{\sigma }}) > \varPhi ({\varvec{\sigma }}')\,{\text{or}}\, \varPhi ({\varvec{\sigma }}) = \varPhi ({\varvec{\sigma }}')\,{\text{and}}\, z({\varvec{\sigma }}) < z({\varvec{\sigma }}'). \end{aligned}$$

On the other hand we have \(\varPsi ({\varvec{\sigma }}) < \varPsi ({\varvec{\sigma }}')\) if

$$\begin{aligned} \varPhi ({\varvec{\sigma }}) < \varPhi ({\varvec{\sigma }}')\,{\text{or}}\,\varPhi ({\varvec{\sigma }}) = \varPhi ({\varvec{\sigma }}')\,{\text{and}}\,z({\varvec{\sigma }}) >z({\varvec{\sigma }}'). \end{aligned}$$

Note that any profitable swap which increases (decreases) the potential \(\varPhi\) also increases (decreases) the extended potential \(\varPsi\).

1.2 Related work

We focus on related work on game-theoretic segregation models.

Zhang [39, 40] was the first who introduced a game-theoretic model related to Schelling’s original model. There, agents having a noisy single peaked utility function and preferring to be in a balanced neighborhood were employed. Later, Chauhan et al. [17] introduced a game-theoretic model which is much closer to Schelling’s formulation. In their model there are two types of agents and the utility of an agent depends on the type ratio in her neighborhood. An agent is content if the fraction of own-type neighbors is above \(\tau \in (0,1]\). Additionally, agents may have a preferred location. To improve their utility, agents can either swap with another agent who is willing to swap (Swap Schelling Game) or jump to an unoccupied vertex (Jump Schelling Game). Their main contribution is an investigation of the convergence properties of many variants of the model. Moreover, they provide basic properties of stable placements and their efficiency. Echzell et al. [20] strengthen these results but omitted location preferences. Instead they extended the model to more than two agent types and studied the computational hardness of finding optimal placements. Agarwal et al. [1] investigated a similar model with k types where agents are either strategic or stubborn. Only strategic agents are willing to move and strive for maximizing the fraction of own-type neighbors. In jump games, agents move by jumping to a suitable unoccupied location. This corresponds to the jump version of Chauhan et al. [17] with \(\tau =1\). They show that equilibria are not guaranteed to exist, they analyze the complexity of finding optimal placements and they prove that the PoA can be unbounded.

For swap games they show that on underlying trees equilibria may not exist and that deciding equilibrium existence and the existence of a state with at least a given social welfare is NP-hard. They also establish that the PoA is in \(\varTheta (n)\) on underlying star graphs if there are at least two agents of each type and between 2.058 and 4 for balanced games on any graph. Moreover, for \(k\ge 3\) the PoA can be unbounded even in balanced games. Additionally, they give a constant lower bound on the Price of Stability and show that it equals 1 on regular graphs. Finally, they introduce a new benchmark for measuring diversity by counting the number of agents having at least one neighbor of different type. In the present paper, we focus on this very recent model by Agarwal et al. [1] and extend and improve their PoA results.

Very recently, Chan et al. [16] studied a variant of the Jump Schelling Game with \(\tau =1\) where the agents’ utility is a function of the composition of their neighborhood and of the social influence by agents that select the same location. Here the social influence is defined by an auxilliary directed graph that models the social network. This idea of additional social influence was earlier proposed by Agarwal et al. [1] using an undirected social network. Another novel variant of the Jump Schelling Game was investigated by Kanellopoulos et al. [26]. There the main new aspect is that an agent is included when counting its neighborhood size. This subtle change leads to agents preferring locations with more own-type neighbors. Also very recently, Bullinger et al. [12] studied welfare guarantees in Schelling Games. They show results on computing assignments with high social welfare as well as on other optimality notions such as Pareto optimality and two newly introduced measures.

Cooperative games with overlapping coalitions, called OCF-games, from the cooperative game theory literature are related. There, agents can be contained in many coalitions and coalitions may overlap, as in Schelling games. OCF-games are introduced in [15] and different variants of the core are defined and analyzed. In [41, 42] other stability concepts are considered and the tractability of the involved computational problems is studied.

Also hedonic games [9, 18] are related to Schelling games. In particular, Schelling games are similar to fractional hedonic games [4, 8, 13, 30, 31], hedonic diversity games [11] and FEN-hedonic games [21, 24, 27, 28]. In these games, the agents form coalitions and the utility of an agent only depends on the coalition containing that agent. In FEN-hedonic games every agent partitiones the set of agents into friends, enemies, and neutral agents, and the value of a coalition for an agent then depends of the distribution of these types within the coalition. This is similar to Schelling games, where the neighborhood of an agent can be considered as her coalition and the utility of an agent depends on the type distribution within her neighborhood. Even closer to Schelling games are fractional hedonic games and hedonic diversity games. Fractional hedonic games are additively separable hedonic games in which the total value of a coalition is divided by the cardinality of the coalition. Thus, if the value that agent i ascribes to another agent j is 1 if i and j are of the same type and 0 otherwise, then fractional hedonic games and Schelling games share the same utility function. However, they heavily differ on the feasibility of coalition structures: in fractional hedonic games, coalitions are unrestricted and pairwise disjoint, whereas in Schelling games they overlap and are superimposed by the topology of the underlying graph. Hedonic diversity games, instead, account for a mixture of both homophilic and heterophilic agents. More precisely, there are two types of agents and the utility of an agent for being in a coalition depends on both the distribution of same-type-agents in a coalition and its cardinality.

Investigating a local variant of Schelling’s model seems to be a novel approach, although proposed by Schelling [36] himself. To the best of our knowledge, local moves have only been addressed briefly by Vinković and Kirnan [37] in a model which can be understood as a continuous physical analogue of Schelling’s model.

1.3 Our contribution

We follow the model of Agarwal et al. [1], that is, we consider Swap Schelling Games and investigate, on the one hand, the existence of equilibria and the game dynamics and, on the other hand, the quality of the equilibria in terms of the PoA. The novel feature of our analysis is our focus on the influence of the underlying graph and that we also investigate the impact of restricting the agents to performing only local swaps. See Table 1 for a detailed result overview. Moreover, a more condensed overview of the achieved asymptotic bounds on PoA can be found in Table 2 in the Conclusion.

Table 1 Result overview

While in [1] it was proven that equilibria may fail to exist for arbitrary underlying graphs and in [20] equilibrium existence was shown for regular graphs, we extend and refine these results by investigating almost regular graphs as well as paths, 4-grids and 8-grids. We establish equilibrium existence for all these graph classes and all our results yield polynomial time algorithms for computing an equilibrium. Moreover, we study the PoA in-depth. Since it was shown in [1] that the PoA can be unbounded for \(k \ge 3\), we focus on the PoA of the (local) 2-SSG.

We give tight or almost tight bounds to the PoA for all mentioned graph classes which in many cases are significant improvements on the \(\varTheta (n)\) bound proven in [1]. In particular, for arbitrary graphs, we also improve the upper bound for balanced games. This result is obtained as a corollary of a more general upper bound of \({{\mathcal {O}}}\left( \frac{b}{o}\right)\) to the PoA (see Theorem 7), which implies that for instances that do admit swap equilibria, we always have a constant PoA whenever none of the two parties forms a clear majority. We also provide an upper bound of \({{{\mathcal {O}}}}\left( \frac{\varDelta }{\delta }\right)\) to the PoA for general graphs that do admit swap equilibria. This results is obtained by using advanced matching techniques, that are further explored to provide tight bounds to the LPoA for the class of regular and also non-regular graphs. Notably, this result implies non-trivial upper bounds to the PoA for graphs in which the degree of every vertex is in a restricted interval \([\delta ,\varDelta ]\), as well as for graphs with large minimum degree or bounded degree. We believe that our advanced matching techniques still have the potential to be successfully applied for future refinements to the PoA bounds.

Moreover, besides analyzing equilibria in the general model of Agarwal et al. [1], we introduce and analyze a local variant of the model, which was already suggested by Schelling [36] but to the best of our knowledge has not yet been explored for Schelling’s model. Our results indicate that the local variant has favorable properties. For instance, equilibria are guaranteed to exist on trees in the local version while in [1] it was shown that this is not the case for the general model. Moreover, for many cases we can show that the PoA in the local version deteriorates only slightly compared to the global version.

Finally, we also show how our existential results can be used to derive some non-trivial upper bounds for the Price of Stability in both the general and the local version of the model. The characterization of the Price of Stability in Swap Schelling Games is quite a challenging task and very few results are currently known (see the discussion in Sect. 4).

2 Equilibrium existence and dynamics

We start by providing a precise characterization which ties equilibria in both local and general 2-SSGs with the sum of the utilities experienced by any two agents of different colors.

Lemma 1

Let \({\varvec{\sigma }}\) be a strategy profile and consider any two agents i and j, with \(c(i)\ne c(j)\) and \({\text{deg}} _{{\varvec{\sigma }}(i)}\le {\text{deg}} _{{\varvec{\sigma }}(j)}\), that are allowed to swap their positions.Footnote 2 A strategy profile \({\varvec{\sigma }}\) for a (local) 2-SSG is an equilibrium if and only if \(\mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }})\ge 1-\frac{1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(i)}}\).

Proof

Without loss of generality, assume that i is orange and j is blue. Let \(o_i\) be the number of orange neighbors of \({\varvec{\sigma }}(i)\) and \(b_j\) be the number of blue neighbors of \({\varvec{\sigma }}(j)\), respectively.Footnote 3 It holds that

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }})=\frac{o_i}{{\text{deg}} _{{\varvec{\sigma }}(i)}},\ \mathsf{U}_j({\varvec{\sigma }})=\frac{b_j}{{\text{deg}} _{{\varvec{\sigma }}(j)}} \end{aligned}$$

and

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }}_{ij})=\frac{{\text{deg}} _{{\varvec{\sigma }}(j)}-b_j-1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(j)}}=1-\frac{1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(j)}}-\mathsf{U}_j({\varvec{\sigma }}),\\ \mathsf{U}_j({\varvec{\sigma }}_{ij})=\frac{{\text{deg}} _{{\varvec{\sigma }}(i)}-o_i-1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(i)}}=1-\frac{1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(i)}}-\mathsf{U}_i({\varvec{\sigma }}). \end{aligned}$$

Consider the case in which there exists a \(k \in \{i,j\}\) such that \(\mathsf{U}_k({\varvec{\sigma }})\ge \mathsf{U}_k({\varvec{\sigma }}_{ij})\). By substituting the formula corresponding to \(\mathsf{U}_k({\varvec{\sigma }}_{ij})\) and by rearranging the terms, using also the fact that \({\text{deg}} _{{\varvec{\sigma }}(k)} \ge {\text{deg}} _{{\varvec{\sigma }}(i)}\), we obtain

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }})\ge 1-\frac{1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(k)}} \ge 1-\frac{1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(i)}}. \end{aligned}$$

In the complementary case in which \(\mathsf{U}_k({\varvec{\sigma }}) < \mathsf{U}_k({\varvec{\sigma }}_{ij})\) for every \(k \in \{i,j\}\), from \(\mathsf{U}_i({\varvec{\sigma }}) < \mathsf{U}_i({\varvec{\sigma }}_{ij})\) we derive

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }}) < 1 - \frac{1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(i)}}. \end{aligned}$$

Therefore, \(\mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }})\ge 1-\frac{1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(i)}}\) iff \(\mathsf{U}_i({\varvec{\sigma }})\ge \mathsf{U}_i({\varvec{\sigma }}_{ij})\) or \(\mathsf{U}_j({\varvec{\sigma }})\ge \mathsf{U}_j({\varvec{\sigma }}_{ij})\) holds. As \({\varvec{\sigma }}\) is an equilibrium iff \(\mathsf{U}_i({\varvec{\sigma }})\ge \mathsf{U}_i({\varvec{\sigma }}_{ij})\) or \(\mathsf{U}_j({\varvec{\sigma }})\ge \mathsf{U}_j({\varvec{\sigma }}_{ij})\) holds, we have that \({\varvec{\sigma }}\) is an equilibrium iff \(\mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }})\ge 1-\frac{1_{ij}({\varvec{\sigma }})}{{\text{deg}} _{{\varvec{\sigma }}(i)}}\). \(\square\)

We recall to the function \(\varPhi ({\varvec{\sigma }}) = \left| \left\{ \{u,v\}\in E \mid c({\varvec{\sigma }}^{-1}(u)) = c({\varvec{\sigma }}^{-1}(v))\right\} \right|\) which counts the number of monochromatic edges. By exploiting the potential \(\varPhi\), Echzell et al. [20] show that, for any \(k\ge 2\), k-SSGs played on regular graphs have the FIP and that any sequence of profitable swaps has length of at most m. This result can be extended to \(\alpha\)-almost regular graphs for some values of \(\alpha\). First, we need the following technical lemma.

Lemma 2

Fix a k-SSG \((G,{{\mathbf {t}}})\), with \(k\ge 2\), a strategy profile \({\varvec{\sigma }}\) and a profitable swap in \({\varvec{\sigma }}\) performed by vertices i and j such that \({\text{deg}} _{\sigma (i)}\le {\text{deg}} _{\sigma (j)}\). If \({\text{deg}} _{\sigma (j)}-{\text{deg}} _{\sigma (i)}\le 1\), then the swap is \(\varPhi\)-increasing. If \({\text{deg}} _{\sigma (j)}-{\text{deg}} _{\sigma (i)}= 2\), then the swap is either \(\varPhi\)-increasing or \(\varPhi\)-preserving, with the swap being \(\varPhi\)-preserving only if \(\mathsf{U}_j({\varvec{\sigma }})\in \left( \frac{1}{2},1\right)\).

Proof

Assume, without loss of generality, that c(i) is orange and c(j) is blue; moreover, define \(\sigma (i)=u\) and \(\sigma (j)=v\). Let \(o_u\) be the number of orange agents occupying vertices adjacent to u in \({\varvec{\sigma }}\), let \(x_u\) be the number of neither orange not blue agents occupying vertices adjacent to u in \({\varvec{\sigma }}\), let \(b_v\) be the number of blue agents occupying vertices adjacent to v in \({\varvec{\sigma }}\) and let \(x_v\) be the number of neither orange nor blue agents occupying vertices adjacent to v in \({\varvec{\sigma }}\). We have

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }})=\frac{o_u}{{\text{deg}} _u},\ \ \mathsf{U}_j({\varvec{\sigma }})=\frac{b_v}{{\text{deg}} _v} \end{aligned}$$

and

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }}_{ij})=\frac{{\text{deg}} _v-b_v-x_v-1_{ij}({\varvec{\sigma }})}{{\text{deg}} _v},\ \ \mathsf{U}_j({\varvec{\sigma }}_{ij})=\frac{{\text{deg}} _u-o_u-x_u-1_{ij}({\varvec{\sigma }})}{{\text{deg}} _u}. \end{aligned}$$

As i and j perform a profitable swap in \({\varvec{\sigma }}\), we have \(\mathsf{U}_i({\varvec{\sigma }})<\mathsf{U}_i({\varvec{\sigma }}_{ij})\) and \(\mathsf{U}_j({\varvec{\sigma }})<\mathsf{U}_j({\varvec{\sigma }}_{ij})\) which implies

$$\begin{aligned} {\text{deg}} _u b_v+{\text{deg}} _v o_u+{\text{deg}} _ux_v+{\text{deg}} _u 1_{ij}({\varvec{\sigma }})<{\text{deg}} _u {\text{deg}} _v \end{aligned}$$
(1)

and

$$\begin{aligned} {\text{deg}} _u b_v+{\text{deg}} _v o_u+{\text{deg}} _vx_u+{\text{deg}} _v 1_{ij}({\varvec{\sigma }})<{\text{deg}} _u {\text{deg}} _v. \end{aligned}$$
(2)

Moreover, we have

$$\begin{aligned} \varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }})= & {} {\text{deg}} _u-1_{ij}({\varvec{\sigma }})-o_u-x_u+{\text{deg}} _v-1_{ij}({\varvec{\sigma }})-b_v-x_v-o_u-b_v\\= & {} {\text{deg}} _u+{\text{deg}} _v-x_u-x_v-2(o_u+b_v+1_{ij}({\varvec{\sigma }})). \end{aligned}$$
  • If \({\text{deg}} _u={\text{deg}} _v:=\delta '\), (1) implies \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_v<\delta ',\) while (2) implies \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_u<\delta '\) which together yield

    $$\begin{aligned} \varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }})=2\delta '-x_u-x_v-2(o_u+b_v+1_{ij}({\varvec{\sigma }}))>0. \end{aligned}$$
  • If \({\text{deg}} _u={\text{deg}} _v-1\), (1) implies \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_v<{\text{deg}} _v-1+\frac{b_v+x_v+1_{ij}({\varvec{\sigma }})}{{\text{deg}} _v},\) while (2) implies \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_u<{\text{deg}} _v-1+\frac{b_v}{{\text{deg}} _v}.\) As \(b_v+x_v+1_{ij}({\varvec{\sigma }})\le {\text{deg}} _v\) by definition, we get \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_v\le {\text{deg}} _v-1\) and \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_u\le {\text{deg}} _v-1\) which together yield

    $$\begin{aligned} \varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }})=2{\text{deg}} _v-1-x_u-x_v-2(o_u+b_v+1_{ij}({\varvec{\sigma }}))>0. \end{aligned}$$
  • If \({\text{deg}} _u={\text{deg}} _v-2\), (1) implies \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_v<{\text{deg}} _v-2+\frac{2(b_v+x_v+1_{ij}({\varvec{\sigma }}))}{{\text{deg}} _v},\) while (2) implies \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_u<{\text{deg}} _v-2+\frac{2 b_v}{{\text{deg}} _v}.\) As \(b_v+x_v+1_{ij}({\varvec{\sigma }})\le {\text{deg}} _v\) by definition, we get \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_v\le {\text{deg}} _v-1\) and \(o_u+b_v+1_{ij}({\varvec{\sigma }})+x_u\le {\text{deg}} _v-1\) which together yield

    $$\begin{aligned} \varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }})=2{\text{deg}} _v-2-x_u-x_v-2(o_u+b_v+1_{ij}({\varvec{\sigma }}))\ge 0. \end{aligned}$$

    However, note that equality occurs only in the case in which \(\frac{2 b_v}{{\text{deg}} _v}>1\) which requires \(b_v>\frac{{\text{deg}} _v}{2}\), that is, \(\mathsf{U}_j({\varvec{\sigma }})>\frac{1}{2}\). Clearly, as j improves after the swap, it must also be \(\mathsf{U}_j({\varvec{\sigma }})<1\). \(\square\)

Given the above lemma, existence and efficient computation of equilibria for k-SSGs played on almost regular graphs can be easily obtained for any \(k\ge 2\).

Theorem 1

For any \(k\ge 2\), k-SSGs played on almost regular graphs has the FIP. Moreover, at most m profitable swaps are sufficient to reach an equilibrium starting from any initial strategy profile.

Proof

The first part of the claim comes from Lemma 2, as in any almost regular graph G it holds that \(\varDelta -\delta =1\). The bound on the number of swaps comes from the fact that for every strategy profile \({\varvec{\sigma }}\), we have \(\varPhi ({\varvec{\sigma }}) \le m\), and, moreover, \(\varPhi ({\varvec{\sigma }})\) is integer and non-negative. \(\square\)

Theorem 1 cannot be extended beyond almost regular graphs as Agarwal et al. [1] provide a 2-SSG played on a 2-almost regular graph (more precisely, a tree) admitting no equilibria. However, in the next theorem, we show that positive results can be still achieved in games played on 2-almost regular graphs obeying some additional properties which are in particular fulfilled by 4-grids.

Theorem 2

Let G be a 2-almost regular graph such that \(\varDelta \le 4\) and every vertex of degree \(\delta\) is adjacent to at most \(\delta -1\) vertices of degree \(\varDelta\). Then, for any \(k\ge 2\), every k-SSG played on G possesses the FIP. Moreover, at most O(nm) profitable swaps are sufficient to reach an equilibrium starting from any initial strategy profile.

Proof

By Lemma 2, we know that any profitable swap occurring in a strategy profile \({\varvec{\sigma }}\) is \(\varPhi\)-increasing unless it involves an agent i occupying vertex \(\sigma (i)=u\), with \({\text{deg}} _u=\delta\), and an agent j occupying vertex \(\sigma (j)=v\), with \({\text{deg}} _v=\varDelta\), and such that \(\mathsf{U}_j({\varvec{\sigma }})\in (\frac{1}{2},1)\). As G is connected, we have \(\delta \ge 1\), which yields \(\varDelta \in \{3,4\}\). This fact, together with \(\mathsf{U}_j({\varvec{\sigma }})\in (\frac{1}{2},1)\) implies \(\mathsf{U}_j({\varvec{\sigma }})\in \{\frac{2}{3},\frac{3}{4}\}\). As \(\mathsf{U}_j({\varvec{\sigma }}_{ij})>\mathsf{U}_j({\varvec{\sigma }})\), we get \(\mathsf{U}_j({\varvec{\sigma }}_{ij})=1\) which implies that all vertices adjacent to u are occupied by agents of the same color of agent j, which implies \(\mathsf{U}_i({\varvec{\sigma }})=0\). So we can conclude that, in order to have a \(\varPhi\)-preserving profitable swap, we need a profitable swap involving a vertex u of degree \(\delta\) such that \(\mathsf{U}_{\sigma ^{-1}(u)}({\varvec{\sigma }})=0\) and \(\mathsf{U}_{\sigma _{ij}^{-1}(u)}({\varvec{\sigma }})=1\). Thus, in order for an agent occupying u to perform once again a \(\varPhi\)-preserving profitable swap, all vertices in \(N_u\) need to change their colors, i.e., all agents occupying vertices adjacent to u must perform a profitable swap. By Lemma 2, any agent occupying a vertex \(v\in N_u\) can be involved in a \(\varPhi\)-preserving swap only if \({\text{deg}} _v=\varDelta\). By assumption u has at least a neighbor of degree different than \(\varDelta\). Thus, between any two consecutive \(\varPhi\)-preserving profitable swaps involving an agent residing at a fixed vertex, a \(\varPhi\)-increasing profitable swap has to occur. This immediately implies that no more than n consecutive \(\varPhi\)-preserving profitable swaps are possible. \(\square\)

As 4-grids meet the conditions required by Theorem 2, we get the following corollary.

Corollary 1

For any \(k\ge 2\), every k-SSG played on a 4-grid possesses the FIP. Moreover, at most O(nm) profitable swaps are sufficient to reach an equilibrium starting from any initial strategy profile.

As mentioned before, Agarwal et al. [1] pointed out that 2-SSGs played on trees are not guaranteed to admit equilibria. We show that this is no longer the case in local k-SSGs for any value of \(k\ge 2\). The main reason for this is that the given counter-example in [1] crucially relies on agents that perfom non-local swaps whereas in local k-SSGs such swaps cannot occur.

Theorem 3

For any \(k \ge 2\), every local k-SSG played on a tree has an equilibrium which can be computed in polynomial time.

Proof

Root the tree T at a vertex r. We will place the agents color by color, starting with color 1 and ending with color k. Before we place an agent at an inner vertex v all of v’s descendants in T have to be occupied. Hence, we place the agents starting from the leaves, and the root \(r^\prime\) of every subtree \(T^\prime\) is the last vertex in \(T^\prime\) which will be occupied. Thus, we ensure that, if the root \(r^\prime\) of a subtree \(T^\prime\) is occupied by an agent of color \(i \in [k]\), \(T^\prime\) contains only agents of color \(i^\prime \le i\). Clearly, this construction yields a feasible strategy profile, that we denote by \({\varvec{\sigma }}\), and can be implemented in polynomial time. See Fig. 2 for an illustration.

Consider two agents i and j of different colors that occupy two adjacent vertices u and v, respectively. Without loss of generality, we assume that u is the parent of v in T. Since \(c(j) < c(i)\), the subtree of T rooted at v contains no vertex of color c(i). As a consequence \(\mathsf{U}_i({\varvec{\sigma }}_{ij})=0\). Hence \(\sigma\) is a LSE. \(\square\)

Note that, as we move from 4-grids to 8-grids, Corollary 1 does not hold anymore. In fact, for the latter class of graphs, we show that for \(k = 2\) the FIP is guaranteed to hold only for local games. For this, we first need the following technical lemma which specifies all \(\varPhi\)-increasing swaps which can occur in 8-grids.

Fig. 2
figure 2

Example of the construction yielding an equilibrium on a tree. Let \(k = 3\) and assume green \(\le\) orange \(\le\) blue. We root the tree at a vertex r, place the agents bottom-up and ensure for every subtree \(T'\) the corresponding root \(r'\) is the last vertex in \(T'\) to be occupied (Color figure online)

Lemma 3

Fix a local 2-SSG played on an 8-grid, a strategy profile \({\varvec{\sigma }}\) and a profitable swap in \({\varvec{\sigma }}\) performed by agents i and j. It holds that

  1. (i)

    If \({\text{deg}} _{\sigma (i)} = 3\) and \({\text{deg}} _{\sigma (j)} = 8\), then the swap is \(\varPhi\)-decreasing by 1 if \(\mathsf{U}_i({\varvec{\sigma }}) = 0\) and \(\mathsf{U}_j({\varvec{\sigma }}) = \frac{5}{8}\) otherwise it is a \(\varPhi\)-increasing swap.

  2. (ii)

    If \({\text{deg}} _{\sigma (i)} = 5\) and \({\text{deg}} _{\sigma (j)} = 8\), then the swap is \(\varPhi\)-decreasing by 1 if \(\mathsf{U}_i({\varvec{\sigma }}) = 0\) and \(\mathsf{U}_j({\varvec{\sigma }}) = \frac{6}{8}\) otherwise it is a \(\varPhi\)-increasing swap.

Proof

Assume, without loss of generality, that c(i) is orange and c(j) is blue; moreover, define \(\sigma (i)=u\) and \(\sigma (j)=v\). Let \(o_u\) be the number of orange agents occupying vertices adjacent to u in \({\varvec{\sigma }}\) and \(b_v\) be the number of blue agents occupying vertices adjacent to v in \({\varvec{\sigma }}\).

(i):

We have

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }})=\frac{o_u}{3},\ \ \mathsf{U}_j({\varvec{\sigma }})=\frac{b_v}{8} \end{aligned}$$

and

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }}_{ij})=\frac{7-b_v}{8},\ \ \mathsf{U}_j({\varvec{\sigma }}_{ij})=\frac{2-o_u}{3}. \end{aligned}$$

As i and j perform a profitable swap in \({\varvec{\sigma }}\), we have \(\mathsf{U}_i({\varvec{\sigma }})<\mathsf{U}_i({\varvec{\sigma }}_{ij})\) and \(\mathsf{U}_j({\varvec{\sigma }})<\mathsf{U}_j({\varvec{\sigma }}_{ij})\) which imply

$$\begin{aligned} b_v<\frac{16}{3}-\frac{8}{3}o_u. \end{aligned}$$
(3)

Moreover, we have

$$\begin{aligned} \varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }})= & {} 3-1-o_u+8-1-b_v-o_u-b_v = 9 -2o_u - 2b_v. \end{aligned}$$

From Eq. (3) it follows that for \(o_u = 2\), \(b_v < 0\). Therefore, \(o_u\) is in the set \(\{0,1\}\), and we have the following cases:

If \(o_u = 0\), (3) implies \(b_v<\frac{16}{3}\) which yields \(\varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }}) > \frac{-5}{3}\).

If \(o_u = 1\), (3) implies \(b_v<\frac{8}{3}\) which yields \(\varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }}) > \frac{5}{3}\).

Since \(\varPhi ({\varvec{\sigma }})\) is integral, the statement follows.

(ii):

We have

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }})=\frac{o_u}{5},\ \ \mathsf{U}_j({\varvec{\sigma }})=\frac{b_v}{8} \end{aligned}$$

and

$$\begin{aligned} \mathsf{U}_i({\varvec{\sigma }}_{ij})=\frac{7-b_v}{8},\ \ \mathsf{U}_j({\varvec{\sigma }}_{ij})=\frac{4-o_u}{5}. \end{aligned}$$

As i and j perform a profitable swap in \({\varvec{\sigma }}\), we have \(\mathsf{U}_i({\varvec{\sigma }})<\mathsf{U}_i({\varvec{\sigma }}_{ij})\) and \(\mathsf{U}_j({\varvec{\sigma }})<\mathsf{U}_j({\varvec{\sigma }}_{ij})\) which imply

$$\begin{aligned} b_v<\frac{32}{5}-\frac{8}{5}o_u. \end{aligned}$$
(4)

Moreover, we have

$$\begin{aligned} \varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }})= & {} 5-1-o_u+8-1-b_v-o_u-b_v = 11 -2o_u - 2b_v. \end{aligned}$$

From Eq. (4) it follows that for \(o_u = 4\), \(b_v < 0\). Hence, \(o_u\) is in the set \(\{0,1,2,3\}\), and we have the following cases:

If \(o_u = 0\), (4) implies \(b_v<\frac{32}{5}\) which yields \(\varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }}) > \frac{-9}{5}\).

If \(o_u = 1\), (4) implies \(b_v<\frac{24}{5}\) which yields \(\varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }}) > \frac{-3}{5}\).

If \(o_u = 2\), (4) implies \(b_v<\frac{16}{5}\) which yields \(\varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }}) > \frac{3}{5}\).

If \(o_u = 3\), (4) implies \(b_v<\frac{8}{5}\) which yields \(\varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }}) > \frac{9}{5}\).

Since \(\varPhi ({\varvec{\sigma }})\) is integral, we just have to show that, if \(o_u = 1\), the swap is in fact not \(\varPhi\)-preserving, but \(\varPhi\)-increasing. Notice that \(b_v\) is an integer as well. Hence, since (4) implies \(b_v<\frac{24}{5}\), it holds that \(b_v \le 4\) which yields \(\varPhi ({\varvec{\sigma }}_{ij})-\varPhi ({\varvec{\sigma }}) \ge 1\). \(\square\)

We will now show that the FIP is guaranteed to hold for local games played on 8-grids. For this we recall the definition of the function \(\varPsi ({\varvec{\sigma }}) = (\varPhi ({\varvec{\sigma }}),n-z({\varvec{\sigma }})),\) where \(z({\varvec{\sigma }})\) is the number of agents having utility 0 under \({\varvec{\sigma }}\). As shown in Lemma 2 and Lemma 3, there are only a few local swaps which can preserve or decrease the potential \(\varPhi\) and all of them decrease it by at most 1. We will show that, after a \(\varPhi\)-preserving or a \(\varPhi\)-decreasing swap, a number of swaps must happen before at the same pair of vertices another \(\varPhi\)-preserving or \(\varPhi\)-decreasing swap can occur. We will show that in total the extended potential \(\varPsi\) increases lexicographically which implies the FIP.

In the following proof we assume towards a contradiction that an IRC exists and show first, that the IRC must contain at least one \(\varPhi\)-decreasing swap. We then assign necessary profitable swaps which have to be executed after a \(\varPhi\)-decreasing swap and before a comparable \(\varPhi\)-decreasing swap can again be performed. To this end, we distinguish between the cases whether another possible \(\varPhi\)-preserving or \(\varPhi\)-decreasing swap can be performed within the neighborhood and if so, how the neighbors are involved in these swaps.

Theorem 4

Any local 2-SSG played on an 8-grid possesses the FIP.

Proof

The proof is structured as follows: We will first show that there are only a few swaps which can preserve or decrease the potential \(\varPhi\). Then we assume towards a contradiction that an IRC exists. By definition, such an IRC cannot contain only \(\varPhi\)-increasing swaps. Thus, it must contain \(\varPhi\)-preserving or \(\varPhi\)-decreasing swaps. Next, we show that at least one \(\varPhi\)-decreasing swap must occur. Concentrating on such \(\varPhi\)-decreasing swaps, note that we need at least one, without loss of generality, orange agent i with utility 0 occupying some vertex u. We will show that reversing the colors of the agents (via swaps) in the neighborhood of u to enable another \(\varPhi\)-decreasing swap involving an agent occupying u entails a number of \(\varPhi\)-increasing swaps, that contradict the assumed existence of the IRC.

We start by showing that only a few swaps can be non-increasing regarding the potential \(\varPhi\). By Lemma 2, we know that any profitable swap occurring in a strategy profile \({\varvec{\sigma }}\) is \(\varPhi\)-increasing, and, hence also \(\varPsi\)-increasing, unless it involves two agents i and j occupying vertices \(\sigma (i)=u\) and \(\sigma (j)=v\) with \({\text{deg}} _u\ne {\text{deg}} _v\), i.e., with different degrees. We assume, without loss of generality, \({\text{deg}} _u <{\text{deg}} _v\) and that c(i) is orange and c(j) is blue.

First, we note that in a \(\varPhi\)-preserving or a \(\varPhi\)-decreasing swap, for the orange agent i, it must be that \(\mathsf{U}_i({\varvec{\sigma }})=0\). By Lemma 3, we know that this is true if \({\text{deg}} _u = 3\) and \({\text{deg}} _v = 8\) or \({\text{deg}} _u = 5\) and \({\text{deg}} _v = 8\). If \({\text{deg}} _u = 3\) and \({\text{deg}} _v = 5\), we know by Lemma 2 that we may have a \(\varPhi\)-preserving swap if for the utility of the blue agent it holds that \(\mathsf{U}_j({\varvec{\sigma }}) \in \left( \frac{1}{2},1\right)\). As \({\text{deg}} _v = 5\) and \(\mathsf{U}_j({\varvec{\sigma }}_{ij})> \mathsf{U}_j({\varvec{\sigma }}) > \frac{1}{2}\), it must be that \(\mathsf{U}_j({\varvec{\sigma }}) = \frac{3}{5}\) and \(\mathsf{U}_j({\varvec{\sigma }}_{ij})=\frac{2}{3}\), which implies that, in \({\varvec{\sigma }}\), all vertices adjacent to u are occupied by blue agents, so \(\mathsf{U}_i({\varvec{\sigma }})=0\), cf. Fig. 3.

We will show that after every \(\varPsi\)-decreasing swap, we can assign corresponding \(\varPsi\)-increasing swaps such that in total the extended potential \(\varPsi\) increases lexicographically which implies the FIP. Remember that the extended potential \(\varPsi\) is simply a more fine-grained version of the potential \(\varPhi\) with the number of agents having utility 0 as tie-breaker. Thus, for simplicity, in some parts of the proof we will work with \(\varPhi\) instead of \(\varPsi\). Since the extended potential \(\varPsi\) is a vector, we denote the change in \(\varPsi\) by a profitable swap as \((\lambda ,\mu )\) with \(\lambda ,\mu \in \mathbb {Z}\) where \(\lambda\) denotes the change in \(\varPhi\) and \(\mu\) denotes the change in \(n-z(\cdot )\). Moreover, remember that we consider local games. Hence, two agents i and j are only allowed to swap if \(1_{ij}(\sigma ) = 1\), i.e., if they are adjacent.

We now assume for the sake of contradiction that an IRC exists. Note that such an IRC contains at least one swap which preserves or decreases the potential \(\varPhi\). Hence, assume that there exists an IRC \({\mathcal {C}} = {\varvec{\sigma }}^0, {\varvec{\sigma }}^1, \ldots , {\varvec{\sigma }}^\ell\). For the sake of brevity, we denote \({\varvec{\sigma }}^0\) as \({\varvec{\sigma }}\) in this proof. It holds that \(\varPsi ({\varvec{\sigma }}^0) = \varPsi ({\varvec{\sigma }}^\ell )\) and \({\mathcal {C}}\) must contain at least one \(\varPhi\)-decreasing swap since any \(\varPhi\)-preserving swap increases \(\varPsi\). This follows from Lemma 2 and our above observation that one of the agents involved in a \(\varPhi\)-preserving swap must have utility 0 before the swap and, since the swap is profitable, must have utility greater than 0 after the swap. Hence, the extended potential \(\varPsi\) increases. As illustration, consider Fig. 3. If agents i and j perform a \(\varPhi\)-preserving swap the number of agents having utility 0 decreases by 1 since no new agent with utility 0 is created.

Fig. 3
figure 3

The coloring of G in \({\varvec{\sigma }}\) and \({\varvec{\sigma }}_{ij}\) before and after a \(\varPhi\)-preserving swap of the orange agent i and the blue agent j occupying vertices u and v, respectively. The right neighbors of v are occupied by agents of different types, (hence, the top vertex can also be occupied by a blue agent if the lower one is occupied by an orange one). Symmetric and equivalent cases are omitted. a the strategy profile \({\varvec{\sigma }}\) before i and j perform a \(\varPhi\)-preserving swap, b the strategy profile \({\varvec{\sigma }}_{ij}\) after i and j perform a \(\varPhi\)-preserving swap (Color figure online)

Therefore, we concentrate on \(\varPhi\)-decreasing swaps. To this end, we need at least one agent with utility 0 in one of the strategy profiles \({\varvec{\sigma }}^k\) with \(0 \le k \le \ell -1\) which is contained in the IRC \({\mathcal {C}}\). Assume, without loss of generality, that \({\varvec{\sigma }}^0\) contains at least one agent i with utility 0. Note that since \({\mathcal {C}}\) is a cycle, we can freely define the starting strategy profile \({\varvec{\sigma }}^0\). Hence, in \({\varvec{\sigma }}^\ell\) the vertex u has to be occupied by an agent with utility 0 as well.

Recall that, by Lemma 3, \(\varPhi\) decreases by at most 1 in any \(\varPhi\)-decreasing swap. Also, we know that we have a \(\varPhi\)-decreasing swap by 1 if and only if we have that for the utility of the orange agent i it holds that \(\mathsf{U}_i({\varvec{\sigma }}) = 0\) and vertex u has to be a border vertex, i.e., u has degree 3 or 5. This implies that all vertices adjacent to u are occupied by blue agents. Thus, in order for agent j (occupying vertex u in \({\varvec{\sigma }}_{ij}\), i.e., after the swap) to be involved once again in a \(\varPhi\)-decreasing profitable swap, all vertices in \(N_u\setminus \{v\}\) must become occupied by orange agents. Hence, we need to reverse the color of the agents in the neighborhood of u. Note, that in the case that an orange agent on vertex u is involved once again in a \(\varPhi\)-decreasing swap without agent j being involved in a \(\varPhi\)-decreasing swap in-between implies an increase in the potential \(\varPsi\). In particular, the swap between the agents i and j yields a change in \(\varPsi\) of at least \((-1,x)\), with \(x > 1\), since agent i has utility larger 0 now. Agent j swapping away from vertex u with an agent occupying an adjacent vertex, denoted by w, is \(\varPhi\)-increasing by assumption if \({\text{deg}} _w \ge 5\), and yields a change in \(\varPsi\) of at least \((1,-(x-1))\) since it was a profitable swap for both involved agents. Therefore, after the swap the agent occupying vertex u cannot have utility 0. Or, the swap of the blue agent j is \(\varPhi\)-preserving which implicates \({\text{deg}} _w = 3\) and a \(\varPhi\)-increasing swap in-between, since w was occupied by a blue agent in \({\varvec{\sigma }}\). Hence, in both cases the swaps such that agent j swaps away from vertex u are together \(\varPsi\)-increasing by at least (0, 1). This contradicts the assumption of an IRC. Note that in the case that agent j performs a \(\varPhi\)-increasing swap with the agent placed on vertex w, w is again occupied by a blue agent, similar to the initial strategy profile \({\varvec{\sigma }}\). Hence, it will not interfere with the swaps performed on vertex w to negate other decreasing swaps later. Hence, the blue agent j occupying vertex u needs to be involved in a \(\varPhi\)-decreasing profitable swap and needs therefore utility 0. Vertex u has, besides v, at least two further adjacent vertices, say \(w_1\) and \(w_2\). We show in the following that occupying the vertices \(w_1\) and \(w_2\) with orange agents will in total increase the potential \(\varPsi\).

Let \(\text {dist}(x,y)\) be the number of edges on a shortest path between two vertices x and y and let \(N_x^2 = \{y \in V: \text {dist}(x,y) \le 2\}\) be the 2-neighborhood of x, i.e., all vertices which are in hop distance at most 2 from x.

We distinguish between two cases: (1) We assume that in \(N_u^2\) it holds that there is no agent with utility 0 before the agents occupying \(w_1\) and \(w_2\) swap, and (2), in \(N_u^2\) it holds that there is at least one agent with utility 0 before the agents occupying \(w_1\) and \(w_2\) swap.

In these cases we consider the direct neighbors of u and show that reversing the colors of the agents occupying these vertices entails several \(\varPhi\)-increasing swaps which we can assign clearly to the \(\varPhi\)-decreasing swap of agent i. This implies that \(\varPsi\) increases and, hence, contradicts the assumption of the existing IRC.

We start with the case (1), i.e., that in \(N_u^2\) no other agent with utility 0 is around before the agents occupying \(w_1\) and \(w_2\) swap.

Since all neighbors of \(w_1\) and \(w_2\) belong to \(N_u^2\) and have by assumption utility larger 0 and since the agents on \(w_1\) and \(w_2\) have positive utility as well and are, due to locality, restricted to swaps with adjacent agents, two \(\varPhi\)-increasing swaps will occur before the agent occupying u can perform once again a \(\varPhi\)-decreasing swap. Thus, in total \(\varPhi\) increases, if we can clearly assign the two \(\varPhi\)-increasing swaps to the \(\varPhi\)-decreasing swap of agent i occupying u under \({\varvec{\sigma }}\). Note, that this is given if the 2-neighborhoods of vertices which are occupied by agents with utility 0 do not overlap.

Consider Fig. 4a where the 2-neighborhoods of two such vertices overlap. The agents occupying u and \(u'\) can both perform a \(\varPhi\)-decreasing swap, while \(w_1\) and \(w_1'\) and \(w_2\) and \(w_2'\), respectively, can perform two \(\varPhi\)-increasing swaps, which, in total, is \(\varPhi\)-preserving. However vertex u has, besides vertex v, four neighbors which have to be involved in swaps. To this end, vertex u needs to have clockwise and counter-clockwise along the border overlapping 2-neighborhoods with vertices which are occupied by agents with utility 0. Otherwise, we have a clear assignment of two \(\varPhi\)-increasing swaps to the \(\varPhi\)-decreasing swap of agent i occupying vertex u. In particular, assume, without loss of generality, that vertex u has clockwise along the border no overlapping 2-neighborhoods with vertices which are occupied by agents with utility 0. Then we can assign the two \(\varPhi\)-increasing swaps involving the first two clockwise neighbors of vertex u which are not vertex v, cf., for instance, vertices \(w_1\) and \(w_2\) in Fig. 4b, to the \(\varPhi\)-decreasing swap of the agents i and j. Hence, towards a contradiction to the assumption that an IRC exists, we have to show that there is at least one agent with utility 0 whose neighbors increase \(\varPhi\) (and not only preserve it), and therefore \(\varPhi\) increases in total.

To this end, we consider, starting clockwise from the top left corner, the first agent with utility 0, say agent i. If agent i is not located at the corner vertex, i.e., a vertex with degree 3, cf. Fig. 4b, we already found our agent whose neighbors increase \(\varPhi\) in total since at least one neighbor, vertex \(w_1\) in Fig. 4b, is not involved in a swap with a direct neighbor of another agent with utility 0.

Hence, we assume that agent i is located at the corner vertex, and there is another agent located on a vertex \(u'\) with utility 0 with an overlapping 2-neighborhood, cf. Fig. 4c. Note, that since we assume agent i to be involved in a \(\varPhi\)-decreasing swap, vertex v has to be the adjacent vertex with degree 8. Hence, vertex \(w_1\) is not in the 2-neighborhood of the agent occupying vertex \(u'\) and therefore, since with the agent occupying vertex \(w_2\) only one direct neighbor of vertex u who is not placed on vertex v can be involved in a swap with an agent occupying vertex \(w_1'\) or vertex \(w_2'\), either the agent occupying vertex \(w_1'\) or vertex \(w_2'\) is not involved in a swap with a direct neighbor of another agent with utility 0 involved in a \(\varPhi\)-decreasing swap. As a result, the potential \(\varPhi\) increases in total since we have two \(\varPhi\)-decreasing swaps involving the vertices u and \(u'\), two \(\varPhi\)-increasing swaps involving the vertices \(w_1\) and \(w_2\) with either \(w_1'\) or \(w_2'\), and an additional \(\varPhi\)-increasing swap involving either \(w_1'\) or \(w_2'\).

Fig. 4
figure 4

The coloring of G where the orange agent i and the blue agent j occupying vertices u and v, respectively. We omitted symmetric and equivalent cases. a The strategy profile where the neighbors, \(w_1\) and \(w_1'\) and \(w_2\) and \(w_2'\), respectively, can perform two \(\varPhi\)-increasing swaps within the neighborhood, b starting clockwise from the top left corner, agent i is the first agent with utility 0, c the 2-neighborhoods of u and \(u'\) overlap (Color figure online)

We now turn our focus to case (2), i.e., that in \(N_u^2\) there is at least one agent with utility 0 before the agents occupying \(w_1\) and \(w_2\) swap.

We first note that we can assume that \({\text{deg}} _u = 5\). To this end, consider Fig. 5 and assume that there is no agent with utility 0 occupying a vertex with degree 5 in the IRC \({\mathcal {C}}\). Furthermore, we consider a \(3 \times h\) grid, with \(h > 3\), and that in \({\varvec{\sigma }}\) the agent occupying \(w_1'\), with \({\text{deg}} _{w_1'} = 3\), has utility 0.

Fig. 5
figure 5

The coloring of G in \({\varvec{\sigma }}\) and \({\varvec{\sigma }}_{ij}\) before and after a \(\varPhi\)-decreasing swap of the orange agent i and the blue agent j occupying vertices u and v, respectively. We omitted symmetric and equivalent cases. a the strategy profile \({\varvec{\sigma }}\) before i and j perform a \(\varPhi\)-decreasing swap, b the strategy profile \({\varvec{\sigma }}_{ij}\) after a \(\varPhi\)-decreasing swap of agents i and j occupying vertices u and v when the agent occupying \(w_1'\) has utility 0 under \({\varvec{\sigma }}\). c the strategy profile \({\varvec{\sigma }}_{ij}\) after a \(\varPhi\)-decreasing swap of agents i and j occupying vertices u and v when the agent occupying \(w_1'\) has utility larger 0 under \({\varvec{\sigma }}\) (Color figure online)

(Note, if we consider \(\ell \times h\) grids, with \(\ell \ne 3\), without an agent with utility 0 occupying a vertex with degree 5, we are in case (1) since due to our assumptions all agents in \(N_u^2\) have positive utility). In this case the swap between agents i and j, cf. Fig. 2, yields a change in the extended potential \(\varPsi\) of \((-1,+2)\). To enable another \(\varPhi\)-preserving or decreasing swap involving an agent occupying vertex u, agent i on vertex v needs to perform another profitable swap, yielding a change in \(\varPsi\) of \((x,-1)\), with \(x \ge 1\), since by assumption \({\mathcal {C}}\) does not contain an agent with utility 0 occupying a vertex with degree 5. Therefore, since vertex v is, by assumption of the grid size, not adjacent to further vertices of degree 3 besides u and \(w_1'\), cf. Fig. 2, the swap of agent i must be \(\varPhi\)-increasing. Hence, in total the extended potential \(\varPsi\) increases by at least (0, 1). If the agent occupying vertex \(w_1'\) has utility larger than 0 in \({\varvec{\sigma }}\), the swap between agents i and j yields a change in \(\varPsi\) of \((-1,+1)\). However, to create an agent with utility 0 occupying \(w_1'\), at least two \(\varPhi\)-increasing swaps are necessary, cf. Fig. 2. (Note that if vertex \(w_1'\) is occupied by a blue agent we are in case (1) since due to our assumptions all agents in \(N_u^2\) have positive utility). Consider Fig. 6 to check that also a \(3\times 3\) grid cannot contain an IRC.

Fig. 6
figure 6

The coloring of G in \({\varvec{\sigma }}_{ij}\) after the a \(\varPhi\)-decreasing swap of the orange agent i and the blue agent j occupying vertices u and v, respectively, shown in Figure 2 in a \(3\times 3\) grid. We omitted symmetric cases. ad show the possible strategy profiles of \({\varvec{\sigma }}_{ij}\). The red arrows show all possible profitable swaps of an orange agent while the black arrows point towards the next possible strategy profile. Strategy profiles without red arrows are swap equilibria (Color figure online)

Hence, it holds that \(\mathsf{U}_i({\varvec{\sigma }}) = 0\), \({\text{deg}} _u = 5\), and there exists at least one other vertex \(w_1' \in N^2_u\) which is occupied by an agent k with \(\mathsf{U}_k({\varvec{\sigma }}^{q}) = 0\), with \(q \in [\ell ]\), where \({\varvec{\sigma }}^{q}\) is a placement before the agents occupying \(w_1\) and \(w_2\) under \({\varvec{\sigma }}\) performed profitable swaps. Moreover, we assume that \({\text{deg}} _{w_1'} = 3\) or \({\text{deg}} _{w_1'} = 5\). Otherwise, by Lemma 3, the agent occupying vertex \(w_1'\) can only be involved in a \(\varPhi\)-increasing swap and therefore the agents occupying the direct neighbors of vertices u, \(w_1\), and \(w_2\), can only be involved in a \(\varPhi\)-increasing swap as well which yields that in total the potential \(\varPhi\) increases. Note, that we can define a disjoint assignment of the neighbors \(w_1\) and \(w_2\) to their respective vertex u. Since the vertex u has besides v four further neighbors, two with degree lower than 8, we can, without loss of generality, starting from the top left corner of the grid, clockwise, assign to every border vertex, i.e., a vertex with degree 5, occupied by an agent with utility 0, the first two clockwise vertices which are not vertex v, as distinct \(w_1\) and \(w_2\), respectively, cf. Fig. 7a.

Fig. 7
figure 7

The coloring of G in \({\varvec{\sigma }}\) and \({\varvec{\sigma }}_{ij}\) before and after a \(\varPhi\)-decreasing swap of the orange agent i and the blue agent j occupying vertices u and v, respectively. We omitted symmetric and equivalent cases. a the coloring of G in \({\varvec{\sigma }}_{ij}\) after a \(\varPhi\)-decreasing swap by \((-1,+1)\) of agents i and j occupying vertices u and v. b the coloring of G before a \(\varPhi\)-preserving swap by \((0,+1)\) of agents occupying vertices \(w_1\) and \(w_1'\). c the coloring of G after a \(\varPsi\)-preserving swap by agents occupying vertices \(w_1\) and \(w_1'\) (Color figure online)

For our case analysis we consider, without loss of generality, the left neighbors of vertex u, cf. Fig. 7a, with \({\text{deg}} _{w_1} = 5\) and \({\text{deg}} _{w_2} = 8\). So in the following we distinguish between the three following cases: (a) vertex \(w_1\) is involved in a \(\varPhi\)-preserving swap, (b) vertex \(w_2\) is involved in a \(\varPhi\)-decreasing swap, and (c) vertex \(w_1\) is involved in a \(\varPhi\)-preserving swap and vertex \(w_2\) is involved in a \(\varPhi\)-decreasing swap. Note that since \({\text{deg}} _{w_1} = 5\) the agent occupying vertex \(w_1\) cannot be involved in a \(\varPhi\)-decreasing swap, since the agents placed on vertices \(w_1\) and \(w_2\) have positive utility.

  1. (a)

    We assume that vertex \(w_1\) is involved in a \(\varPhi\)-preserving swap. Note that in this case, it holds that \({\text{deg}} _{w_1'} = 3\), cf. Fig. 7b. A profitable swap between the agents occupying vertices \(w_1\) and \(w_1'\) yields a change in \(\varPsi\) of \((0,+1)\), since both agents have non-zero utility after the swap, cf. Fig. 7c. However, by assumption, the agent on vertex \(w_2\) must perform a profitable \(\varPhi\)-increasing swap which changes the extended potential \(\varPsi\) by at least \((+1,-1)\). In total, the extended potential \(\varPsi\) must change by at least \((0,+1)\), since the swap of the agents i and j yields a change in \(\varPsi\) of \((0,+1)\) which together with the changes of \((0,+1)\) and \((+1,-1)\) imply a lexicographic increase.

  2. (b)

    We assume that vertex \(w_2\) is involved in a \(\varPhi\)-decreasing swap. A profitable swap between the agents occupying vertices \(w_2\) and \(w_1'\) yields a change in \(\varPsi\) of \((-1,+1)\), since both agents have non-zero utility after the swap. Recall that we want to reverse the colors of the agents occupying the neighbors of vertex u to enable another \(\varPhi\)-decreasing swap with the agent on vertex u. Now, there are two ways of how vertex \(w_1\) can become occupied by an orange agent, cf. Fig. 8a.

Fig. 8
figure 8

The coloring of G in \({\varvec{\sigma }}_{ij}\) after a \(\varPhi\)-decreasing swap of the orange agent i and the blue agent j occupying vertices u and v, respectively. We omitted symmetric and equivalent cases. a and b show the coloring of G after a \(\varPhi\)-decreasing swap by \((-1,+1)\) by the agent occupying \(w_2\). c shows the coloring of G before the agent occupying \(w_2'\) can perform another \(\varPhi\)-decreasing swap by \((-1,+1)\). d shows the coloring of G before the agent occupying \(w_1\) can swap with her left orange neighbor. e shows the coloring of G after the agent occupying \(w_2\) performed a \(\varPhi\)-decreasing swap with the agent occupying \(w_1'\) or \(w_2'\) (Color figure online)

First, by swapping with an agent who is in the neighborhood of vertex u, e.g., with the agent occupying vertex \(w_2\). Then, by Lemma 3, the extended potential \(\varPsi\) changes by \((+1,0)\). After this swap, the blue agent who was previously on vertex \(w_1\) has to perform another swap with an orange agent, which changes \(\varPsi\) again by \((+1,0)\). The second way for vertex \(w_1\) to become occupied by an orange agent is that one of the two vertices which are adjacent to vertex \(w_1\) but not to vertex u is occupied by an orange agent, cf. Fig. 8d, and then this agent swaps with the agent on vertex \(w_1\). To this end, we have to consider two different cases: (i) the agent occupying vertex \(w_2\) in \({\varvec{\sigma }}_{ij}\) swapped with a neighbor of vertex \(w_1\), and (ii) the agent occupying vertex \(w_2\) in \({\varvec{\sigma }}_{ij}\) did not swap with a neighbor of vertex \(w_1\).

Considering case (i) and assuming that the left neighbor of \(w_1\) has degree 3, we note that both vertices which are in the neighborhood of vertex \(w_1\) but not in the neighborhood of vertex u, we denote them by \(w_1'\) and \(w_2'\), have degree 3 and 5, respectively. Moreover, the agents who are placed on vertices \(w_1'\) and \(w_2'\) are blue and have utility larger than 0, since one out of the two agents which are placed under \({\varvec{\sigma }}_{ij}\) on vertices \(w_1'\) and \(w_2'\) is orange and has utility 0 under \({\varvec{\sigma }}_{ij}\), cf. Fig. 8e. (Remember, that we assume that vertex \(w_2\) is involved in a \(\varPhi\)-decreasing swap with one of the agents occupying vertices \(w_1'\) and \(w_2'\), respectively). Therefore, we have two \(\varPsi\)-increasing swaps, the swap involving the agent occupying vertex \(w_1'\) or vertex \(w_2'\) with an orange agent and the swap with the corresponding orange agent and the agent occupying vertex \(w_1\), by at least \((+1,0)\) and \((+1,-1)\), respectively, before an orange agent occupies vertex \(w_1\), which in total yields a lexicographic increase, since we have two \(\varPhi\)-decreasing swaps of \((-1,+1)\) involving the vertices u and v, and \(w_2\), and a neighbor of \(w_1\) plus the two \(\varPhi\)-increasing swaps of \((+1,0)\) and \((+1,-1)\) for vertex \(w_1\) to be occupied by an orange agent.

Next, we assume that the left neighbor of vertex \(w_1\) has degree 5, cf. Fig. 8b. Note, that all neighbors of vertex \(w_1'\) have to be occupied by blue agents, since otherwise no \(\varPhi\)-decreasing swap with the agent occupying vertex \(w_2\) in \({\varvec{\sigma }}_{ij}\) is possible. Hence, the agent occupying vertex \(w_1'\) has utility larger than 0 and a swap such that vertex \(w_1'\) becomes occupied by an orange agent is \(\varPsi\)-increasing by at least \((+1,0)\). We denote the remaining neighbor of vertex \(w_1\), that is not adjacent to vertex u, again by \(w_2'\), cf. Fig. 8b. Note that it is possible that the agent placed on vertex \(w_2'\) swaps with an orange agent via a \(\varPhi\)-decreasing swap, cf. Fig. 8c. However, in this case the left neighbors of vertex \(w_2'\) have to be corner and border vertices, i.e, vertices with degree equals 3 or 5 (denoted as \(x_1\), \(x_2\) and \(x_3\) in Fig. 8c). Hence, to end up in an equivalent strategy profile, i.e., having agents with utility 0 placed on vertices \(w_1'\) and \(x_3\), the blue agents on \(x_1\), \(x_2\), and \(w_2'\) have to leave the neighborhood of vertices \(w_1'\) and \(x_3\) (and u), which implies at least three \(\varPsi\)-increasing swaps by \((+1,0)\), since all of the blue agents who are occupying the corresponding border and corner vertices have utility larger than 0. In total, the extended potential \(\varPsi\) lexicographically increases.

Turning our focus to case (ii), i.e., that the agent occupying vertex \(w_2\) in \({\varvec{\sigma }}_{ij}\) swapped with a non-neighbor of vertex \(w_1\), we note that the only additional case is that the left neighbor of vertex \(w_1\) is occupied by an orange agent, since all other cases are already covered by case (i). Assume that the left neighbor of vertex \(w_1\) has degree 5, cf. Fig. 8d. Note that in this case, i.e., vertex \(w_1\) and the left neighbor of vertex \(w_1\) have the same degree of 5 and the two corresponding agents occupying these two vertices perform a profitable swap, the extended potential \(\varPsi\) changes by at least \((+2,0)\), which in total implies a lexicographic increase since we have two \(\varPhi\)-decreasing swaps which change the potential \(\varPsi\) by \((-1,+1)\), respectively, and one \(\varPhi\)-increasing swap of \((+2,0)\). In total this yields a change in \(\varPsi\) by \((0,+2)\).

Assuming that the left neighbor of vertex \(w_1\) has degree 3, note that a swap of the agent occupying vertex \(w_1\) with her left neighbor changes \(\varPsi\) by \((+2,0)\): In case the left neighbor has utility 0, since, by assumption, it is not a \(\varPhi\)-preserving swap, the agent occupying vertex \(w_1\) has a utility of at most \(\frac{2}{5}\). If the left neighbor of vertex \(w_1\) has utility \(\frac{1}{3}\), the agent occupying vertex \(w_1\) has a utility of at most \(\frac{1}{5}\), and if the left neighbor of vertex \(w_1\) has utility \(\frac{2}{3}\) no profitable swap between the agent occupying vertex \(w_1\) and her left neighbor is possible. Thus, in total the extended potential \(\varPsi\) increases lexicographically.

  1. (c)

    We assume that vertex \(w_1\) is involved in a \(\varPhi\)-preserving swap and vertex \(w_2\) is involved in a \(\varPhi\)-decreasing swap. In this case we have that there exists two vertices \(w_1' \in N_u^2\) and \(w_2' \in N_u^2\) which are occupied by agents with utility 0. Moreover, it holds that \({\text{deg}} _{w_1'} = 3\) and \({\text{deg}} _{w_2'} = 3\) or \({\text{deg}} _{w_2'} = 5\), cf. Fig. 9a.

Fig. 9
figure 9

The coloring of G in \({\varvec{\sigma }}_{ij}\) after a \(\varPhi\)-decreasing swap of the orange agent i and the blue agent j occupying vertices u and v, respectively. We omitted symmetric and equivalent cases. a the coloring of G in \({\varvec{\sigma }}_{ij}\) after a \(\varPhi\)-decreasing swap by \((-1,+1)\) of agents i and j occupying vertices u and v. b and c the coloring of G after a \(\varPhi\)-preserving swap by \((0,+1)\) of agents occupying vertices \(w_1\) and \(w_1'\) (Color figure online)

Let \({\text{deg}} _{w_2'} = 5\). By Lemma 2, a swap by the agents on vertices \(w_1'\) and \(w_1\) changes \(\varPsi\) by \((0,+1)\). Now, note that if such a \(\varPhi\)-preserving swap is possible, it holds that the agent occupying vertex \(w_1\) in \({\varvec{\sigma }}_{ij}\) has utility \(\frac{3}{5}\) and therefore the agent on vertex \(w_2\) has a utility of at most \(\frac{5}{8}\), cf. Fig. 9b, and a swap with the agent on vertex \(w_2'\) must be \(\varPhi\)-increasing, which in total yields an increase in \(\varPsi\). Hence, at least one orange agent in the neighborhood of vertex u has to perform a profitable \(\varPhi\)-increasing swap, which again in total yields an increase in \(\varPsi\). Note that a \(\varPhi\)-decreasing swap of the agent occupying vertex \(w_2\) prevents a \(\varPhi\)-preserving swap afterwards of the agent occupying vertex \(w_1\), since in this case vertex \(w_2\) is occupied by an orange agent and, therefore, the agent occupying vertex \(w_1'\) cannot have utility 0, which is a requirement for a non-\(\varPhi\)-increasing swap. Let \({\text{deg}} _{w_2'} = 3\). By Lemma 2, a swap by the agents on vertices \(w_1'\) and \(w_1\) changes \(\varPsi\) by \((0,+1)\). Again, a \(\varPhi\)-decreasing swap of the agent occupying vertex \(w_2\) prevents a \(\varPhi\)-preserving swap afterwards of the agent occupying vertex \(w_1\). If the agent on vertex \(w_2\) has a utility of \(\frac{5}{8}\) a swap with the agent on vertex \(w_2'\) changes \(\varPsi\) by \((-1,+1)\), cf. Fig. 9c. To end up in an equivalent strategy profile, i.e., that the agents occupying vertices u, \(w_1'\) and \(w_2'\) are involved in \(\varPhi\)-decreasing and \(\varPhi\)-preserving swaps, the agent occupying vertex w has to perform two \(\varPhi\)-increasing swaps to leave the neighborhood of vertices \(w_1'\) and \(w_2'\). In total the extended potential \(\varPsi\) must change by at least \((0,+3)\), since together with the \(\varPhi\)-decreasing swap of the agents i and j occupying the vertices u and v, we have two \(\varPhi\)-decreasing swaps of \((-1,+1)\), one \(\varPhi\)-preserving swap of \((0,+1)\), and two \(\varPhi\)-increasing swaps of \((+1,0)\). This implies a lexicographic increase of the extended potential \(\varPsi\).

We have shown that after a \(\varPsi\)-decreasing profitable local swap involving agents on two vertices u and v additional swaps are necessary before another \(\varPsi\)-decreasing swap can happen again involving the same vertices. Moreover, we have shown that in total these additional swaps increase the extended potential \(\varPsi\) more than it was decreased by the initial swap. Thus, in total the extended potential \(\varPsi\) increases. This contradicts the existence of an IRC. \(\square\)

Now we will see that compared to the local k-SSG, the k-SSG on 8-grids behaves differently. There the FIP does not hold.

Theorem 5

There cannot exist a potential function for the k-SSG played on an 8-grid, for any \(k \ge 2\).

Proof

Fig. 10
figure 10

An improving response cycle for the k-SSG played on a 8-grid. The agent types are marked orange and blue (Color figure online)

We prove the statement by providing an improving response cycle \({\varvec{\sigma }}^0,\ldots ,{\varvec{\sigma }}^4\). The construction is shown in Fig. 10, where vertices are labeled with the agent occupying them. We have orange and blue agents. Agents with other types can be placed in a grid outside of the depicted cutout.

In the initial strategy profile \({\varvec{\sigma }}^0\) (Fig. 2), \(\mathsf{U}_b({\varvec{\sigma }}^0) = \frac{3}{5}\) and \(\mathsf{U}_c({\varvec{\sigma }}^0) = \frac{3}{8}\). Both agents b and c improve by swapping, since in \({\varvec{\sigma }}^1:={\varvec{\sigma }}^0_{bc}\) we have \(\mathsf{U}_b({\varvec{\sigma }}^1) = \frac{5}{8}\) and \(\mathsf{U}_c({\varvec{\sigma }}^1) = \frac{2}{5}\). After the first swap (Fig. 2), agents a and d can perform a profitable swap, since \(\mathsf{U}_a({\varvec{\sigma }}^1) = \frac{1}{3}\), \(\mathsf{U}_d({\varvec{\sigma }}^1) = \frac{5}{8}\) and in \({\varvec{\sigma }}^2:={\varvec{\sigma }}^1_{ad}\) we have \(\mathsf{U}_a({\varvec{\sigma }}^2) = \frac{3}{8}\) and \(\mathsf{U}_d({\varvec{\sigma }}^2) = \frac{2}{3}\). Then (Fig. 2), agents a and c can swap and improve from \(\mathsf{U}_a({\varvec{\sigma }}^2) = \frac{3}{8}\) and \(\mathsf{U}_c({\varvec{\sigma }}^2) = \frac{3}{5}\) to \(\mathsf{U}_a({\varvec{\sigma }}^3) = \frac{2}{5}\) and \(\mathsf{U}_c({\varvec{\sigma }}^3) = \frac{5}{8}\), respectively, with \({\varvec{\sigma }}^3:={\varvec{\sigma }}^2_{ac}\). Finally (Fig. 2), agents b and d can improve by swapping, since \(\mathsf{U}_b({\varvec{\sigma }}^3) = \frac{5}{8}\), \(\mathsf{U}_d({\varvec{\sigma }}^3) = \frac{1}{3}\) and in \({\varvec{\sigma }}^4:={\varvec{\sigma }}^3_{bd}\) we have \(\mathsf{U}_b({\varvec{\sigma }}^4) = \frac{2}{3}\) and \(\mathsf{U}_d({\varvec{\sigma }}^4) = \frac{3}{8}\). Now observe that the coloring induced by \({\varvec{\sigma }}^4\) is the same as the one induced by \({\varvec{\sigma }}^0\) (see Fig. 2, where a exchanges position with b and c exchanges position with d). So, the sequence of profitable swaps defined above can be repeated over and over mutatis mutandis. \(\square\)

However, even if convergence to an equilibrium is not guaranteed for \(k \ge 2\), they are guaranteed to exist for \(k = 2\).

Theorem 6

Every 2-SSG played on an 8-grid has an equilibrium which can be computed in polynomial time.

Proof

Remember that we denote with \(\ell\) the number of rows and with h the number of columns. Assume without loss of generality that the grid is such that \(h\le \ell\). If this is not the case, simply rotate the grid by ninety degrees. We give two different constructions depending on how the number of orange agents compares with the threshold \(2h-1\).

If \(o\ge 2h-1\), let \({\varvec{\sigma }}\) be the strategy profile in which orange agents occupy the grid starting from the upper-left corner and proceedings towards the right, filling the grid in increasing order of rows, see Fig. 11 for a pictorial example. Denote by x the number of entirely orange rows and by y the number of orange vertices in the unique row containing both, orange and blue vertices, (if this row exists, otherwise set \(y=0\)). Moreover, whenever \(y\ne 0\), let u be the last orange vertex (i.e., the y-th vertex along the \((x+1)\)-th row) and v be the first blue one (i.e., the vertex at the right of u); again, see Fig. 11 for an example. Observe that, by the assumption \(o\ge 2h-1\) and the fact that \(o\le b\), the following two properties hold:

(P.1):

\(x\ge 1\) and \(x=1\) if and only if \(y=h-1\);

(P.2):

\(x\le \ell -2\) and \(x=\ell -2\) only if \(y=0\).

Fig. 11
figure 11

The structure of an equilibrium when \(o\ge 2h-1\)

Fix an orange agent i. It is easy to see that, by property (P.1), it holds that

$$\rm{U}_{i} (\varvec{\sigma }) \ge \left\{ {\begin{array}{*{20}l} {\frac{2}{3}} \hfill & {{\text{if}}\;\varvec{\sigma }(i){\mkern 1mu} {\text{ is a corner vertex}},} \hfill \\ {\frac{3}{5}} \hfill & {{\text{if}}\;\varvec{\sigma }(i){\mkern 1mu} {\text{ is a border vertex unless}}{\mkern 1mu} y = 1{\mkern 1mu} {\text{ which gives }}{\mkern 1mu} \rm{U}_{i} (\varvec{\sigma }) = \frac{2}{5},} \hfill \\ {\frac{5}{8}} \hfill & {{\text{if}}\;\varvec{\sigma }(i){\mkern 1mu} {\text{is an inner vertex unless}}\;\varvec{\sigma }(i) = u{\mkern 1mu} {\text{ which gives }}{\mkern 1mu} \rm{U}_{i} (\varvec{\sigma }) = \frac{1}{2}.} \hfill \\ \end{array} } \right.$$
Fig. 12
figure 12

The structure of an equilibrium when \(o<2h-1\) and \(o\in [14]\). Only the orange vertices are depicted (Color figure online)

Fix a blue agent j. It is easy to see that, by property (P.2), it holds that

$$\rm{U}_{j} (\varvec{\sigma }) \ge \left\{ {\begin{array}{*{20}l} {\frac{2}{3}} \hfill & {{\text{if}}\;\varvec{\sigma }(j){\mkern 1mu} {\text{ is a corner vertex}},} \hfill \\ {\frac{3}{5}} \hfill & {{\text{if}}\;\varvec{\sigma }(j){\mkern 1mu} {\text{is a border vertex unless}}{\mkern 1mu} y = h - 1{\mkern 1mu} {\text{which gives}}{\mkern 1mu} \rm{U}_{j} (\varvec{\sigma }) = \frac{2}{5},} \hfill \\ {\frac{5}{8}} \hfill & {{\text{if}}\;\varvec{\sigma }(j){\mkern 1mu} {\text{ is an inner vertex unless}},\;\varvec{\sigma }(j) = v{\mkern 1mu} {\text{ which gives }}{\mkern 1mu} \rm{U}_{j} (\varvec{\sigma }) = \frac{1}{2}.} \hfill \\ \end{array} } \right.$$

As \(\frac{2}{5}+\min \{\frac{2}{3},\frac{3}{5},\frac{5}{8}\}\ge 1\), it follows by Lemma 1 that profitable swaps are possible in \({\varvec{\sigma }}\) only between an orange agent i and a blue agent j satisfying one of the following three conditions:

  1. (i)

    \(\mathsf{U}_i({\varvec{\sigma }})=\frac{2}{5}\) and \(\mathsf{U}_j({\varvec{\sigma }})=\frac{2}{5}\),

  2. (ii)

    \(\mathsf{U}_i({\varvec{\sigma }})=\frac{2}{5}\) and \(\mathsf{U}_j({\varvec{\sigma }})=\frac{1}{2}\),

  3. (iii)

    \(\mathsf{U}_i({\varvec{\sigma }})=\frac{1}{2}\) and \(\mathsf{U}_j({\varvec{\sigma }})=\frac{2}{5}\).

  1. (i)

    Requires \(1=y=h-1\) which implies \(h=2\) so that \(1_{ij}({\varvec{\sigma }})=1\). By \({\text{deg}} _{{\varvec{\sigma }}(i)}={\text{deg}} _{{\varvec{\sigma }}(j)}=5\), we get \(\mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }})\ge 1-\frac{1_{ij}({\varvec{\sigma }})}{5}\) satisfying the condition of Lemma 1.

  2. (ii)

    Requires \(y=1\) (which yields \({\varvec{\sigma }}(i)=u\)) and \({\varvec{\sigma }}(j)=v\) so that \(1_{ij}({\varvec{\sigma }})=1\). By \({\text{deg}} _{{\varvec{\sigma }}(i)}=5\) and \({\text{deg}} _{{\varvec{\sigma }}(j)}=8\), we get \(\mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }})\ge 1-\frac{1_{ij}({\varvec{\sigma }})}{5}\) again satisfying the condition of Lemma 1.

  3. (iii)

    Requires \(y=h-1\) (which yields \({\varvec{\sigma }}(j)=v\)) and \({\varvec{\sigma }}(i)=u\) so that \(1_{ij}({\varvec{\sigma }})=1\). By \({\text{deg}} _{{\varvec{\sigma }}(j)}=5\) and \({\text{deg}} _{{\varvec{\sigma }}(i)}=8\), we get \(\mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }})\ge 1-\frac{1_{ij}({\varvec{\sigma }})}{5}\) satisfying the condition of Lemma 1. Thus, \({\varvec{\sigma }}\) is an equilibrium and can be constructed in polynomial time.

If \(o<2h-1\), a more involved construction is needed. For any \(o\in [14]\), the proposed strategy profile \({\varvec{\sigma }}\) is depicted in Fig. 12. We stress that the two assumptions \(h\le \ell\) and \(o<2h-1\) imply that the grid is large enough to accommodate a coloring implementing \({\varvec{\sigma }}\). It is not difficult to check by direct inspection that \({\varvec{\sigma }}\) is an equilibrium. To this aim, it is important to observe that, when \(o\ge 7\), there must be at least two blue agents occupying vertices on the first row, otherwise the assumption \(o<2h-1\) would be contradicted.

Now, for any \(15\le o<2h-1\), we propose a general rule, which can be implemented in polynomial time, to construct an equilibrium profile \({\varvec{\sigma }}\). First, we define some suitable structures. For an integer \(x\ge 5\), an x-triangle is a strategy profile obtained as follows: for each \(y=x\) down to 1, y orange agents are assigned to the first y vertices of the \((x+1-y)\)-th row, see Fig. 13. Thus, a total of \(\frac{x(x+1)}{2}\) orange agents are assigned.

Fig. 13
figure 13

The structure of an x-triangle, with \(x=6\). The grid needs to have additional blue rows and columns which are not depicted (Color figure online)

For an integer \(x\ge 5\), an (x, 1)-almost triangle is a strategy profile obtained by assigning x orange agents to the first x vertices of the first two rows, \(x-1\) orange agents to the first \(x-1\) vertices of the third row, and then, for each \(y=x-3\) down to 2, y orange agents are assigned to the first y vertices of the \((x+1-y)\)-th row, see the top-left picture in Fig. 14. Thus, a total of \(\sum _{i=2}^{x-3}i+3x-1=\frac{x(x+1)}{2}+1\) orange agents are assigned.

Fig. 14
figure 14

The structure of (xy)-triangles, with \(x=6\) and \(y\in [6]\). The grid needs to have additional blue rows and columns which are not depicted (Color figure online)

For a pair of integers (xy), with \(x\ge 5\) and \(2\le y\le x\), we define an (xy)-almost triangle as follows: for \(2\le y\le x-2\), the (xy)-almost triangle is obtained from the \((x,y-1)\)-one by locating an orange agent to the first non-orange vertex of the \((y+2)\)-th row; the \((x,x-1)\)-almost triangle is obtained by locating an orange agent to the first non-orange vertex (i.e., the second) of the x-th row of the \((x,x-2)\)-one; the (xx)-almost triangle is obtained by locating an orange agent to the first non-orange vertex (i.e., the \((x+1)\)-th) of the first row of the \((x,x-1)\)-one (see Fig. 14 for a pictorial example).

Now observe that any number \(o\ge 15\) can be decomposed as \(o=\frac{x(x+1)}{2}+y\) for some integers x and y such that \(x\ge 5\) and \(0\le y\le x\). The strategy profile \({\varvec{\sigma }}\) is the x-triangle if \(y=0\) and the (xy)-almost triangle, otherwise. Clearly, \({\varvec{\sigma }}\) can be constructed in polynomial time. We are left to prove that \({\varvec{\sigma }}\) is an equilibrium. We shall use Lemma 1 in conjunction with the following claims which can be easily verified with the help of Figs. 13 and 14. In any x-triangle \({\varvec{\sigma }}\) with \(x\ge 5\), \(\mathsf{U}_i({\varvec{\sigma }})\ge \frac{2}{5}\) for any orange agent i and \(\mathsf{U}_j({\varvec{\sigma }})\ge \frac{5}{8}\) for any blue agent j. Thus, \({\varvec{\sigma }}\) is an equilibrium. Now, let us consider (xy)-almost triangles.

If \(y\in [x-3]\), we have \(\mathsf{U}_i({\varvec{\sigma }})\ge \frac{1}{2}\) for any orange agent i and \(\mathsf{U}_j({\varvec{\sigma }})\ge \frac{1}{2}\) for any blue agent j. So, \({\varvec{\sigma }}\) is an equilibrium.

If \(y=x-2\), \(\mathsf{U}_i({\varvec{\sigma }})\ge \frac{1}{2}\) for each orange agent i, except for the one occupying the unique orange vertex at the x-th row who gets utility equal to \(\frac{2}{5}\); moreover, \(\mathsf{U}_j({\varvec{\sigma }})\ge \frac{5}{8}\) for each blue agent j, except for the one occupying the first blue vertex of the x-th row (see the bottom-left picture in Fig. 14).

Thus, we get \(\mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }})\ge 1-\frac{1_{ij}({\varvec{\sigma }})}{\min \{{\text{deg}} _{{\varvec{\sigma }}(i)},{\text{deg}} _{{\varvec{\sigma }}(j)}\}}\) for each orange agent i and blue agent j. So, \({\varvec{\sigma }}\) is an equilibrium. If \(y=x-1\), \(\mathsf{U}_i({\varvec{\sigma }})\ge \frac{1}{2}\) for each orange agent i and \(\mathsf{U}_j({\varvec{\sigma }})\ge \frac{5}{8}\) for each blue agent j, thus implying that \({\varvec{\sigma }}\) is an equilibrium (see the bottom-middle picture in Fig. 14).

Finally, if \(y=x\), \(\mathsf{U}_i({\varvec{\sigma }})\ge \frac{2}{5}\) for each orange agent i and \(\mathsf{U}_j({\varvec{\sigma }})\ge \frac{5}{8}\) for each blue agent j (see the bottom-right picture in Fig. 14), and so also in this case \({\varvec{\sigma }}\) is an equilibrium. \(\square\)

3 Price of anarchy for two types of agents

In the following section, we consider the efficiency of equilibrium assignments and bound the PoA for different classes of underlying graphs. In particular, besides investigating general graphs, we analyze regular graphs, cycles, paths, 4-grids and 8-grids. Agarwal et al. [1] already proved that the PoA for the 2-SSG is in \(\varTheta (n)\) on underlying star graphs if there are at least two agents of each type and between \(\frac{667}{324}\) and 4 for the balanced version, i.e., \(o = \frac{n}{2}\). We improve this result by providing an upper bound of \(\frac{8}{3}\) which tends to 2 for n going to infinity. Furthermore, the authors of [1] showed that the PoA can be unbounded for \(k \ge 3\) using a cycle topology with additional leaves. Note that topological restrictions could circumvent this non-existence result. Nevertheless, we concentrate on the (local) 2-SSG for several graph classes.

3.1 General graphs

Remember that for a 2-SSG game, we assume that o is the less frequent color.

We significantly improve and generalize the results of [1] for the case of \(o>1\) by providing a general upper bound of \(\frac{no(n-o)-n}{o(o-1)(n-o)}\). For balanced games, it yields an upper bound of \(\frac{2(n+2)}{n}\) which shows that the PoA tends to 2 as the number of vertices increases. Moreover, if \(\frac{b}{o} \in {\mathcal {O}}(1)\), the PoA is constant.

With the help of Lemma 1, we can now prove our general upper bound for the 2-SSG.

Theorem 7

The PoA of 2-SSGs with \(o>1\) is at most \(\frac{no(n-o)-n}{o(o-1)(n-o)}\). Hence, the PoA \(\in {\mathcal {O}}\left( \frac{b}{o}\right)\).

Proof

Fix a 2-SSG with \(o>1\) orange agents played on a graph G with n vertices. First, we observe that the social welfare of a social optimum is at most \(n-2+\frac{o-1}{o}+\frac{b-1}{b}=n-\frac{1}{o}-\frac{1}{b}\), as there must be at least one orange vertex that is adjacent to at least one blue vertex, thus getting utility at most \(\frac{o-1}{o}\), and at least one blue vertex that is adjacent to at least one orange vertex, thus getting utility at most \(\frac{b-1}{b}\).

Given a strategy profile \({\varvec{\sigma }}^\prime\), a feasible pair is a pair of vertices (uv) such that u and v are occupied by agents of different colors in \({\varvec{\sigma }}^\prime\) and \(\{u,v\}\notin E(G)\), i.e., u and v are not adjacent. Now fix a swap equilibrium \({\varvec{\sigma }}\) and consider a maximum cardinality matching M of feasible pairs. Clearly \(0\le |M|\le o\). Hence, \(|M|= o-x\) for some \(0\le x\le o\). If \(x>0\), then, there are exactly x orange and at least x blue leftover vertices of V that do not belong to any feasible pair in M. As M has maximum cardinality, each orange leftover vertex has to be adjacent to all leftover blue ones and vice-versa. That is, for each leftover vertex u, we have \({\text{deg}} _u(G)\ge x\). Let T be a set of pairs of vertices obtained by matching each leftover orange vertex with a leftover blue one. By Lemma 1, for each \((u,v)\in M\), it holds that \(\mathsf{U}_{{\varvec{\sigma }}^{-1}(u)}({\varvec{\sigma }})+\mathsf{U}_{{\varvec{\sigma }}^{-1}(v)}({\varvec{\sigma }})\ge 1\) and for each \((u,v)\in T\), it holds that \(\mathsf{U}_{{\varvec{\sigma }}^{-1}(u)}({\varvec{\sigma }})+\mathsf{U}_{{\varvec{\sigma }}^{-1}(v)}({\varvec{\sigma }})\ge 1-\frac{1}{x}\). Thus, the social welfare of \({\varvec{\sigma }}\) is at least \(o-x+x(1-\frac{1}{x})=o-1\). \(\square\)

Corollary 2

The PoA of 2-SSGs is constant if \(\frac{b}{o}\) is constant.

We want to emphasize that for the case where both colors are perfectly balanced, the PoA is constant. Although this was already known [1], we provide an improved upper bound. As for \(n = 2\) the 2-SSG is trivial and has a PoA \(= 1\) and for \(n =4\) we can show that the PoA \(= 1\) as well, we get the following corollary.

Corollary 3

The PoA of balanced 2-SSGs is at most \(\min \left\{ \frac{8}{3},\frac{2(n+2)}{n}\right\}\).

Proof

We only have to show that for \(n = 4\) the 2-SSG has a PoA \(= 1\). In particular, assume that there are two orange and two blue agents. To show that PoA \(=1\), it suffices to show that either the underlying graph is a star or that the two orange agents are connected to each other, and the two blue agents are connected to each other. This is enough as the graph is connected and has four vertices.

Observe that it cannot be the case that both blue agents are connected only to orange agents and both orange agents are connected only to blue agents. If this were the case, there would exist an orange-blue pair that would like to swap. So, without loss of generality the blue agents are connected to each other.

Now, assume that the orange agents are not connected to each other, and thus they have utility 0. Observe that it cannot be the case that an orange agent i is connected to both blue agents. If this were the case, consider the swap between i and the blue agent j that is also connected to the other orange agent. Then, i improves her utility by getting connected to the other orange agent, while j remains connected to the other blue agent and, at the same time, decreases the number of orange neighbors. So, every orange agent has only one blue neighbor.

There are only two cases remaining: The two orange agents have the same blue neighbor or they have different blue neighbors. If the orange agents have the same blue neighbor, this implies that the topology is a star with a blue center, hence, the assignment is a swap equilibrium and optimal in terms of the social welfare.

If the orange agents have different blue neighbors, then, the topology is a line with the two orange agents occupying the outer vertices and the two blue agents occupying the two inner vertices. This is clearly not a swap equilibrium, as, for instance, the left-most blue and the right-most orange want to swap.

Hence, the PoA is 1 for \(n=4\). \(\square\)

We will now show that in contrast to the balanced 2-SSG, the balanced local k-SSG has a much higher LPoA.

Theorem 8

The LPoA of local balanced 2-SSGs with \(o >1\) is between \(2n + \frac{8}{n} -8\) and \(2n - \frac{8}{n}\).

Proof

Fix a 2-SSG with \(o > 1\) orange agents played on a graph G with n vertices. First, as derived in the proof of Theorem 7, we have that the social welfare of a social optimum is at most \(n-2\)+\(\frac{o-1}{o}+\frac{n-o-1}{n-o} = n - \frac{n}{o(n-o)}\), as there must be at least one orange vertex that is adjacent to at least one blue vertex.

Now fix a local swap equilibrium \({\varvec{\sigma }}\). We will show that the social welfare of \({\varvec{\sigma }}\) is at least \(\frac{1}{2}\). First, assume that there is exactly one vertex v with \({\text{deg}} _v(G) > 1\). Then, G has to be a star and since \(o > 1\) there has to be at least one leaf vertex with an agent i with \(\mathsf{U}_i({\varvec{\sigma }}) = 1\). Therefore, there has to be at least two adjacent vertices \(v_1\) and \(v_2\) with \({\text{deg}} _{v_i} > 1\) for \(i \in \{1,2\}\). By Lemma 1 we know that if \(v_1\) and \(v_2\) are occupied by agents of different types then \(\mathsf{U}_{{\varvec{\sigma }}^{-1}(v_1)} + \mathsf{U}_{{\varvec{\sigma }}^{-1}(v_2)} \ge \frac{1}{2}\). Hence, assume that there is no such pair \(v_1\) and \(v_2\) and assume, without loss of generality, that all adjacent vertex pairs \(v_1\) and \(v_2\), with \({\text{deg}} _{v_i} > 1\) for \(i \in \{1,2\}\), are occupied by orange agents. It follows, since G is connected, that all blue agents only occupy leaf vertices. If the social welfare of \({\varvec{\sigma }}\) is less than \(\frac{1}{2}\), all orange agents have to be surrounded by more blue than orange agents. Since one blue agent is only adjacent to one orange agent this contradicts our requirement of a balanced game. Hence, the PoA is upper bounded by \(2\left( n - \frac{n}{o(n-o)} \right)\). With \(o = \frac{n}{2}\) this is equal to \(2n - \frac{8}{n}\).

For the lower bound consider the graph G in Fig. 15.

Fig. 15
figure 15

A lower bound for the local balanced 2-SSG. The agent types are marked orange and blue (Color figure online)

G consists of two stars which are connected by a common leaf vertex. Let \(v_1\) be the center of the first star, \(v_3\) be the center of the second star and \(v_2\) be the common vertex. We first prove that the configuration shown in Fig. 15a is an equilibrium. Note, that none of the leaf vertices can perform a profitable swap since the agents on \(v_1\) and \(v_3\), respectively, would receive \(\mathsf{U}_{{\varvec{\sigma }}^{-1}(v_1)} = 0\) and \(\mathsf{U}_{{\varvec{\sigma }}^{-1}(v_2)} = 0\), respectively. So the only possible swap is between the agents placed on \(v_1\) and \(v_2\). However, the orange agent currently located on \(v_1\) would not increase her utility by swapping since she would be surrounded only by two blue agents placed on \(v_1\) and \(v_2\) and therefore would receive a utility equals 0. Hence, no local swap is possible and only the agents placed on \(v_2\) and \(v_3\) receive positive utility. The social welfare is equal to \(\frac{1}{2} + \frac{1}{o-1}\) which is for \(o = \frac{n}{2}\) equal to \(\frac{1}{2} + \frac{2}{n-2}\). The social optimum is shown in Fig. 15b. This is easy to see, since we meet the trivial upper bound \(n-2\)+\(\frac{o-1}{o}+\frac{n-o-1}{n-o} = n - \frac{n}{o(n-o)}\) which is for \(o = \frac{n}{2}\) equal to \(n-\frac{4}{n}\). Hence, the PoA is lower bounded by \(\frac{2(n-2)^2}{n} = 2n + \frac{8}{n} - 8\). \(\square\)

If the underlying graph G does not contain leaf vertices, i.e., all vertices have at least degree 2, we can prove a smaller LPoA. In particular, if the ratio between the maximum and minimum degree of vertices in G is constant, we achieve a constant LPoA.

Theorem 9

The LPoA of local 2-SSGs on a graph G with minimum degree \(\delta \ge 2\) and maximum degree \(\varDelta\) is at most \(2\left( 1+\frac{\varDelta +1}{\delta -1}\right)\).

Proof

Fix a local swap equilibrium \({\varvec{\sigma }}\) on G. Let \(\rho :=\frac{\delta -1}{2\delta }\) and let \(o'\) and \(b'\) be the numbers of orange and blue agents that have a utility strictly less than \(\rho\), respectively. Clearly, \(o-o'\) and \(b-b'\) are the numbers of orange and blue agents that have a utility of at least \(\rho\), respectively. We first prove that \(b-b' \ge \frac{\delta o'}{\varDelta }\) as well as that \(o-o' \ge \frac{\delta b'}{\varDelta }\) and show then how these two inequalities imply the theorem statement.

We only prove the inequality \(b-b' \ge \frac{\delta o'}{\varDelta }\) as the proof of the other inequality is similar. Let i and j, respectively, be a blue agent and an orange agent that occupy two adjacent vertices in G, say \(\sigma (i)=u\) and \(\sigma (j)=v\), and such that \(\mathsf{U}_j({\varvec{\sigma }}) < \rho\). By Lemma 1, we have that \(\mathsf{U}_i({\varvec{\sigma }})+\mathsf{U}_j({\varvec{\sigma }}) \ge 1-\frac{1}{\delta }\), from which we derive \(\mathsf{U}_i({\varvec{\sigma }}) > 1-\frac{1}{\delta }-\frac{\delta -1}{2\delta } = \frac{\delta -1}{2\delta }=\rho\).

Let \(G'\) be the subgraph of G containing all the non-monochromatic edges, i.e., each edge of \(G'\) connects a vertex occupied by an orange agent with a vertex occupied by a blue agent. Clearly, \(G'\) is bipartite. Consider the vertex-induced subgraph H of \(G'\) in which we have all the \(o'\) orange agents having a utility strictly less than \(\rho\) on one side and all the \(b-b'\) blue agents having a utility of at least \(\rho\) on the other side. Since for each vertex v of H occupied by an orange agent, there are at least \((1-\rho ){\text{deg}} _v \ge \frac{\delta +1}{2}\) vertices adjacent to u that are occupied by blue agents and each such blue agent has a utility of at least \(\rho\), the degree of v in H is at least \(\frac{\delta +1}{2}\). Therefore,

$$\begin{aligned} |E(H)| \ge \frac{\delta +1}{2} o'. \end{aligned}$$
(5)

Furthermore, since each edge of H is incident to a blue agent that has a utility of at least \(\rho\), the degree in H of every vertex u that is occupied by a blue agent is at most \((1-\rho ){\text{deg}} _u \le \frac{\delta +1}{2\delta }\varDelta\). Therefore,

$$\begin{aligned} |E(H)| \le \frac{\varDelta (\delta +1)}{2\delta } (b-b'). \end{aligned}$$
(6)

Plugging (5) into (6) and simplifying gives \(b-b' \ge \frac{\delta }{\varDelta } o'\).

Finally, we show how \(b-b' \ge \frac{\delta o'}{\varDelta }\) and \(o-o' \ge \frac{\delta b'}{\varDelta }\) imply the theorem statement. The average utility of all the agents in H is at least

$$\begin{aligned} \frac{\rho (b-b')}{o'+(b-b')} \ge \frac{\rho \frac{\delta }{\varDelta }}{1+\frac{\delta }{\varDelta }}=\frac{\delta -1}{2(\delta +\varDelta )}. \end{aligned}$$

Similarly, the average utility of the \(b'\) blue agents whose utilities are strictly less than \(\rho\) and the \(o-o'\) orange agents whose utilities are of at least \(\rho\) is also at least \(\frac{\delta -1}{2(\delta +\varDelta )}\). Therefore, the LPoA is at most \(\frac{2(\delta +\varDelta )}{\delta -1}=2\left( 1+\frac{\varDelta +1}{\delta -1}\right)\). \(\square\)

In [1] the authors showed that in the case where agents are unique of their type the PoA can be unbounded. We observe, by using the same instance from [1], that the LPoA on a graph with minimum degree \(\delta = 1\) can be unbounded as well. For this, consider the star graph with \(\varDelta\) leaves and let \({\varvec{\sigma }}\) be a strategy profile where the unique orange agent occupies the star center, while all the blue agents occupy the leaves. This is clearly a swap equilibrium of 0 social welfare. Any configuration in which a blue agent occupies the star center has strictly positive social welfare.

However, as the following theorem shows, the LPoA can be upper bounded by a function of \(\varDelta\) if we force \(n \ge \varDelta +2\), i.e., we avoid the pathological star graph of \(\varDelta +1\) vertices.

Theorem 10

For every \(\epsilon > 0\), the LPoA of local 2-SSGs on a graph G with maximum degree \(\varDelta \le n-2\) is between \(\frac{\varDelta (\varDelta -1)}{2}-\epsilon\) and \(2(\varDelta ^2+1)\).

Proof

We claim that for every agent i, with \({\text{deg}} _{\sigma (i)} \ge 2\), there is an agent j, with \(\sigma (j) \in N_{\sigma (i)}\) and \({\text{deg}} _{\sigma (j)} \ge 2\), such that \(\mathsf{U}_i({\varvec{\sigma }})\ge \frac{1}{\varDelta }\) or \(\mathsf{U}_j({\varvec{\sigma }}) \ge \frac{1}{2}\). Indeed, assume that \(\mathsf{U}_i({\varvec{\sigma }}) <\frac{1}{\varDelta }\). This implies that \(\mathsf{U}_i({\varvec{\sigma }})=0\) and, therefore, that every agent occupying a vertex in \(N_{\sigma (i)}\) is of a different type from that of i. Let j be an agent occupying a vertex in \(N_{\sigma (i)}\) and such that \({\text{deg}} _{\sigma (j)} \ge 2\). By Lemma 1 the sum of utilities of agents i and j is of at least \(\frac{1}{2}\) and therefore, \(\mathsf{U}_j({\varvec{\sigma }}) \ge \frac{1}{2}\).

This implies that all the vertices of the graph can be partitioned into two types of sets:

type-1 set::

It has a size smaller than or equal to \(\varDelta +1\) and contains a vertex u occupied by an agent that has a utility of at least \(\frac{1}{\varDelta }\) together with a subset of \(N_u\);

type-2 set::

It has a size smaller than or equal to \(1+\varDelta +\varDelta (\varDelta -1)=\varDelta ^2+1\) and contains a vertex u occupied by an agent that has a utility of at least \(\frac{1}{2}\) together with a subset of \(N_u \cup \bigcup _{v \in N_u}N_v\).

The average utility of all the agents contained in type-1 sets is at least \(\frac{1}{\varDelta ^2+\varDelta }\), while the average utility of all the agents contained in type-2 sets is at least \(\frac{1}{2(\varDelta ^2+1)}\). Therefore, as \(\varDelta \ge 2\), the average utility of an agent is at least

$$\begin{aligned} \min \left\{ \frac{1}{\varDelta ^2+\varDelta }, \frac{1}{2(\varDelta ^2+1)}\right\} = \frac{1}{2(\varDelta ^2+1)}. \end{aligned}$$

The upper bound of the LPoA follows.

For the lower bound of the LPoA, it is enough to consider the instance with o orange agents and \(b=(\varDelta -2)o\) blue agents – thus, \(n=(\varDelta -1)o\) – consisting of a cycle of length o and whose vertices are all occupied by the orange agents and where each vertex of the cycle is the center of a star of \(\varDelta -2\) 1-degree additional vertices that are occupied by the blue agents. Clearly, all the degree-1 vertices are occupied by the blue agents. The utility of an orange agent is equal to \(\frac{2}{\varDelta }\) while the utility of a blue agent is equal to 0. By Lemma 1, we have that the considered strategy profile is a local swap equilibrium. The social welfare of this local swap equilibrium is equal to \(\frac{2o}{\varDelta }=\frac{2n}{\varDelta (\varDelta -1)}\).

If we assume that \(o=\varDelta -1\) and consider the strategy profile where the \(\varDelta -1\) orange agents occupy any vertex of the cycle together with all the \(\varDelta -2\) 1-degree vertices appended to it, and the blue agents occupy the remaining vertices, we have that the social welfare of the considered instance is equal to \(n-3+2\frac{\varDelta -1}{\varDelta }+\frac{\varDelta -2}{\varDelta }=n-\frac{4}{\varDelta }\). Therefore, if we choose \(n \ge \frac{2(\varDelta -1)}{\epsilon }\), we have that the LPoA is lower bounded by

$$\begin{aligned} \left( n-\frac{4}{\varDelta }\right) \frac{\varDelta (\varDelta -1)}{2n} = \frac{\varDelta (\varDelta -1)}{2}-\frac{2(\varDelta -1)}{n} \ge \frac{\varDelta (\varDelta -1)}{2}-\epsilon . \end{aligned}$$

\(\square\)

If we desist from star graphs, the class of trees meet the conditions required by Theorem 10 and we get the following corollary.

Corollary 4

For every \(\epsilon > 0\), the LPoA of local 2-SSGs on a tree graph G with maximum degree \(\varDelta \le n-2\) is at least \(\frac{\varDelta (\varDelta -1)}{2}-\epsilon\).

Proof

Consider the lower bound construction given in Theorem 10 in which we remove one edge from the cycle. There is a threshold value \(f(\varDelta ,\epsilon )\) such that for every \(n \ge f(\varDelta ,\epsilon )\), the LPoA is at least \(\frac{\varDelta (\varDelta -1)}{2}-\epsilon\). \(\square\)

3.2 Regular graphs

In this section we provide upper and lower bounds to the LPoA for regular graphs, i.e., for graphs where all vertices have the same degree. The key is the following technical lemma which we will be later useful also for non-regular graphs.

Lemma 4

Let \({\varvec{\sigma }}\) be a local swap equilibrium, and let \(\varDelta =2\alpha +\beta\), with \(\alpha \in {{\mathbb {N}}}\) and \(\beta \in \{0,1\}\). Let \(X\subseteq V\) be a subset of vertices such that \({\text{deg}} _v=\varDelta\) for every \(v \in N_X:=\bigcup _{x \in X}N_x\). Finally, let \(Z \subseteq N_X\) be the set of vertices occupied by the agents that have a utility strictly larger than \(\rho :=\frac{\alpha }{2\alpha +1}\). Then, the average utility of the agents that occupy the vertices in \(X \cup Z\) is at least \(\rho\).

Proof

Let \(X_o\subseteq X\) (respectively, \(X_b \subseteq X\)) be the set of vertices occupied by the orange (respectively, blue) agents that have a utility strictly less than \(\rho\). Similarly, let \(Z_o \subseteq N_X\) (respectively, \(Z_b \subseteq N_X\)) be the set of vertices occupied by the orange (respectively, blue) agents that have a utility strictly larger than \(\rho\). We show that the average utility of the agents that occupy the vertices \(X_o \cup Z_b\) (respectively, \(X_b \cup Z_o\)) is at least \(\rho\). Notice that this immediately implies the theorem statement.

In the rest of the proof, without loss of generality, we prove that the average utility of the agents that occupy the vertices in \(X_o \cup Z_b\) is at least \(\rho\). First of all, we observe that the utility of each agent in \(N_X\) is in the set \(\{\frac{\ell }{\varDelta } \mid \ell =0,\dots ,\varDelta \}\). Let \(o_\ell\) be the numbers of orange agents that occupy the vertices of X and whose utilities are equal to \(\frac{\ell }{\varDelta }\). Similarly, let \(b_\ell\) be the numbers of orange agents that occupy the vertices of \(N_X\) and whose utilities are equal to \(\frac{\ell }{\varDelta }\). Since we are interested to the orange agents occupying the vertices of \(X_o\), we consider the values \(o_\ell\) such that \(\frac{\ell }{\varDelta } < \rho\), or, equivalently, \(\ell \le \alpha -1\). Similarly, since we are interested to the blue agents occupying the vertices of \(Z_b\), we consider the values \(b_{\varDelta -\ell -1}\) such that \(\frac{\varDelta -\ell -1}{\varDelta } > \rho\), or, equivalently, \(\ell \le \alpha -1\). We prove that, for every \(0 \le h \le \alpha -1\),

$$\begin{aligned} \sum _{\ell =0}^{h} (\ell +1)b_{\varDelta -\ell -1} \ge \sum _{\ell =0}^{h}(\varDelta -\ell )o_\ell . \end{aligned}$$
(7)

We observe that if any orange agent i that occupies a vertex \(v \in X_o\) has a utility of \(\frac{\ell }{\varDelta }\), where \(0 \le \ell \le \alpha -1\), then, since we are in a local swap equilibrium, any of the \(\varDelta -\ell\) blue agents that occupy the vertices in \(N_v\) has a utility of at least \(\frac{\varDelta -\ell -1}{\varDelta }> \rho\) by Lemma 1.

Let \(G'\) be the (bipartite) subgraph of G containing all the non-monochromatic edges. Consider the subgraph H of \(G'\) that is induced by the vertices in \(X_h\subseteq X_o\) that are occupied by agents having a utility of at most \(\frac{h}{\varDelta }\) and the agents in \(Z_h \subseteq Z_b\) having a utility of at least \(\frac{\varDelta -h-1}{\varDelta }\). By construction, the degree of a vertex of \(X_h\) occupied by an agent of utility equal to \(\frac{\ell }{\varDelta }\), with \(\ell \le h\), is equal to \(\varDelta -\ell\). Therefore, if \({\text{deg}} _v(H)\) denotes the degree of v in H, we have that

$$\begin{aligned} |E(H)|=\sum _{v \in X_h}{\text{deg}} _v(H)=\sum _{\ell =0}^{h}(\varDelta -\ell )o_\ell . \end{aligned}$$
(8)

Since the degree in H of each vertex in \(Z_h\) that is occupied by a blue agent whose utility is equal to \(\frac{\varDelta -\ell -1}{\varDelta }\), with \(\ell \le h\), is upper bounded by \(\ell +1\), we have that

$$\begin{aligned} |E(H)| \le \sum _{v \in Z_h}{\text{deg}} _v(H) = \sum _{\ell =0}^h (\ell +1)b_{\varDelta -\ell -1}. \end{aligned}$$
(9)

Combining (8) with (9) gives (7). We are now able to compute the average utility with respect to the agents occupying the vertices in \(X_o \cup Z_b\). The average utility of such agents equals

$$\begin{aligned} \mathsf{U}_{\mathrm {avg}}:=\frac{\sum _{\ell =0}^{\alpha -1}\left( \frac{\varDelta -\ell -1}{\varDelta }b_{\varDelta -\ell -1}\right) +\sum _{\ell =0}^{\alpha -1}\left( \frac{\ell }{\varDelta }o_\ell \right) }{\sum _{\ell =0}^{\alpha -1}b_{\varDelta -\ell -1}+\sum _{\ell =0}^{\alpha -1}o_\ell }. \end{aligned}$$

Now, we prove that \(\mathsf{U}_{\mathrm {avg}}\ge \rho\). We assume that the values of all the \(o_\ell\)’s are fixed and that there is at least one \(o_\ell\), with \(0 \le \ell \le \alpha -1\), that is strictly greater than 0. Since \(\frac{\ell }{\varDelta } < \rho\), while \(\frac{\varDelta -\ell -1}{\varDelta } > \rho\), we have that \(\mathsf{U}_{\mathrm {avg}}\) is minimized when the values we can assign to the \(b_{\varDelta -\ell -1}\)’s – that must satisfy (7) for every \(0 \le h \le \alpha -1\) – are somehow minimized.

Since, for every \(\ell < \ell '\) and every \(0< \epsilon < b_{\varDelta -\ell '-1}\),

$$\begin{aligned} \frac{\varDelta -\ell -1}{\varDelta } > \frac{\varDelta -\ell '-1}{\varDelta } \end{aligned}$$

as well as

$$\begin{aligned} (\ell '+1)(b_{\varDelta -\ell -1}+\epsilon )+(\ell +1)(b_{\varDelta -\ell '-1}-\epsilon ) > (\ell '+1)b_{\varDelta -\ell -1}+(\ell +1)b_{\varDelta -\ell '-1}, \end{aligned}$$

we have that \(\mathsf{U}_{\mathrm {avg}}\) is minimized exactly when \(b_{\varDelta -\ell -1}=\frac{\varDelta -\ell }{\ell +1}o_\ell\).Footnote 4 Therefore, if we denote by \(\varPsi =\{\ell \mid 0 \le \ell \le \alpha -1 \wedge o_\ell > 0\}\), we have that

$$\begin{aligned} \mathsf{U}_{\mathrm {avg}}&\ge \frac{\sum _{\ell \in \varPsi }\left( \frac{(\varDelta -\ell -1)(\varDelta -\ell )}{\varDelta (\ell +1)}o_\ell \right) +\sum _{\ell \in \varPsi }\left( \frac{\ell }{\varDelta }o_\ell \right) }{\sum _{\ell \in \varPsi }\left( \frac{\varDelta -\ell }{\ell +1}o_\ell \right) +\sum _{\ell \in \varPsi }o_\ell } \\&= \frac{\sum _{\ell \in \varPsi } \frac{2\ell ^2-2(\varDelta -1)\ell +\varDelta (\varDelta -1)}{\varDelta (\ell +1)}}{\sum _{\ell \in \varPsi }{\frac{\varDelta +1}{\ell +1}}} \ge \min _{\ell \in \varPsi }\frac{2\ell ^2-2(\varDelta -1)\ell +\varDelta (\varDelta -1)}{\varDelta (\varDelta +1)}. \end{aligned}$$

We complete the proof by showing that

$$\begin{aligned} \min _{\ell \in \varPsi } \frac{2\ell ^2-2(\varDelta -1)\ell +\varDelta (\varDelta -1)}{\varDelta (\varDelta +1)} \ge \rho . \end{aligned}$$
(10)

The numerator of the left-hand side of (10) is a parabola with respect to the variable \(\ell\) and is therefore minimized when \(\ell\) is chosen as closest as possible to the value \(\frac{\varDelta -1}{2}\).

As \(\left\lfloor \frac{\varDelta -1}{2}\right\rfloor \ge \alpha -1\) and \(\ell \le \alpha -1\), it follows that the value of \(\ell\) that minimizes (10) is \(\ell =\alpha -1\). Therefore,

$$\begin{aligned} \frac{2(\alpha -1)^2-2(2\alpha -1)(\alpha -1)+2\alpha (2\alpha -1)}{2\alpha (2\alpha +1)}=\rho . \end{aligned}$$

Hence, \(\mathsf{U}_{\mathrm {avg}} \ge \rho\). \(\square\)

Corollary 5

The LPoA of local 2-SSG on a regular graph G with \(\varDelta = 2\alpha +\beta\), with \(\alpha \ge 1\) and \(\beta \in \{0,1\}\) is at most \(2+\frac{1}{\alpha }\).

Proof

The corollary follows from Lemma 4 by setting \(X=V\). \(\square\)

The matching lower bound is provided in the following.

Theorem 11

The LPoA of local 2-SSG on a regular graph G with \(\varDelta = 2\alpha +\beta\), with \(\alpha \ge 1\) and \(\beta \in \{0,1\}\) is equal to \(2+\frac{1}{\alpha }\).

Proof

For a fixed degree \(\varDelta \ge 3\)Footnote 5, we define the \(\varDelta\)-regular graph \(G(\varDelta ):=G\) as follows: There are \(q:=t(\varDelta +1)\) gadgets \(G^1,\ldots ,G^q\). For each \(i\in [q]\), gadget \(G^i\) is obtained from a complete graph of \(\varDelta +1\) vertices, denoted as \(v_0^1,\ldots ,v_\varDelta ^i\), by removing edge \(\{v_0^i,v_\varDelta ^i\}\). Observe that, by construction, for any \(i\in [q]\), each vertex \(v_j^i\), with \(1\le j\le \varDelta -1\), has degree \(\varDelta\), while vertices \(v_0^i\) and \(v_\varDelta ^i\) have degree \(\varDelta -1\). We obtain G by connecting the q gadgets through edges \(\{v_\varDelta ^i,v_0^{i+1}\}\) for each \(i\in [q-1]\) and edge \(\{v_\varDelta ^q,v_0^1\}\). Call these edges extra-gadget edges. Thus, G is connected and \(\varDelta\)-regular. Consider now the local 2-SSG played on G in which there are \(\lceil \frac{\varDelta +1}{2}\rceil q\) blue agents and \(\lfloor \frac{\varDelta +1}{2}\rfloor q\) orange ones.

On the one hand, the social optimum is at least \(n-\frac{4}{\varDelta }=q(\varDelta +1)-4 \varDelta\), as in the strategy profile in which all vertices of the first \(\lceil \frac{\varDelta +1}{2}\rceil t\) gadgets are colored blue and all vertices of the remaining \(\lfloor \frac{\varDelta +1}{2}\rfloor t\) gadgets are colored orange, there are \(n-4\) vertices getting utility 1, and 4 vertices getting utility \(\frac{\varDelta -1}{\varDelta }\).

On the other hand, the strategy profile \({\varvec{\sigma }}\) in which the first \(\lceil \frac{\varDelta +1}{2}\rceil\) vertices of each gadget are colored blue and the remaining ones are colored orange is a swap equilibrium. In fact, as extra-gadget edges connect vertices of different colors, every blue vertex is adjacent to \(\lceil \frac{\varDelta +1}{2}\rceil -1\) blue ones, while every orange vertex is adjacent to \(\lceil \frac{\varDelta +1}{2}\rceil\) blue ones. If a blue vertex swaps with an adjacent orange one, it ends up being adjacent to \(\lceil \frac{\varDelta +1}{2}\rceil -1\) blue vertices. Thus, no profitable swap exists in \({\varvec{\sigma }}\).

As the social welfare of \({\varvec{\sigma }}\) is

$$\begin{aligned} \frac{q}{\varDelta }\left( \left\lceil \frac{\varDelta +1}{2}\right\rceil \left( \left\lceil \frac{\varDelta +1}{2}\right\rceil -1\right) +\left\lfloor \frac{\varDelta +1}{2}\right\rfloor \left( \left\lfloor \frac{\varDelta +1}{2}\right\rfloor -1\right) \right) \\ \quad = \left\{ \begin{array}{ll} \frac{q(\varDelta ^2-1)}{2\varDelta } \text { if}\, q\,{\text { is odd,}} \\ \frac{q\varDelta }{2} {\text { if }}\,q\,{\text { is even}}, \end{array}\right. \end{aligned}$$

we get that the LPoA of the game is lower bounded by \(\frac{2\varDelta (q(\varDelta +1)-4\varDelta )}{q(\varDelta ^2-1)}\) when \(\varDelta\) is odd and by \(\frac{2(q(\varDelta +1)-4\varDelta )}{q\varDelta }\) when \(\varDelta\) is even. By letting q going to infinity, we get \(\frac{2\varDelta }{\varDelta -1}\) and \(\frac{2(\varDelta +1)}{\varDelta }\), respectively. By using \(\varDelta =2\alpha +1\) in the first case, and \(\varDelta =2\alpha\) in the second one, we finally obtain the lower bound of \(2+\frac{1}{\alpha }\). \(\square\)

3.3 Paths and cycles

In this section we provide upper and lower bounds for the (L)PoA of paths and cycles. We first provide a full characterization of the PoA for cycles.

Theorem 12

The PoA of 2-SSGs played on cycles with \(n \ge 3\) vertices and \(o=2\alpha +\beta\) orange agents, where \(\alpha \in {{\mathbb {N}}}\), \(\beta \in \{0,1\}\), and \(b \ge o\), is equal to

$$\begin{aligned} {\text {PoA}} = {\left\{ \begin{array}{ll} 1 &{} {\text {if}}\, o=1;\\ \frac{n-2}{b+\beta } &{} \text {otherwise.}\\ \end{array}\right. } \end{aligned}$$

Proof

The social welfare of the social optimum is clearly equal to \(n-2\) and is attained when the cycle contains one path whose vertices are all occupied by the b blue agents and another path whose vertices are all occupied by the o orange agents. Now we prove matching upper and lower bounds for all the cases.

When \(o=1\) we clearly have that any strategy profile is a swap equilibrium because the unique orange agent always has a utility of 0, the two blue agents that occupy the vertices adjacent to the vertex occupied by the orange agent have a utility of \(\frac{1}{2}\) each, and the remaining \(b-2\) blue agents all have a utility of 1. Therefore, the social welfare is equal to \(n-2\), and the claim follows.

Let \({\varvec{\sigma }}\) be a swap equilibrium. Let \(\ell\) be the number of maximal vertex-induced (sub)paths whose vertices are occupied by orange agents only. Clearly, \(\ell\) is also the number of maximal vertex-induced (sub)paths whose vertices are occupied by blue agents only. We claim that \(\ell \le \alpha\) by showing that every agent has a strictly positive utility in \({\varvec{\sigma }}\) (i.e., each of the \(2\ell\) maximal paths formed by monochromatic edges contains 2 or more vertices). Indeed, for the sake of contradiction, assume without loss of generality that there is an orange agent i such that \(\mathsf{U}_i({\varvec{\sigma }})=0\). This implies that there must be a blue agent j that occupies a vertex v such that v is not adjacent to the vertex occupied by i and v is adjacent to a vertex occupied by an orange agent \(i'\ne i\). As a consequence, \(\mathsf{U}_j({\varvec{\sigma }})\le \frac{1}{2}\). In this case, swapping i with j would be an improving move since \(u_i({\varvec{\sigma }}_{ij}) > 0 = u_i({\varvec{\sigma }})\) and \(1=u_j({\varvec{\sigma }}_{ij})> \frac{1}{2} \ge u_j({\varvec{\sigma }})\), thus contradicting the fact that \({\varvec{\sigma }}\) is a swap equilibrium.

As a consequence the utility of \(2\ell\) orange agents is equal to \(\frac{1}{2}\), while the utility of the other \(o-2\ell =n-b-2\ell\) orange agents is equal to 1; similarly, the utility of \(2\ell\) blue agents is equal to \(\frac{1}{2}\), while the utility of the other \(b-2\ell\) blue agents is equal to 1. Therefore, the social cost is at least

$$\begin{aligned} \frac{1}{2}(2\ell +2\ell )+(n-b-2\ell )+(b-2\ell )=n-2\ell \ge n-2\alpha =b+\beta . \end{aligned}$$

The upper bound to the PoA follows.

For the matching lower bound, it is enough to consider the strategy profile in which \(\ell =\alpha\), i.e., there are \(\alpha -1\) maximal vertex-induced paths occupied by orange (respectively, blue) agents only of length 2 each, and one maximal vertex-induced path occupied by orange (respectively, blue) agents only of length \(2+\beta\) (respectively, \(b-2\alpha +2\)). In this case, the social welfare is exactly equal to

$$\begin{aligned} \frac{1}{2}2\alpha +\beta +\frac{1}{2}\alpha +(b-2\alpha )=b+\beta . \end{aligned}$$

\(\square\)

The following theorem provides almost tight upper bounds to the LPoA for cycles.

Theorem 13

The LPoA of local 2-SSGs played on cycles with \(n=3\alpha +\beta\) vertices and b blue agents, where \(\alpha \in {{\mathbb {N}}}\), \(\beta \in \{0,1,2\}\), and \(b \ge o\), is upper bounded by

$$\begin{aligned} {\text {PoA}} \le {\left\{ \begin{array}{ll} 1 &{} {\text {if}}\, o=1;\\ \frac{n-2}{b-o} &{} {\text {if}}\, o \ge 2\,{{\text { and }}}\,b \ge 2o;\\ \frac{n-2}{\alpha + \beta } &{} \text {otherwise}\, (\text {i.e.,}\, o \ge 2\,\text { and}\, b < 2o).\\ \end{array}\right. } \end{aligned}$$

The upper bounds are tight when (i) \(o=1\) and (ii) \(o\ge 2\) and \(b \ge 2o\).

Proof

The social welfare of the social optimum is equal to \(n-2\). Now, we prove matching upper and lower bounds for all cases.

When \(o=1\), any configuration is a (local) swap equilibrium; therefore the social welfare is equal to \(n-2\) and the claim follows.

Now, we consider the case in which \(o \ge 2\). Let \(o_h\) and \(b_h\) be the numbers of orange and blue agents having a utility equal to \(h \in \{0,\frac{1}{2},1\}\), respectively. Every configuration can be decomposed into maximal vertex-induced paths whose vertices are all occupied by agents of the same type. Furthermore, if \(\ell\) is the overall number of these maximal vertex-induced paths whose vertices are all occupied by orange agents, then \(\ell\) is also the overall number of maximal vertex-induced paths whose vertices are all occupied by blue agents. This implies that \(o_{\frac{1}{2}}=2(\ell - o_0)\) and \(b_{\frac{1}{2}}=2(\ell -b_0)\). Therefore, \(o=o_0+o_{\frac{1}{2}}+o_1=2\ell -o_0+o_1\) and \(b=b_0+b_{\frac{1}{2}}+b_1=2\ell -b_0+b_1\), i.e., \(o_1=o-2\ell +o_0\) and \(b_1=b-2\ell +b_0\). As a consequence, using the fact that \(b+o=n\), the social welfare is equal to \(\sum _{h \in \{0,\frac{1}{2},1\}}ho_h+\sum _{h \in \{0,\frac{1}{2},1\}}hb_h =\ell -o_0+o-2\ell +o_0 + \ell -b_0+b-2\ell +b_0 = n-2\ell .\) We observe that each orange agent of utility 0 occupies a vertex that is adjacent to two vertices occupied by blue agents having a utility of \(\frac{1}{2}\) each. As a consequence, \(b_{\frac{1}{2}}=2(\ell - b_0) \ge 2o_0\), or, equivalently, \(\ell \ge b_0+o_0\). Therefore, the social welfare is minimized exactly when \(\ell\) is maximized, as shown by the following ILP (where the second and third constraints are of the form \(o_0+o_{\frac{1}{2}}\le o\) and \(b_0+b_{\frac{1}{2}} \le b\), respectively):

$$\begin{aligned}&\text {maximize}&\ell \\&\text {subject to}&\quad&b_0+o_0 \le \ell \\&\quad&2\ell - o_0 \le o\\&\quad&2\ell - b_0 \le b\\&\quad&\ell , b_0,o_0 \in \mathbb {N}. \end{aligned}$$

Combining the first three inequalities, we obtain \(2\ell +2\ell \le o+o_0+b+b_0 \le n + \ell\), from which we derive \(\ell \le \lfloor \frac{n}{3} \rfloor = \alpha\). Furthermore, since \(o_0 \le \ell\), we have that \(\ell \le 2\ell - o_0 \le o\). Therefore, the value of an optimum solution is upper bounded by \(\ell =\min \{o, \alpha \}\). If \(b \ge 2o\), then setting \(\ell\), \(o_0=o\) and all other variables to 0 is an optimal solution. If \(b < 2o\), then setting \(\ell =\alpha\), \(o_0=2\alpha -o\), and \(b_0=2\alpha - b\) is an optimal solution. The upper bound to the LPoA follows.

For the matching lower bound when \(o\ge 2\) and \(b \ge 2o\), it is enough to consider the strategy profile in which \(\ell =o\), i.e., each orange agent occupies a vertex that is adjacent to vertices occupied by blue agents only. As a consequence, the o orange agents have a utility of 0, the 2o blue agents have a utility of \(\frac{1}{2}\) each, while the remaining \(b-2o=n-3o \ge 0\) blue agents have a utility of 1 each. The social welfare in this case is exactly equal to \(\frac{1}{2}2o+n-3o=n-2o=b-o\). \(\square\)

We now prove similar results for paths.

Theorem 14

The PoA of 2-SSGs played on paths with \(n \ge 3\) vertices and \(o=2\alpha +\beta\) orange agents, where \(\alpha \in {{\mathbb {N}}}\), \(\beta \in \{0,1\}\), and \(b \ge o\), is equal to

$${\text{PoA}} = \left\{ {\begin{array}{*{20}l} { + \;\infty } \hfill & {{\text{if}}{\mkern 1mu} n = 3;} \hfill \\ {\frac{{2n - 2}}{{2n - 5}}} \hfill & {{\text{if }}{\mkern 1mu} n > 3\;{\text{and}}\;o = 1;} \hfill \\ {\frac{{n - 1}}{{b + 1 + \beta }}} \hfill & {{\text{if}}\;n > 3,o \ge 2\;{\text{and}}\;b \le 2\alpha + 1;} \hfill \\ {\frac{{n - 1}}{{b + \beta }}} \hfill & {{\text{otherwise}}\;({\text{i.e.}}{\mkern 1mu} o \ge 2\;{\text{and}}\;b \ge 2\alpha + 2).} \hfill \\ \end{array} } \right.$$

Proof

For \(n\ge 4\), the social welfare of the social optimum is clearly equal to \(n-1\) and is attained when the path contains a subpath whose vertices are all occupied by the b blue agents and one subpath whose vertices are all occupied by the o orange agents. For \(n=3\), the social welfare of the social optimum is clearly equal to \(\frac{3}{2}\) and is attained when the orange agent occupies one endvertex of the path. Now, we prove matching upper and lower bounds for all the cases.

When \(o=1\), we clearly have that any strategy profile is a swap equilibrium. The strategy profile with minimum social welfare is when the orange agent occupies a vertex that is adjacent to an endvertex of the path. In this case, the blue agent that occupies such an endvertex has a utility of 0, the orange agent has a utility of 0, the other blue agent that is adjacent to the vertex occupied by the orange agent has a utility of 0, if \(n=3\), and of \(\frac{1}{2}\), if \(n\ge 4\), while all the other blue agents (if any) have a utility of 1 each. Therefore, for \(n=3\) the social welfare is 0, while for \(n\ge 4\), the social welfare is equal to \(n-\frac{5}{2}\), and the claim follows.

Therefore, we are only left to prove the bounds to the PoA when \(n > 3\) and \(o \ge 2\). Let \({\varvec{\sigma }}\) be a swap equilibrium. We first show that every agent has a strictly positive utility in \({\varvec{\sigma }}\). Indeed, for the sake of contradiction, assume without loss of generality that there is an orange agent i such that \(\mathsf{U}_i({\varvec{\sigma }})=0\). This implies that there must be a blue agent j that occupies a vertex v such that v is not adjacent to the vertex occupied by i and v is adjacent to a vertex occupied by an orange agent \(i'\ne i\). As a consequence, \(\mathsf{U}_j({\varvec{\sigma }})\le \frac{1}{2}\). In this case, swapping i with j would be an improving move since \(u_i({\varvec{\sigma }}_{ij}) > 0 = u_i({\varvec{\sigma }})\) and \(1=u_j({\varvec{\sigma }}_{ij})> \frac{1}{2} \ge u_j({\varvec{\sigma }})\), thus contradicting the fact that \({\varvec{\sigma }}\) is a local swap equilibrium.

Let \(\ell\) be the number of maximal vertex-induced (sub)paths whose vertices are all occupied by the orange agents. Since every orange agent has strictly positive utility, it follows that \(\ell \le \alpha\). Let x and y be the number of orange and blue agents that occupy the endvertices of the path, respectively. Clearly \(x+y=2\). Let \(\ell '\) be the number of maximal vertex-induced (sub)paths whose vertices are all occupied by the blue agents. We have that \(\ell ' \le \ell +1\). Furthermore, the utility of \(2\ell -x\) orange agents is \(\frac{1}{2}\) while the utility of the other \(o-2\ell +x\) orange agents is 1; similarly, the utility of \(2\ell '-y\) blue agents is \(\frac{1}{2}\), while the utility of the other \(b-2\ell '+y\) blue agents is 1. Therefore, the social welfare is at least

$$\begin{aligned} \frac{1}{2}(2\ell -x+2\ell '-y)+(o-2\ell +x)+(b-2\ell '+y)=n+\frac{1}{2}(x+y)-\ell -\ell ' \ge n+1-\ell -\ell '. \end{aligned}$$

If \(b \le 2 \alpha +1\), then \(\ell '\le \alpha\) and therefore \(n+1-\ell -\ell ' \ge n+1-2\alpha =b+1+\beta\).

If \(b \ge 2\alpha +2\), then \(\ell' \le \ell +1\) and therefore \(n+1-\ell -\ell' \ge n-2\alpha =b+\beta\).

For the matching lower bound, consider the strategy profile that induces \(\ell =\alpha\) maximal vertex-induced paths occupied by orange agents only and \(\ell '\) maximal vertex-induced paths that are occupied by blue agents only, where \(\ell '=\alpha\) if \(b \le 2\alpha +1\) and to \(\ell ' = \ell +1\) otherwise. In this case, the social welfare is exactly equal to \(b+1+\beta\) if \(b \le 2\alpha +1\) and \(b+\beta\), otherwise. \(\square\)

Theorem 15

The LPoA of local 2-SSGs played on paths with \(n=3\alpha +\beta\) vertices and b blue agents, where \(\alpha \in {{\mathbb {N}}}\), \(\beta \in \{0,1,2\}\), and \(b \ge o\), is upper bounded by

$$\begin{aligned} {{\text {PoA}}} \le {\left\{ \begin{array}{ll} +\infty &{} {\text {if}}\, n=3;\\ \frac{2n-2}{2n-5} &{} \text {if }\,n> 3\,{\text { and }}\,o=1;\\ \frac{n-1}{b-o-1} &{} \text {if }\,n> 3, o \ge 2, b \ge 2o;\\ \frac{n-1}{\alpha } &{} \text {otherwise} (\text {i}.\text{e}., n > 3, o \ge 2\,{\text { and }}\,b < 2o). \end{array}\right. } \end{aligned}$$

The upper bounds are tight when (i) \(n=3\), (ii) \(n > 3\) and \(o=1\), and (iii) \(n > 3\), \(o \ge 2\), \(b \ge 2o\).

Proof

As shown in Theorem 14, the social welfare of the social optimum is equal to \(n-1\). Furthermore, both, the upper and lower bounds to the PoA proved in Theorem 14 for \(n=3\) as well as for \(n>3\) and \(o=1\), also hold for the LPoA. Therefore, in the rest of the proof we assume that \(n\ge 4\) and \(o \ge 2\).

Let \(o_r\) and \(b_r\) be the numbers of orange and blue agents having a utility equal to \(r \in \{0,\frac{1}{2},1\}\), respectively. Let \(\ell\) (respectively, \(\ell '\)) be the overall number of maximal vertex-induced paths whose vertices are all occupied by orange (respectively, blue) agents. We observe that \(\ell -1 \le \ell ' \le \ell +1\). Let \(x_r\) (respectively, \(y_r\)) be the number of orange (respectively, blue) agents that occupy the endvertices of the path and whose utility is equal to \(r\in \{0,1\}\). We have that \(x_0+x_1+y_0+y_1 = 2\). Furthermore, we have that \(o_{\frac{1}{2}}=2(\ell - o_0)-x_1\) and \(b_{\frac{1}{2}}=2(\ell '-b_0)-y_1\). Therefore,

$$\begin{aligned} o=o_0+o_{\frac{1}{2}}+o_1=2\ell -o_0-x_1+o_1 \end{aligned}$$

and

$$\begin{aligned} b=b_0+b_{\frac{1}{2}}+b_1=2\ell '-b_0-y_1+b_1, \end{aligned}$$

i.e., \(o_1=o-2\ell +o_0+x_1\) and \(b_1=b-2\ell '+b_0+y_1\). As a consequence, the social welfare is equal to

$$\begin{aligned}&\sum _{h \in \{0,\frac{1}{2},1\}}hr_h+\sum _{h \in \{0,\frac{1}{2},1\}}hb_h \\&\quad = \ell -o_0-\frac{1}{2}x_1+o-2\ell +o_0+x_1 + \ell '-b_0-\frac{1}{2}y_1+ b-2\ell '+b_0+y_1 \\&\quad = n-\ell -\ell '+\frac{1}{2}x_1+\frac{1}{2}y_1. \end{aligned}$$

Now, observe that each orange (respectively, blue) agent that has a utility of 0 and occupies neither an endvertex of the path nor its adjacent vertex is adjacent to two blue (respectively, orange) agents of utility equal to \(\frac{1}{2}\) each. Therefore \(b_{\frac{1}{2}} = 2(\ell '-b_0)-y_1 \ge 2(o_0-x_0)\) as well as \(o_{\frac{1}{2}}=2(\ell - o_0)-x_1 \ge 2(b_0-y_0)\), or, equivalently, \(\ell ' \ge b_0+o_0-x_0+\frac{1}{2}y_1\) as well as \(\ell \ge b_0+o_0-y_0+\frac{1}{2}x_1\). Therefore, to minimize the social welfare we need to solve the following ILP.

$$\begin{aligned}&\text {maximize}&\ell +\ell '-\frac{1}{2}x_1-\frac{1}{2}y_1 \\&\text {subject to}&\quad&b_0+o_0-y_0+\frac{1}{2}x_1 \le \ell \\&\quad&b_0+o_0-x_0+\frac{1}{2}y_1 \le \ell '\\&\quad&2\ell -o_0-x_1 \le o\\&\quad&2\ell '-b_0-y_1 \le b\\&\quad&x_0+x_1+y_0+y_1 = 2\\&\quad&x_0 \le o_0\\&\quad&y_0 \le b_0\\&\quad&\ell ' \le \ell +1\\&\quad&\ell \le \ell '+1\\&\quad&\ell ,\ell ',x_0,x_1,y_0,y_1,b_0,o_0 \in \mathbb {N}. \end{aligned}$$

Combining the first 4 inequalities of the ILP we obtain

$$\begin{aligned} 2\ell +2\ell ' \le o+o_0+x_1+b+b_0+y_1 \le n + \frac{1}{2}\ell + \frac{1}{2}y_0 + \frac{3}{4}y_1 + \frac{1}{2}\ell ' + \frac{1}{2}x_0 + \frac{3}{4}x_1, \end{aligned}$$

from which we derive

$$\begin{aligned} \ell +\ell '-\frac{1}{2}(x_1+y_1) \le \frac{2}{3}n+\frac{1}{3}(x_0+y_0)=2\alpha +\frac{2}{3}\beta +\frac{2}{3}-\frac{1}{3}(x_1+y_1). \end{aligned}$$

By considering the constraints \(0 \le x_1+y_1 \le 2\) and the fact that \(x_1,y_1,\ell\) and \(\ell '\) are all non negative integers, it turns out that the above inequality is maximized exactly when \(x_1+y_1=0\) or, equivalently, \(x_1 = y_1=0\), and therefore, \(\ell +\ell ' \le \left\lfloor 2\alpha +\frac{2}{3}\beta +\frac{2}{3}\right\rfloor = 2\alpha +\beta\). Furthermore, combining the seventh inequality of the ILP with the first one, we obtain \(o_0 \le \ell\) and therefore, using the third inequality of the ILP, we obtain that \(\ell \le o\). Since the eighth inequality implies that \(\ell ' \le \ell +1 \le o+1\), we have that the value \(\ell +\ell ' \le 2o+1\). As a consequence the value of an optimum solution is upper bounded by

$$\begin{aligned} \min \left\{ 2o+1, 2\alpha +\beta \right\} . \end{aligned}$$

We now divide the proof into two cases:

  • Case 1 \(b\ge 2o\). Setting \(\ell\), \(o_0=o\), \(\ell '=o+1\), \(y_0,b_0=2\), and all the remaining variables to 0 gives an optimum solution for the ILP and the corresponding value of the objective function matches the upper bound of \(2o+1\). Therefore, the social welfare is at least \(n-2o-1=b-o-1\) and the upper bound to the LPoA follows. Furthermore, this upper bound is tight. Indeed, consider the strategy profile in which each orange agent occupies a vertex that is adjacent to two vertices occupied by blue agents only and two orange agents occupy the second and last but one vertex of the path (i.e., the two vertices adjacent to the path endvertices). Observe that there are exactly \(2(o-1)\) blue agents having a utility equal to \(\frac{1}{2}\) and 2 agents having a utility of 0 (thus \(b-2(o-1)-2\) agents having a utility of 1). The social welfare of this configuration is equal to \(\frac{1}{2}2(o-1)+(b-2(o-1)-2)=o-1+b-2o=b-o-1\).

  • Case 2 \(b < 2o\). The optimum value of the ILP is upper bounded by \(2\alpha +\beta\). Hence, the social welfare is at least \(n-2\alpha -\beta =\alpha\), and the upper bound to the LPoA follows. \(\square\)

3.4 Grids

We now turn our focus to grid graphs with 4- and 8-neighbors. Remember that grids are formed by a two-dimensional lattice. Hence, we can partition the vertices of an \(l \times h\) grid G into three setsFootnote 6: corner vertices, border vertices and middle vertices, denoted, respectively, as C(G), B(G), and M(G). We have \(C(G)=\{v_{i,j}:i\in \{1,\ell \}{\text { and }}j\in \{1,h\}\}\), \(B(G)=\{v_{i,j}:i\in \{1,\ell \}\text { or }j\in \{1,h\}\}\setminus C(G)\) and \(M(G)=V(G)\setminus (C(G)\cup B(G))\).

First, we focus on 2-SSGs in 4-grids and start by characterizing the PoA for the case in which one type has a unique representative.

Proposition 1

The PoA of 2-SSGs played on a 4-grid in which one type has cardinality 1 is equal to \(\frac{25}{22}\).

Proof

Assume, without loss of generality, that orange is the type with a unique representative. For this game, any strategy profile \({\varvec{\sigma }}\) is an equilibrium, since in any profile, the orange vertex o gets utility zero, the vertices not adjacent to o get utility 1, while all vertices adjacent to o get less than 1. Call these last vertices the penalized vertices. Thus, the PoA is maximized by comparing the social welfare of the strategy profile minimizing the overall loss of the penalized vertices with the one of the strategy profile maximizing it. It is easy to see that the overall loss of the penalized vertices is minimized when o is a corner vertices, while it is maximized when o is a border one in a 4-grid with \(l=2\) and \(h=3\). Comparing the two social welfares gives the claimed bound. \(\square\)

Clearly, if one type has only one representative, this agent will receive utility zero. However, this is not possible in equilibrium assignments when there are at least two agents of each type.

Lemma 5

In any equilibrium for a 2-SSG played on a 4-grid in which both types have cardinality larger than 1 all agents get positive utility.

Proof

Fix an equilibrium \({\varvec{\sigma }}\) for a game satisfying the premises of the lemma. Let i be a vertex such that \(\mathsf{U}_i({\varvec{\sigma }})=0\) and assume, without loss of generality, that i is orange. This implies that i is surrounded by blue vertices only.

Pick another orange vertex \(j\ne i\) which is adjacent to at least a blue one \(\ell\). If \(\ell \notin N_{\sigma (i)}\), it follows that i and \(\ell\) can perform a profitable swap contradicting the assumption that \({\varvec{\sigma }}\) is an equilibrium. Thus, \(\ell\) has to belong to \(N_{\sigma (i)}\). Let us now consider two cases.

If i occupies a corner vertex, \(\ell\) needs to be placed on a border one. So, as \(\ell\) is adjacent to i and j, it holds that \(\mathsf{U}_{\ell }({\varvec{\sigma }})\le \frac{1}{3}\). Thus, as we have \(\mathsf{U}_{\ell }({\varvec{\sigma }}_{i\ell })=\frac{1}{2}\) and \(\mathsf{U}_i({\varvec{\sigma }}_{i\ell })>0\), i and \(\ell\) can perform a profitable swap contradicting the assumption that \({\varvec{\sigma }}\) is an equilibrium.

If i is not located on a corner vertex, as \(\ell\) is adjacent to i and j, it holds that \(\mathsf{U}_{\ell }({\varvec{\sigma }})\le \frac{1}{2}\). Moreover, \(|N_{\sigma (i)}|\ge 3\) which yields \(\mathsf{U}_{\ell }({\varvec{\sigma }}_{i\ell })=\frac{|N_{\sigma (i)}|-1}{|N_{\sigma (i)}|}\ge \frac{2}{3}\). Thus, also in this case, i and \(\ell\) can perform a profitable swap contradicting the assumption that \({\varvec{\sigma }}\) is an equilibrium. \(\square\)

When no agent gets utility zero, the minimum possible utility is \(\frac{1}{4}\). Thus, Lemmas 1 and 5 together imply an upper bound of 4 on the PoA. However, a much better result can be shown.

Theorem 16

The PoA of 2-SSGs played on 4-grids is at most 2.

Proof

Without loss of generality, we consider an \(l \times h\) grid, with \(l \le h\). By Theorem 1, we only need to consider the case in which there are at least two agents per type. By Lemma 5, we know that, in this case, the utility of each agent is strictly positive. We prove the claim by showing that the average utility of an agent is at least \(\frac{1}{2}\). We divide the proof into two cases, depending on the utilities of the middle agents (i.e., agents occupying the middle vertices).

Case 1 In the first case, we assume that the utility of every middle agent is at least \(\frac{1}{2}\). As corner agents (i.e., agents occupying corner vertices) have a utility of at least \(\frac{1}{2}\) each, we only need to prove the claim when there is at least one border agent (i.e., an agent occupying a border vertex) whose utility is equal to \(\frac{1}{3}\). This implies that \(l+h\ge 5\). Without loss of generality, we assume that there are more orange than blue agents having a utility equal to \(\frac{1}{3}\). Let I be the border vertices occupied by the orange (border) agents having a utility of \(\frac{1}{3}\). As the overall number of border vertices is \(2(l-2)+2(h-2)=2l+2h-8\), we have that the number of border agents having a utility greater than or equal to \(\frac{2}{3}\) is at least \(2l+2h-8-2|I|\). Therefore, if \(|I|=1\) and \(l+h \ge 6\), then \(2l+2h-8-2|I| \ge 12-8-2=2\); hence, the average utility of an agent is greater than or equal to \(\frac{1}{2}\). If \(|I|=1\) and \(l+h=5\), then the only configuration in which a swap equilibrium exists, unless of symmetries, is shown in Fig. 16a.

Fig. 16
figure 16

The unique swap equilibrium for \(2\times 3\) 4-grids is shown in (a). Indeed, in (b) the blue agent in \(v_{1,1}\) can swap with the orange agent in \(v_{2,2}\), while in (c) the blue agent in \(v_{1,1}\) can swap with the orange agent in \(v_{1,2}\) (the question mark in \(v_{2,3}\) means that the vertex can be occupied by an agent of any type) (Color figure online)

We observe that, in such configuration, the average utility of an agent is strictly greater than \(\frac{1}{2}\). It remains to prove the case in which \(|I|\ge 2\). Since \({\varvec{\sigma }}\) is a swap equilibrium, the utility of a blue agent that occupies a vertex that is not adjacent to all the vertices in I is at least \(\frac{2}{3}\). As each blue agent occupies a vertex that is adjacent to at most 2 vertices in I and because each vertex in I is adjacent to exactly 2 vertices occupied by blue agents, the number of blue agents is at least \(2|I|/2 = |I|\). Therefore, if we assume that every blue agent has a utility of at least \(\frac{2}{3}\), then the average utility of an agent would be at least \(\frac{1}{2}\). We observe that this assumption holds when either (a) \(|I|\ge 3\) (because there is no blue agent occupying a vertex that is adjacent to all the vertices of I) or (b) \(|I|=2\) and the two vertices of I are either at t-hop distance from each other, with \(t\ge 2\), or they are are at 2-hop distance from each other and the utility of the border agent that occupies the vertex in between is at least \(\frac{2}{3}\). For the remaining case in which \(|I|=2\), the two vertices of I are at 2-hop distance from each other, and the agent occupying the border vertex in between is equal to \(\frac{1}{3}\) – and thus is of blue type – we simply observe that the overall number of blue agents is at least 4. Indeed, without loss of generality, let \(v_{1,x-1}\) and \(v_{1,x+1}\) be the two vertices of I. As \(v_{1,x}\) is occupied by a blue agent that has strictly positive utility, \(v_{2,x}\) is also occupied by a blue agent. Furthermore, either \(v_{1,x-2}\) or \(v_{2,x-1}\) is occupied by a blue agent. Similarly, either \(v_{1,x+2}\) or \(v_{2,x+1}\) is occupied by a blue agent. Therefore, there are at least 4 blue agents. Since 3 out of these 4 blue agents have a utility of at least \(\frac{2}{3}\), again, the average utility of an agent is at least \(\frac{1}{2}\).

Case 2 In the second case, we assume that there is at least an agent occupying a middle vertex and whose utility is equal to \(\frac{1}{4}\). Without loss of generality, we assume that there are more orange than blue agents having a utility equal to \(\frac{1}{4}\). Let I be the vertices of the orange agents having a utility of \(\frac{1}{4}\). We prove that

  1. (i)

    Every blue agent has a utility of at least \(\frac{1}{2}\);

  2. (ii)

    The number of blue agent having utility greater than or equal to \(\frac{3}{4}\) is at least |I|;

  3. (iii)

    All border and corner agents are of blue type.

This would clearly imply that the average utility of an agent is \(\frac{1}{2}\) since the utility of border and corner agents would be at least \(\frac{2}{3}\).

Let \(v_{x,y}\) be a vertex of I and, without loss of generality, we assume that \(v_{x,y-1},v_{x-1,y}\), and \(v_{x,y+1}\) are occupied by blue agents whose utilities are greater than or equal to \(\frac{1}{2}\). Similarly, we can prove that the utility of every other blue agent that occupies a vertex that is not adjacent to all vertices in I is at least \(\frac{3}{4}\). This implies that at least one vertex between \(v_{x-1,y-1}\) and \(v_{x-1,y+1}\) is occupied by a blue agent whose utility is greater than or equal to \(\frac{3}{4}\); similarly, at least one vertex between \(v_{x+1,y-1}\) and \(v_{x+1,y+1}\) is occupied by a blue agent whose utility is greater than or equal to \(\frac{3}{4}\). Therefore, we have proved (ii) for the case in which \(|I| \le 2\). To prove (ii) when \(|I| > 2\), it is enough to observe that all blue agents have a utility greater than or equal to \(\frac{3}{4}\) because none of them occupies a vertex that is adjacent to all the vertices in I. But this implies that each blue agent of utility of at least \(\frac{3}{4}\) occupies a vertex that is adjacent to at most one vertex in I. Hence, the overall number of blue agents is at least |I|.

We now conclude the proof by proving (iii). First of all, we prove that at least one border or corner vertex is occupied by a blue agent. For the sake of contradiction, we assume that all border and corner vertices are occupied by the orange agents. Let \(v_{x,y}\) be the topmost-leftmost vertex occupied by a blue agent, i.e., both \(v_{x,y-1}\) and \(v_{x-1,y}\) are occupied by orange agents and there is no other vertex \(v_{x',y'}\) occupied by a blue agent such that \(x' < x\) or \(x=x'\) and \(y'<y\). We observe that such a vertex always exists because x, \(y > 1\) and that \(v_{x-1,y-1}\) must be occupied by an orange agent. Furthermore, by the choice of \(v_{x,y}\), the utility of the two orange agents that occupy the vertices \(v_{x-1,y}\) and \(v_{x,y-1}\) must be at least \(\frac{1}{2}\). Since the utility of the blue agent occupying the vertex \(v_{x,y}\) has to be at least \(\frac{1}{2}\), \(v_{x+1,y}\) and \(v_{x,y+1}\) are occupied by blue agents. As a consequence, \(N_{v_{x,y}} \cap I = \emptyset\). Therefore, swapping the agent that occupies \(v_{x,y}\) with any agent occupying a vertex in I would be an improving move. Now that we know that at least one border or corner agent is of blue type, we prove that all of them must be of blue type. For the sake of contradiction assume that at least one border or corner vertex is occupied by an orange agent. Without loss of generality, let \(v_{1,y}\) be a vertex occupied by an orange agent such that \(v_{1,y+1}\) is occupied by a blue agent. Since the utility of such a blue agent is at least \(\frac{1}{2}\), the unique middle vertex adjacent to \(v_{1,y+1}\), i.e., \(v_{2,y+1}\), must be occupied by a blue agent. This implies that \(v_{1,y+1}\) cannot be adjacent to any vertex in I. As the utility of the agent occupying vertex \(v_{1,y+1}\) is at most \(\frac{2}{3}\), swapping the agent occupying the vertex \(v_{1,y+1}\) and any agent occupying a vertex in I would be an improving move. This completes the proof. \(\square\)

The following lemma gives a sufficient condition for a strategy profile to be an equilibrium.

Lemma 6

Fix a 2-SSG played on a 4-grid. Any strategy profile in which corner and middle vertices get utility at least \(\frac{1}{2}\) and border ones get utility at least \(\frac{2}{3}\) is an equilibrium.

Proof

For every two agents i and j of different types we have that the sum of their utilities is at least 1. Therefore, by Lemma 1, the considered strategy profile is an equilibrium. \(\square\)

We now show a matching lower bound.

Theorem 17

The PoA of 2-SSGs played on 4-grids is at least 2, even for balanced games.

Proof

Fix a 2-SSG played on an \(n\times n\) grid G, with n being an even number. We define a strategy profile \({\varvec{\sigma }}\) by giving a coloring rule for any frame of G. Clearly, being n an even number, there are \(\frac{n}{2}\) frames in G that we number from 1 to \(\frac{n}{2}\), with frame 1 corresponding to the outer one, i.e., the biggest. Frame i, whose size is \(n_i:=n-2(i-1)\), is colored as follows: all vertices in the right column except for the first and the last and all vertices in the left column are of the basic color of i, all other vertices (that are the ones on the upper and lower rows except for the vertices falling along the left column) take the other color. Observe that \(n_i+n_i-2=2(n_i-1)\) vertices take the basic color of i and \(2(n_i-1)\) vertices take the other one, so that every frame evenly splits its vertices between the two colors. Thus, \({\varvec{\sigma }}\) is a well-defined strategy profile for a 2-SSG with both types having the same cardinality. The basic color of frame i is orange if i is odd and blue otherwise, see Fig. 17 for a pictorial example. To show that \({\varvec{\sigma }}\) is an equilibrium, it suffices proving that it satisfies the premises of Lemma 6.

Fig. 17
figure 17

Visualization of the first three frames of G with the coloring induced by the strategy profile defined in the proof of Theorem 17

To address corner and border vertices, consider frame 1, see again Fig. 17. It comes by construction that every corner vertices gets utility \(\frac{1}{2}\) and that every border vertices gets utility at least \(\frac{2}{3}\), except for vertices (1, 2), (2, n), \((n-1,n)\) and (n, 2) for which further investigation is needed. In particular, they get utility \(\frac{2}{3}\) if and only if the following coloring holds: (2, 2) is blue, \((2,n-1)\) is orange, \((n-1,n-1)\) is orange and \((n-1,2)\) is blue. This holds by construction and can be verified by a direct inspection of Fig. 17.

To address middle vertices, it suffices proving that, any vertex belonging to frame \(i>1\) has two orange and two blue neighbors. Let c denote the basic color of frame i and \(\overline{c}\) be the other color. Consider a generic vertex v belonging to frame i. By inspecting all possible positions of v within the frame as shown in Fig. 18, it can be easily verified that the desired property holds.

By Lemma 6, \({\varvec{\sigma }}\) is an equilibrium. \(\square\)

Fig. 18
figure 18

Visualization of the neighborhood of vertices belonging to a frame \(i>1\). The target vertices are the ones included in the box. On the left, vertices belonging to the left column; on the right, vertices belonging to the right column; on the center, vertices belonging to a row but not to a column

We now show matching upper and lower bounds on the LPoA for local 2-SSGs played on grids. By inspecting all the possibilities, the LPoA of local 2-SSGs played on \(2\times 2\) grids is 1. Indeed, assuming \(b\ge o\), for \(o=1\), all the configurations are isomorphic to each other, while, for \(o=2\), the unique (local) swap equilibrium—up to isomorphisms—is \(\bigl [ {\begin{matrix} o &{} b \\ o &{} b \end{matrix}} \bigr ]\).

Proposition 2

The LPoA of local 2-SSGs played on \(2 \times h\) 4-grids, with \(h\ge 2\) is 3. Furthermore, for every \(\epsilon >0\), there is a value \(h_0\) such that, for every \(h \ge h_0\), the PoA of \(2\times h\) 4-grid is at least \(3-\epsilon\).

Proof

For the lower bound consider the strategy profile in which h is a multiple of 6, \(o=b\), odd columns are filled with orange agents, and even column are filled with blue agents (see Fig. 19a for an example on a \(2\times 6\) 4-grid). The strategy profile is a local swap equilibrium and the corresponding social welfare is equal to \(\frac{1}{3}(n-4)+2=\frac{n+2}{3}\). A social optimum having social welfare of \(n-\frac{4}{3}=\frac{3n-4}{3}\) is the strategy profile in which all the orange agents occupy the first \(\frac{h}{2}\) columns, and the blue agents occupy the last \(\frac{h}{2}\) columns (see Fig. 19b for an example on a \(2\times 6\) 4-grid). Therefore, for every \(h \ge \frac{5-\epsilon }{\epsilon }\), we have that the following formula is a lower bound to the LPoA

$$\begin{aligned} \frac{3n-4}{n+2}=3-\frac{10}{n+2} =3-\frac{5}{h+1}\ge 3 - \epsilon . \end{aligned}$$

To prove the upper bound of 3, we show that the average utility of an agent is at least \(\frac{1}{3}\). We consider only the agents that have a utility of 0 since all the other agents have a utility of at least \(\frac{1}{3}\) each. When h is equal to 2, the unique strategy profile (unless of symmetries) that is in local swap equilibrium and contains at least one agent that has 0 utility is depicted in Fig. 19c. However, it is easy to check that the average utility of an agent is \(\frac{1}{2}\). Therefore, we only need to prove the claim for \(h\ge 3\). We prove that if x is the number of agents whose utilities are equal to 0, then there are at least x agents that have a utility of at least \(\frac{2}{3}\) each. Indeed, let i be any agent that has a utility equal to 0. Since \({\varvec{\sigma }}\) is a local swap equilibrium and \(h\ge 3\), we have that there is an agent j such that (i) \(\sigma (j) \in N_{\sigma (i)}\), (ii) the type of i is different from the type of j, and (iii) \(\mathsf{U}_j({\varvec{\sigma }})\ge \frac{2}{3}\). Indeed, if i occupies a corner vertex, say v, then we can swap i with the agent occupying the unique border vertex adjacent to v, say u. Furthermore, since by Lemma 1 the utility of the agent occupying the corner vertex adjacent to v, say \(u'\), has a strictly positive utility, we have that the border agent adjacent to u is occupied by an agent of the same type of the two ones that occupy u and \(u'\). If i occupies a border vertex of the first (respectively, second) row, say v, then we can swap i with the agent j occupying the unique border vertex adjacent of the second (respectively, first) row that is adjacent to v. In either case, we are uniquely assigning an agent j that has a utility of at least \(\frac{2}{3}\) to every agent i that has a utility of 0. The claim follows. \(\square\)

Proposition 3

The LPoA of local 2-SSG played on \(3 \times h\) 4-grids, with \(h\ge 3\) is \(\frac{18}{7}\). Furthermore, for every \(\epsilon >0\), there is a value \(h_0\) such that, for every \(h \ge h_0\), the PoA of \(3\times h\) 4-grid is at least \(\frac{18}{7}-\epsilon\).

Fig. 19
figure 19

The local swap equilibrium with lowest social welfare is shown in (a) and the social optimum is shown in (b). c shows the unique local swap equilibrium which contains an agent with utility 0

Proof

For the lower bound of \(\frac{18}{7}-\epsilon\) consider the strategy profile in Fig. 20. The average utility of the agents that occupy any column from 2 to \(h-1\) is equal to \(\frac{7}{18}\).

Now, we prove the upper bound of \(\frac{18}{7}\). In the remainder of the proof, by utility of the r-th column we mean the overall utility of the agents that occupy the vertices of the r-th column. We show that the utility of the first (respectively, last) column is of at least \(\frac{5}{6}\) and we show that the average utility of the other columns is at least \(\frac{7}{6}\).

Fig. 20
figure 20

The strategy profile inducing an average agent’s utility that can be made arbitrarily close to \(\frac{7}{18}\) is shown on the left side via a small example (\(3 \times 9\) 4-grid). On the right side it is shown a strategy profile inducing an average agent’s utility arbitrarily close to 1

Fig. 21
figure 21

Case 2: In case the r-th column has utility \(\frac{13}{12}\), and therefore, a border agent has utility 0 (w.l.o.g. the upper orange one in the r-th column), the middle agent utility \(\frac{3}{4}\) and the the other border agent utility \(\frac{1}{3}\). Applying Lemma 1 yields that the right (respectively left) neighbor of the orange border agent with utility 0 has utility of at least \(\frac{2}{3}\) and is blue. Therefore, the right (left) neighbor of the middle agent has utility of at least \(\frac{1}{2}\). Again applying Lemma 1 yields that the right (respectively left) neighbor of the lower blue border agent has utility of at least \(\frac{1}{3}\). Summing up all utilities yields a utility of \(\frac{3}{2}\) for the \(r+t\)-th (respectively \(r-1\)-th) column (Color figure online)

First of all, using Lemma 1, we have that at most one of the agents that occupy the vertices of the r-th column can have a utility of 0. This observation implies that the utility of the r-th column, with \(r=1,h\), is lower bounded by \(\frac{5}{6}\).

Now, we show that in average the utility of the r-th column, with \(2 \le r \le h-1\), is of at least \(\frac{7}{6}\). We divide the proof into cases:

  • Case 1 We assume that the middle agent has a utility of 0. By Lemma 1, both border agents of the column have a utility of at least \(\frac{2}{3}\) and therefore, the utility of the r-th column is at least \(\frac{4}{3} \ge \frac{7}{6}\).

  • Case 2 We assume that a border agent has a utility of 0. This implies that the middle agent has a utility of \(\frac{3}{4}\) and the other border agent a utility of at least \(\frac{1}{3}\). Therefore, the utility of the r-th column is at least \(\frac{13}{12}\). In case that the column has utility \(\frac{13}{12}\), then the next column has utility at least \(\frac{3}{2}\) by applying Lemma 1, cf. Fig. 21. As a consequence, for column with utility \(\frac{13}{12}\) there is another column with utility \(\frac{3}{2}\), and the average utility is at least \(\frac{31}{24} \ge \frac{7}{6}\). Otherwise, if the column has utility of at least \(\frac{17}{12} \ge \frac{7}{6}\).

  • Case 3 We assume that all agents that occupy the vertices of the r-th column have a strictly positive utility. We observe that the only interesting case to look at is when the border agents both have a utility of \(\frac{1}{3}\) and the middle agent has a utility of \(\frac{1}{4}\), as in all the other cases, the utility of the r-th column would be greater than or equal to \(\frac{7}{6}\). However, by Lemma 1 this case cannot occur since at least one border agents has the opposite color than the middle agent (who has utility \(\frac{1}{4}\)) and they will swap.

This completes the proof. \(\square\)

Theorem 18

For every \(\epsilon > 0\), the LPoA of local 2-SSG played on \(l \times h\) 4-grids, with \(\ell ,h \ge 8+\frac{20}{\epsilon }\) is in the interval \(\left( \frac{5}{2}-\epsilon ,\frac{5}{2}+\epsilon \right]\).

Proof

Let X be the set of middle vertices that are adjacent neither to border nor to corner vertices. Clearly, \(N_X=\bigcup _{v \in X} N_v\) is the set of all the middle vertices. Therefore, the degree of each vertex \(v \in N_X\) is equal to 4. Let \(Z \subseteq N_X\) be the set of vertices occupied by agents that have a utility strictly greater than \(\frac{2}{5}\). From Lemma 4, we have that the average utility of the agents in \(X \cup Z\) is at least \(\frac{2}{5}\).

As a consequence, the social welfare is lower bounded by \(\frac{2}{5}|X\cup Z| \ge \frac{2}{5}(l-4)(h-4)>\frac{2}{5}l h-\frac{8}{5}(l+h)\). Therefore, the LPoA can be upper bounded by

$$\begin{aligned} \frac{l h}{\frac{2}{5}l h-\frac{8}{5}(l +h)} =\frac{1}{\frac{2}{5}-\frac{8}{5}\frac{l+h}{l h}}\le \frac{1}{\frac{2}{5}-\frac{8}{5}\frac{2(8+20/\epsilon )}{(8+20/\epsilon )^2}}=\frac{5}{2}+\epsilon . \end{aligned}$$

For the lower bound, consider the \(l \times h\) grid, with \(l = 5 l'+1\) and \(h=5h'\), that is filled as shown in Fig. 22. The social welfare for arbitrarily large values of \(l'\) and \(h'\) (i.e., l and h) can be made arbitrarily close to the average utility of the agents that occupy the vertices of the tiles labeled with T. Observe that \(\frac{2}{5}\) is the average utility of the agents that occupy all the vertices of any tile labeled with T. As the ratio between blue and orange agents can be made arbitrarily close to \(\frac{3}{2}\), the maximum average utility of an agent is arbitrarily close to 1 by placing the orange agents over the vertices of the first \(\frac{2}{5} h\) columns and the blue agents in the remaining \(\frac{3}{5} h\) columns. Therefore, the LPoA is lower bounded by \(\frac{5}{2}-\epsilon\). \(\square\)

We now turn our focus to the 8-grid and prove upper bounds to the LPoA.

Proposition 4

The PoA of 2-SSGs played on an 8-grid in which one type has cardinality 1 is equal to \(\frac{897}{704}\).

Proof

Assume, without loss of generality, that orange is the type with a unique representative. For this game, any strategy profile \({\varvec{\sigma }}\) is an equilibrium, since in any profile \({\varvec{\sigma }}\) the orange vertex o gets utility zero, the vertices not adjacent get utility 1, while all vertices adjacent to o get strictly less than 1. Call these last vertices the penalized vertices. Thus, the PoA is maximized by comparing the social welfare of the strategy profile minimizing the overall loss of the penalized vertices with the one of the strategy profile maximizing it. The overall loss of the penalized vertices is minimized when o is a corner vertex, while it is maximized when o is a middle one on an 8-grid with \(l = h = 3\). Comparing the two social welfares gives the claimed bound. \(\square\)

Fig. 22
figure 22

The strategy profile inducing an average agent’s utility arbitrarily close to \(\frac{2}{5}\) is shown on the left side via a small example over an \(11\times 10\) 4-grid. On the right side, the tiling showing the pattern we have used for building the instance. The tiles \(T_c\) and \(T_c'\) are only used in order to fill the bottom-left and bottom-right corners of the 4-grid. Observe that using exactly the same tiles, one can build arbitrarily large instances. Moreover, for arbitrarily large instances, the average utility of an agent is basically determined by the average utility of the agents that occupy the vertices of any tile T, i.e., \(\frac{2}{5}\)

Theorem 19

The LPoA of 2-SSGs played on an 8-grid is at most 4.

Proof

Let i be an agent of utility strictly less than \(\frac{1}{4}\) and let j be an agent of type different from the one of i that occupies a vertex, say v, that is adjacent to the one occupied by i, say u. By Lemma 1 the sum of the utilities of agent i and j is at least \(1-\frac{1}{3}=\frac{2}{3}\) if either u or v is a corner vertex and at least \(1-\frac{1}{5}=\frac{4}{5}\) in any other case.

Now observe that \(N_v\setminus \{u\}\) is occupied by at most one agent of the same type of i, say \(i'\), but only if neither u nor v is a corner vertex; in any other case, \(N_v\setminus \{u\}\) is occupied by agents of the same type of j except for the unique vertex of \(N_v\) occupied by i. As a consequence, if either u or v is a corner vertex then the average utility of i and j is greater than or equal to \(\frac{1}{3}\); in the other cases the average utility of i, j and the potential agent \(i'\) of the same type of i that occupies a vertex in \(N_v \setminus \{u\}\) is at least \(\frac{4}{15}>\frac{1}{4}\). In either case, the average utility of the considered agents is at least \(\frac{1}{4}\). As we are assigning j to the unique agents of different types of j that occupy vertices in \(N_v\), we have that the average utility of an agent is greater than or equal to \(\frac{1}{4}\). This completes the proof. \(\square\)

We conclude by proving a much better bound for the (L)PoA, if the 8-grid is large enough.

Proposition 5

For every \(\epsilon > 0\), the LPoA of local 2-SSGs played on an \(l \times h\) 8-grid, with \(l,h \ge 8+\frac{18}{\epsilon }\) is at most \(\frac{9}{4}+\epsilon\).

Proof

Let X be the set of middle vertices that are adjacent neither to border nor to corner vertices. Clearly, \(N_X=\bigcup _{v \in X} N_v\) is the set of all the middle vertices. Therefore, the degree of each vertex \(v \in N_X\) is equal to 8. Let \(Z \subseteq N_X\) be the set of vertices occupied by agents that have a utility strictly greater than \(\frac{4}{9}\). From Lemma 4, we have that the average utility of the agents in \(X \cup Z\) is at least \(\frac{4}{9}\). As a consequence, the social welfare is lower bounded by \(\frac{4}{9}|X\cup Z| \ge \frac{4}{9}(l-4)(h-4)>\frac{4}{9}l h-\frac{16}{9}(l + h)\). Therefore, the LPoA is at most

$$\begin{aligned} \frac{l h}{\frac{4}{9}l h-\frac{16}{9}(l +h)} =\frac{1}{\frac{4}{9}-\frac{16}{9}\frac{l+h}{l h}}\le \frac{1}{\frac{4}{9}-\frac{16}{9}\frac{2(8+18/\epsilon )}{(8+18/\epsilon )^2}}=\frac{9}{4}+\epsilon . \end{aligned}$$

\(\square\)

4 Price of stability

Although our work is mainly devoted to the characterization of the Price of Anarchy in (local) Swap Schelling Games, some results for the Price of Stability can be derived as a by-product of our analysis. The Price of Stability (PoS) [3] for games with k types played on a family of graphs \({{\mathcal {G}}}\) is defined as

$$\begin{aligned} \text {PoS}({{{\mathcal {G}}}},k)=\max _{G\in {{{\mathcal {G}}}}}\max _{\mathbf{t}\in {{{\mathcal {T}}}}_k(G)}\frac{\mathsf{U}({\varvec{\sigma }}^*(G,\mathbf{t}))}{\max _{{\varvec{\sigma }}\in SE(G,\mathbf{t})}\mathsf{U}({\varvec{\sigma }})} \end{aligned}$$

and is thus the best-case equivalent of the Price of Anarchy. We define the Local Price of Stability (LPoS) similar to the LPoA by replacing the set of swap equilibria with that of local swap equilibria. In this case, as the set of local swap equilibria of a game is a superset of that of its swap equilibria, it follows that \(\text {LPoS}({{{\mathcal {G}}}},k)\le \text {PoS}({{{\mathcal {G}}}},k)\) for any class of graphs \({{\mathcal {G}}}\) and integer \(k\ge 2\).

The characterization of the (L)PoS is much more challenging than that of the (L)PoA, and very few results are known in this setting within the realm of Swap Schelling Games. In particular, Agarwal et al. [1] show that \(\text {PoS}({{{\mathcal {G}}}},2)\ge \frac{4}{3}\) when \({{\mathcal {G}}}\) is the class of trees and \(\text {PoS}({{{\mathcal {G}}}},k)=1\), for any \(k\ge 2\), when \({{\mathcal {G}}}\) is the class of regular graphs. The last result is shown by means of the potential method, which leverages the existence of a potential function for games played on regular graphs. In the same spirit, we can exploit Theorem 1 to obtain a significant upper bound on the PoS for games played on almost regular graphs.

Theorem 20

For any \(k\ge 2\), \(\text {PoS}({{{\mathcal {G}}}},k)\le \frac{\varDelta }{\delta }=\frac{\delta +1}{\delta }\) when \({{\mathcal {G}}}\) is the class of almost regular graphs.

Proof

For any \(k\ge 2\), fix a k-SSG \((G,\mathbf{t})\) defined on an almost-regular graph of minimum degree \(\delta\) (so that, the maximum degree is \(\varDelta =\delta +1\)). Observe that, for any feasible strategy profile \({\varvec{\sigma }}\), it holds that

$$\begin{aligned} \mathsf{U}({\varvec{\sigma }})\ge \frac{2\varPhi ({\varvec{\sigma }})}{\delta +1} \end{aligned}$$
(11)

and

$$\begin{aligned} \mathsf{U}({\varvec{\sigma }})\le \frac{2\varPhi ({\varvec{\sigma }})}{\delta }. \end{aligned}$$
(12)

Let \(\overline{{\varvec{\sigma }}}\) be a feasible strategy profile maximizing \(\varPhi\). By Theorem 1, we know that \(\varPhi\) is a potential for \((G,\mathbf{t})\). This implies that \(\overline{{\varvec{\sigma }}}\) is a swap equilibrium and

$$\begin{aligned} \varPhi ({\varvec{\sigma }}^*)\le \varPhi (\overline{{\varvec{\sigma }}}), \end{aligned}$$
(13)

where \({\varvec{\sigma }}^*\) is a short-hand for \({\varvec{\sigma }}^*(G,\mathbf{t})\) Thus, the Price of Stability of \((G,\mathbf{t})\), denoted \(\text {PoS}(G,\mathbf{t})\), is upper bounded by \(\frac{\mathsf{U}({\varvec{\sigma }}^*)}{\mathsf{U}(\overline{{\varvec{\sigma }}})}\). Putting everything together, we get

$$\begin{aligned} \text {PoS}(G,\mathbf{t})\le \frac{\mathsf{U}({\varvec{\sigma }}^*)}{\mathsf{U}(\overline{{\varvec{\sigma }}})}\le \frac{\frac{2\varPhi ({\varvec{\sigma }}^*)}{\delta }}{\frac{2\varPhi (\overline{{\varvec{\sigma }}})}{\delta +1}}\le \frac{\frac{2\varPhi (\overline{{\varvec{\sigma }}})}{\delta }}{\frac{2\varPhi (\overline{{\varvec{\sigma }}})}{\delta +1}}=\frac{\delta +1}{\delta }, \end{aligned}$$

where the second inequality comes from both (11) and (12) and the third inequality comes from (13).\(\square\)

We observe that the proof of Theorem 20 can be generalized to any game for which the global maximum of \(\varPhi\) is a swap equilibrium, so as to produce an upper bound of \(\frac{\varDelta }{\delta }\) on the PoS. As Corollary 1, claiming that games played on 4-grids possess the FIP, is proved by showing that a global maximum of \(\varPhi\) is a swap equilibrium, we immediately get an upper bound of 2 on the PoS which, however, does not improve on the upper bound on the PoA shown in Theorem 16. However, by refining the proof of Theorem 20, an upper bound of \(\frac{3}{2}\) can be derived.

Theorem 21

For any \(k\ge 2\), \(\text {PoS}({{{\mathcal {G}}}},k)\le \frac{3}{2}\) when \({{\mathcal {G}}}\) is the class of 4-grids.

Proof

Fix a 4-grid \(G=(V,E)\). Let \(E_1\subseteq E\) be the set of edges which are incident to a corner vertex of G, that is, to one of the 4 vertices of degree 2. With respect to partition \((E_1,E\setminus E_1)\) of E, we can refine the definition of \(\varPhi\) so as to be equal to the number of monochromatic edges in \(E_1\) plus the number of monochromatic edges in \(E\setminus E_1\). So, for each \({\varvec{\sigma }}\), define \(\varPhi ({\varvec{\sigma }}):=\varPhi _{E_1}({\varvec{\sigma }})+\varPhi _{E\setminus E_i}({\varvec{\sigma }})\). Observing that the degree of every vertex incident to an edge in \(E_1\) is either 2 or 3 and the degree of every vertex incident to an edge in \(E\setminus E_1\) is either 3 or 4, inequalities (11) and (12) rewrite as

$$\begin{aligned} \mathsf{U}({\varvec{\sigma }})\ge \frac{2\varPhi _{E_1}({\varvec{\sigma }})}{3}+\frac{2\varPhi _{E\setminus E_1}({\varvec{\sigma }})}{4} \end{aligned}$$
(14)

and

$$\begin{aligned} \mathsf{U}({\varvec{\sigma }})\le \frac{2\varPhi _{E_1}({\varvec{\sigma }})}{2}+\frac{2\varPhi _{E\setminus E_1}({\varvec{\sigma }})}{3}. \end{aligned}$$
(15)

By using these inequalities in place of (11) and (12) within the final derivation in the proof of Theorem 20, we get the desired bound.\(\square\)

In Theorem 4, we show that local games with two types played on 8-grids have the FIP. This is achieved by proving that function \(\varPsi\) is a potential for these games, which implies that the global maximum of \(\varPhi\) is a local swap equilibrium. Hence, the same approach of Theorem 21 can be adopted to obtain an upper bound of \(\frac{5}{3}\) on the local Price of Stability.

Proposition 6

\(\text {LPoS}({{{\mathcal {G}}}},2)\le \frac{5}{3}\) when \({{\mathcal {G}}}\) is the class of 8-grids.

Moreover, by using the algorithmic construction used to show Theorem 6, we can derive an upper bound of 5/2 which holds even for the Price of Stability and rapidly approaches 1 as both dimensions of the grid increase.

Theorem 22

\(\text {PoS}({{{\mathcal {G}}}},2)\le \frac{5}{2}\) when \({{\mathcal {G}}}\) is the class of 8-grids.

Proof

Observe that, when \(o\ge 2h-1\), we show in the proof of Theorem 6 that the computed swap equilibrium \({\varvec{\sigma }}\) is such that, for each \(i\in [n]\), either \(\mathsf{U}_i({\varvec{\sigma }})=1\) or \(\mathsf{U}_i({\varvec{\sigma }})\ge \frac{2}{5}\). This immediately implies an upper bound of \(\frac{5}{2}\) of the PoS. Similarly, for the case in which \(o<2h-1\), the computed swap equilibrium \({\varvec{\sigma }}\) is such that the minimum utility of any player is at least \(\frac{2}{5}\), see Fig. 14, which gives an upper bound of \(\frac{5}{2}\) on the PoS also in this case.\(\square\)

Corollary 6

For any game with 2 types played on an 8-grid, the PoS (and so also the LPoS) approaches 1 as both dimensions of the grid increase.

Proof

When \(o\ge 2h-1\), observe that the number of agents whose utility is not 1 is at most \(2(h+1)\), see Fig. 11. As there are \(n=\ell h\) agents in total, and at most \(2(h+1)\) of them lose at most \(\frac{3}{5}\) over their possible maximum utility (which equals 1), it follows that the PoS is upper bounded by \(\frac{\ell h}{\ell h-\frac{3}{5}\cdot 2(h+1)}\). This function approaches 1 when both h and \(\ell\) increase. When \(o< 2h-1\), the number of agents whose utility is not 1 can be upper bounded by \(2(\ell +h)\), see Fig. 14. Thus, the PoS is upper bounded by \(\frac{\ell h}{\ell h-\frac{3}{5}\cdot 2(h+\ell )}\). Also this function approaches 1 when both h and \(\ell\) increase. \(\square\)

Finally, it can be tempting to use the local swap equilibrium computed in Theorem 3 to upper bound the LPoS in games played on trees. However, it is easy to show that the constructed local swap equilibrium may have an arbitrarily bad performance. In fact, consider a game with 3 types such that \(\mathbf{t}=(t_1,t_2,1)\) played on a tree whose root r has \(t_2\) children and one of these children, say u, has \(t_1\) children. Our algorithm assigns all agents of type 1 to the children of u, all agents of type 2 to the children of r and the unique agent of type 3 to r. This is a local swap equilibrium \({\varvec{\sigma }}\) such that \(\mathsf{U}({\varvec{\sigma }})=0\). As there is a feasible strategy profile \({\varvec{\sigma }}^*\) such that \(\mathsf{U}({\varvec{\sigma }}^*)>0\), the ratio between \(\mathsf{U}({\varvec{\sigma }}^*)\) and \(\mathsf{U}({\varvec{\sigma }})\) is unbounded.

5 Conclusion and open problems

We have shed light on the influence of the underlying graph topology on the existence of equilibria, the game dynamics and the Price of Anarchy in Swap Schelling Games on graphs. Moreover, we have studied the impact of restricting agents to local swaps. We present tight or almost tight bounds for a variety of graph classes and for both the Swap Schelling Game and its local variant, where only swaps between neighboring agents are allowed.

As main take-away from our paper we find that both the specific structure of the underlying graph and restriction to only local swaps strongly influence the existence and the quality of equilibria. Regarding the existence of equilibria, we find that for the Swap Schelling Game existence is guaranteed on all investigated graph classes, with the exception of trees, as proven earlier by Agarwal et al. [1]. Interestingly, by enforcing only local swaps, and thereby strictly enlarging the set of equilibria, we also have equilibrium existence on trees. Moreover, as our bounds on the Price of Anarchy indicate, see Table 2 for a condensed overview of the asymptotic bounds, the quality of the equilibrium states deteriorates only slightly when enforcing local swaps. For deriving these bounds in the Price of Anarchy, we introduce novel techniques that are based on matchings. We believe that this approach might be advantageous for future research on the quality of equilibria in Schelling games.

Table 2 Asymptotic Price of Anarchy results

Clearly, improving on the non-tight bounds is an interesting challenge for future work. Regarding the local Swap Schelling Game, we leave some interesting problems open. Among them is the question of whether local swap equilibria are guaranteed to exist for all graph classes and if the local k-SSG always has the finite improvement property. So far, we are not aware of any counter-examples for both questions and extensive agent-based simulations indicate that both equilibrium existence and guaranteed convergence of improving response dynamics may hold. Another open problem is that of understanding whether the FIP holds for tree instances when we consider local swap equilibria. This result would create a sharp contrast between the concepts of swap equilibrium and local swap equilibrium as we know of the existence of a tree instance that does not admit a swap equilibrium (and thus, cannot satisfy the FIP) [1].

Another interesting line of study is to analyze the Jump Schelling Game with respect to varying underlying graphs and locality.