1 Introduction
In 2015, African Americans constituted 83% of the population of the City of Detroit. At the same time, the neighboring Oakland County was 77% white, and in the city of Dearborn in Detroit metropolitan area about 30% of the residents were Arab Americans. Similar phenomena can be observed in many other major metropolitan areas around the world. In the developed world, the leading cause of such population patterns is not direct discrimination, which is typically illegal; rather, it is the residents themselves who tend to select neighborhoods where their ethnic or social group is wellrepresented. Schelling (1969, 1971) proposed the following stylized model of this phenomenon: Agents of two different types are placed on a line or on a grid, and are assumed to be happy if at least a fraction of the agents within distance from them are of the same type, for some parameters and ; unhappy agents can either jump to empty positions or swap positions with other agents. Using simple experiments, Schelling showed that, even in cases where the agents are not opposed to integration (), this behavior leads to almost complete segregation.
In the 50 years since Schelling’s pioneering paper, this segregation model attracted the attention of many researchers, mostly in sociology and economics (Alba and Logan, 1993; Benard and Willer, 2007; Benenson et al., 2009; Clark and Fossett, 2008; Pancs and Vriend, 2007; Young, 2001; Zhang, 2004a, b), but recently also in computer science (Barmpalias et al., 2014, 2015; Brandt et al., 2012; Immorlica et al., 2017). While the early work in this area was mainly empirical, the more recent papers have provided theoretical analysis. In particular, it was proved that the local behavior of unhappy agents is likely to create very large regions consisting of agents of the same type, even when is small, i.e., even when the agents themselves are tolerant towards having neighbors of the other type. The vast majority of this work was based on Schelling’s original model, where agents’ behavior was explained by a simple stochastic model rather than strategic considerations.
An alternative approach is to assume that the behavior of each agent is strategic
, and exploit tools and techniques from noncooperative game theory to analyze the induced games. To the best of our knowledge, there are only two papers in the literature that pursue this agenda. Specifically,
Zhang (2004b) considered a model with transferable utility where agents prefer to be in a balanced neighborhood. More recently, Chauhan et al. (2018) investigated a setting that is closer to Schelling’s motivating scenario, and also incorporates the idea that, in addition to preferences over the composition of their neighborhood, agents may also have preferences over locations. In the model of Chauhan et al. (2018), there are two types of agents, and an agent ’s happiness ratio is defined as the fraction of agents of ’s type among ’s neighbors. Each agent has two further parameters: a tolerance threshold and a preferred location. An agent’s primary goal is to find a location where her happiness ratio exceeds the tolerance threshold; if no such location is available, she aims to maximize her happiness ratio. An agent’s secondary goal is to minimize the distance to her preferred location. To achieve these goals, agents can either swap locations (swap games) or jump to unoccupied locations (jump games). The main contribution of the paper is to identify conditions under which agents are guaranteed to converge to an equilibrium; for instance, the authors establish that in jump games, convergence is guaranteed if agents have no preferred locations and the underlying network is a ring.1.1 Our contribution
The model of Chauhan et al. (2018) makes an important contribution to the literature by enriching Schelling’s model with two additional components: agents who are fully strategic, and location preferences. However, the resulting model of agents’ preferences is quite complex, and, consequently, not easy to analyze: the positive results in the paper are limited to special cases of the utility function and highly regular networks. In this paper, we propose a simpler model that aims to capture the same phenomena and is more amenable to formal analysis.
Specifically, just as in the work of Chauhan et al. (2018), in our basic model the agents are partitioned into types and the set of available locations is represented by an undirected graph, which we will refer to as the topology. We also incorporate location preferences in our model; however, instead of assuming that optimizing the distance to the preferred location is the secondary goal of every agent, we assume that agents are either stubborn, in which case they stay at their chosen location irrespective of their surroundings, or strategic, in which case they aim to maximize their happiness ratio by jumping to an unoccupied location (we do not consider swaps in this paper). Our model captures the fact that, in practice, many residents are unwilling to move to another area even if they are no longer satisfied with the composition of their neighborhood. Importantly, unlike Chauhan et al. (2018) or Schelling in his original work, we do not assume that agents have tolerance thresholds; rather, a strategic agent is willing to move as long as there exists another location with a better happiness ratio. Towards the end of the paper (Section 6), we also discuss several variants of this basic model. In particular, we show that some of our positive results extend to the setting where there are no types, but rather the agents are connected by a social network and care about the fraction of their friends (i.e., their neighbors in the social network) among their neighbors in the topology; we refer to the resulting class of games as social Schelling games.
The rest of the paper is organized as follows. We define our model in Section 2. Then, in Section 3, we show that for some classes of topologies, such as stars and graphs of maximum degree two, our games always admit a pure Nash equilibrium, i.e., the strategic agents can be assigned to the nodes of the topology so that none of them wants to move to a different location; this result holds even for social Schelling games. In contrast, an equilibrium may fail to exist even if the topology is acyclic and has maximum degree four. In Section 4, we complement this result by presenting a dynamic programming algorithm that decides whether an equilibrium exists on a tree topology; this algorithm runs in polynomial time if the number of types is bounded by a constant. For more general topologies, we prove that deciding whether an equilibrium exists is an NPcomplete problem. Similar hardness and easiness results hold for the problem of maximizing the social welfare (the total utility of all strategic agents). In Section 5, we study the effect of the strategic behavior on the social welfare, by bounding the price of anarchy (Koutsoupias and Papadimitriou, 1999) and the price of stability (Anshelevich et al., 2008). In particular, we show that even in the absence of stubborn agents it may be impossible to achieve the maximum social welfare in equilibrium. In Section 6 we discuss several variants and extensions of our model and establish some preliminary results for these new models, as well as outline directions for future work.
1.2 Other related work
For an accessible introduction to the Schelling model and a the survey of the literature on nonstrategic variants, see chapter 4 in the book of Easley and Kleinberg (2010), and the papers by Brandt et al. (2012) and Immorlica et al. (2017).
Besides the work of Chauhan et al. (2018), which was discussed in detail earlier, our model shares a number of properties with hedonic games (Drèze and Greenberg, 1980; Bogomolnaia and Jackson, 2002); these are games where agents split into coalitions, and each agent’s utility is determined by the composition of her coalition. Specifically, in fractional hedonic games (Aziz et al., 2014) the relationships among the agents are described by a weighted directed graph, where the weight of an edge is the value that agent assigns to agent , and an agent’s utility for a coalition is her average value for the other members in the coalition. If the graph is undirected and all edge weights take values in , it can be interpreted as a friendship relation; then an agent’s utility in a coalition is computed as the fraction of her friends among the coalition members, which is very similar to how utilities are defined in social Schelling games. On the other hand, the typebased model is closely related to the Bakers and Millers game discussed by Aziz et al. (2014). This connection between Schelling games and hedonic games motivates much of the discussion in Section 6. Of course, a fundamental difference between hedonic games and our setting is that in the former agents derive their utilities from pairwise disjoint coalitions, whereas in our model utilities are derived from (overlapping) neighborhoods.
2 The Model
Let be a set of agents. The agents are partitioned into different types so that ; we write . We say that two agents , , are friends if for some ; otherwise we say that and are enemies. For each , we denote the set of all friends of agent by .
A topology is an undirected graph with no selfloops. Each agent in
has to select a node of this graph so that there are no collisions. The agents are classified as either
strategic or stubborn; let and denote these sets of agents so that . Stubborn agents care about their location only: each stubborn agent has a preferred node and never moves away from that node. Thus, the preferences of stubborn agents can be described by an injective mapping ; for each the node is the preferred node of agent . In contrast, strategic agents do not care about their location, but want to be in a neighborhood that has a large proportion of their friends, and are willing to move to a currently unoccupied node in order to increase their utility.Formally, given a set of agents with , a topology with and a mapping , an assignment
is a vector
such that (1) for each and (2) for all such that ; here, is the node of the topology where agent is positioned. A node is occupied by agent if . For a given assignment and an agent , let be the set of neighbors of agent . Let be the number of neighbors of in who are her friends. Similarly, let be the number of neighbors of in who are her enemies. Following Chauhan et al. (2018), we define the utility of an agent in to be if ; otherwise, her utility is defined as the fraction of her friends among the agents in the neighborhood:A tuple , where is the set of strategic agents, is the set of stubborn agents, is a list of types, is a topology that satisfies , and is an injective mapping from to , is called a typed Schelling game or typed instance; let be the set of all possible games. We say that an assignment is a pure Nash equilibrium (or, simply, equilibrium) of if no strategic agent has an incentive to unilaterally deviate to an empty node of in order to increase her utility, i.e., for every and for every node such that for all it holds that , where is the assignment obtained by changing the th entry of to . Let denote the set of all equilibria of game .
The social welfare of an assignment is defined as the total utility of all strategic agents:
Let be an assignment that maximizes the social welfare for a given game ; we refer to it as an optimal assignment.
The price of anarchy (PoA) of game with at least one equilibrium is the ratio between the optimal social welfare and the social welfare of the worst equilibrium; its price of stability (PoS) is defined as the ratio between the optimal social welfare and the social welfare of the best equilibrium:
The price of anarchy and the price of stability are the suprema of and over all such that , respectively.
3 Existence of Equilibria
In this section, we focus on the existence of equilibria. We warm up by observing that for highly structured topologies such as paths, rings, and stars, there is always at least one equilibrium assignment, and some such assignment can be computed efficiently. This can be shown directly, and also follows from a more general result established in Section 6 (Theorem 6.1).
Theorem 3.1.
Every typed Schelling game where the topology is a star or a graph of maximum degree admits at least one equilibrium assignment, which can be computed in polynomial time.
However, in general, an equilibrium may fail to exist; this holds even if the topology is acyclic and there are no stubborn agents.
Theorem 3.2.
For every there exists a typed instance where and is a tree that does not admit an equilibrium.
Proof.
Given , we construct an instance with agents per type; the total number of agents is . The topology is a tree that consists of nodes, which are distributed over four layers. Specifically, the tree has a root , which has one child . Node has children; we denote the set of its children by . Each node in has children, which are the leaves of the tree; we denote the set of all leaves by . Figure 1 depicts the topology for . Now, assume that there is an equilibrium assignment; note that exactly one node is left empty. We consider four cases depending on the location of the empty node.

Node is empty. Assume that the agent occupying node is of type . Then, since there are other agents of type and there are only nodes in , there must exist some subtree rooted at a node in that contains both agents of type and agents that belong to other types. Then an agent of type from this subtree has an incentive to deviate to .

Node is empty. Assume that the agent occupying node is of type ; note that her utility is . If she does not have an incentive to deviate to , it follows that no agent of type occupies a node in . But then there is an agent of type who occupies a node in ; as her parent is not of type , her utility is , and she can increase it by moving to .

Some node is empty. Consider the agents occupying the children of ; note that their utility is . If at least two of them have the same type, each of them has an incentive to deviate to in order to increase her utility to at least . If all of them have different types, then there is exactly one agent of each type in this set. In particular, there is an agent who has the same type as the agent occupying ; then can move to to increase her utility.

Some node is empty. Let denote the parent of this node, and suppose that is occupied by an agent of type . We say that an agent of type is hungry if and is adjacent to at least one agent of a different type; note that a hungry agent has an incentive to deviate to . We claim that at least one agent is hungry. Indeed, if is occupied by an agent of type , then either is hungry or every agent in is hungry. If the agent in is not of type and there is an agent of type in , then is hungry. Finally, if no agent in is of type , there exists a leaf node not in ’s subtree that is occupied by an agent of type ; is then hungry.
The proof is complete. ∎
4 Computational Complexity
We now turn our attention to the computational complexity of typed Schelling games. The main result of this section is that finding an equilibrium assignment is computationally intractable.
Theorem 4.1.
For every , given a typed Schelling game , it is NPcomplete to decide whether admits an equilibrium assignment. The hardness result holds even if all strategic agents belong to the same type.
Proof.
We give a proof for ; it is straightforward to extend it to . We will use a reduction from the Clique problem. An instance of this problem is an undirected graph and an integer ; it is a yesinstance if has a complete subgraph of size . Given an instance of Clique with , we assume without loss of generality that and construct an instance of our problem as follows:

There are two agent types: red and blue.

There are strategic red agents; all remaining agents are stubborn. We will describe the stubborn agents and their locations when defining the topology.

The topology consists of three disjoint components , , and such that

, where , , . There is a stubborn blue agent at each node ;

is a complete bipartite graph with parts and , , . Of the nodes in , nodes are occupied by red agents and nodes are occupied by blue agents;

has three empty nodes, denoted , , and , and nodes — red and blue — occupied by stubborn agents. There is an edge between nodes and ; also, is connected to red agent and blue agents; is connected to red agents and blue agents, and is connected to red agents and blue agents.

Note that a strategic red agent obtains a utility of by choosing an available node in and a utility of by choosing . If she chooses , her utility is if is unoccupied and otherwise. Similarly, if she chooses , her utility is if is unoccupied and otherwise; note that .
Now, suppose that contains a clique of size . If strategic red agents occupy the nodes of that clique, the utility of each such agent is . Thus, by our choice of parameters, no agent has a profitable deviation.
On the other hand, suppose that does not contain a clique of size . Assume for the sake of contradiction that there is an equilibrium assignment .
Suppose first that in some strategic agents are located in . It cannot be the case that each of them is adjacent to friends, as this would mean that their locations form a clique of size . Hence, at least one of these agents is adjacent to at most friends. As this agent is also adjacent to the stubborn blue agents in , her utility is at most . By our choice of parameters, all unoccupied nodes of offer a higher utility, namely, . Thus, if there are strategic agents in , all nodes of that are available to strategic agents must be occupied. But then, there are at most two strategic agents in , which means that their utility is at most (recall that we assume that ). This leads to a contradiction, as these strategic agents would be better off moving to where their utility would be at least .
Therefore, in equilibrium no strategic agent can be located at a node of . Further, since all unoccupied nodes of always offer more utility than any unoccupied nodes of can offer, in equilibrium all nodes of are occupied, and the two remaining strategic agents must be in , with one of , , and left empty.
Suppose that is empty. Then the agent located at can increase her utility from to by moving to , a contradiction. If is empty, the agent located at can increase her utility from to by moving to , a contradiction. Finally, if is empty, the agent located at can increase her utility from to by moving to , a contradiction. As we have exhausted all possibilities, it follows that if does not have a clique of size , then there is no equilibrium assignment. ∎
The proof of Theorem 4.1 can be adapted to show that maximizing social welfare in Schelling games is NPhard as well.
Theorem 4.2.
For every , given a typed Schelling game and a rational value , it is NPcomplete to decide whether admits an assignment with social welfare at least . The hardness result holds even if , all strategic agents belong to one type, and the other type consists of a single stubborn agent.
Proof.
We modify the reduction in the proof of Theorem 4.1 by removing the gadgets and and replacing the set with a single node . That is, given an instance of Clique, we construct an instance of our social welfare maximization problem as follows:

There are two agent types: red and blue.

There are strategic red agents and one stubborn blue agent.

The topology is defined so that and .

The single stubborn blue agent is positioned at node .
Note that the utility of a red agent in an assignment is , where is the number of red agents that is adjacent to in ; the function is increasing in and we have for any assignment. Hence, the social welfare of can be achieved if and only if the red agents can be placed in so that each agent is adjacent to every other red agent, in which case the utility of each strategic agent is ; this is possible if and only if contains a clique of size . ∎
On the positive side, for small we can efficiently decide whether an equilibrium exists if the topology is a tree. Our algorithm is based on dynamic programming: it selects an arbitrary node of to be the root, and then for every node of , it fills out a multidimensional table whose dimension is linear in the number of types, proceeding from the leaves to the root. It decides whether the given instance admits an equilibrium by scanning the table at the root node. The details of the algorithm are given in the appendix.
Theorem 4.3.
Given a typed Schelling game with agents, where the topology is a tree, we can decide whether admits an equilibrium (and compute one if it exists) in time , i.e., this problem lies in the complexity class XP with respect to the number of types .
By slightly modifying our algorithm, we can compute an assignment that maximizes the social welfare, either among all assignments or among equilibria.
Corollary 4.4.
Given a typed Schelling game, where is a tree, the problems of computing an equilibrium with maximum social welfare or a socially optimal assignment are in XP with respect to .
We have not been able to determine whether the problem of computing an equilibrium assignment is fixedparameter tractable with respect to the number of types; we leave this question for future work.
5 Price of Anarchy and Stability
In this section, we investigate the loss in social welfare caused by strategic behavior, as measured by the price of anarchy and the price of stability; unless otherwise specified, the topology is assumed to be a connected graph.^{1}^{1}1We can easily observe that the price of anarchy can be unbounded for not connected topologies. For instance, consider a topology with one isolated node and a connected subgraph such that . Then, any assignment of the agents at the nodes of is an equilibrium. Hence, there might exist equilibria with zero social welfare. We start by establishing bounds on the price of anarchy for instances with no stubborn agents.
Theorem 5.1.
For typed Schelling games with no stubborn agents and strategic agents, the PoA

can be unbounded for each ;

is when there are at least two agents per type;

is if each type has the same number of agents.
We prove each statement separately.
Lemma 5.2.
For typed Schelling games with no stubborn agents and strategic agents, the price of anarchy can be unbounded for each .
Proof.
Consider an instance with two agents of type and one agent of every other type , . The topology is a star with nodes. Then, any assignment where the center node is occupied by an agent of type with , is an equilibrium with zero social welfare. In contrast, any assignment where the center node is occupied by an agent of type is again an equilibrium, but the social welfare is now strictly positive (since the two agents of type are connected to each other). ∎
Lemma 5.3.
For typed Schelling games with no stubborn agents and strategic agents, in which there are at least two agents per type, the price of anarchy is for every .
Proof.
For the lower bound, consider an instance with for and . The topology is a star with nodes. Then any assignment where an agent that belongs to one of the first types is at the center of the star is an equilibrium with social welfare , while for any assignment where an agent of type is at the center of the star the social welfare is . Hence, the price of anarchy is at least .
For the upper bound, consider a typed instance with agents of each type , so that . We will show that the social welfare of any equilibrium assignment is at least . This implies our bound on the price of anarchy, since the optimal social welfare is at most .
Let be an arbitrary equilibrium assignment. Recall that we assume that the number of available nodes exceeds the number of agents and the topology is connected, so there must exist some empty node with at least one nonempty neighbor. Suppose that is connected to agents of type , for , and let . By deviating to , an agent of type would get utility if she is not connected to , and utility otherwise; again, for readability, we use the convention that . Since at equilibrium no agent has an incentive to deviate, her utility is at least the utility she would get by deviating to . Therefore, the social welfare at equilibrium is at least
where the last inequality holds since for every . This completes the proof. ∎
Lemma 5.4.
For typed Schelling games with no stubborn agents and strategic agents, the PoA is if each type has the same number of agents.
Proof.
For the lower bound, fix , let be a parameter and consider an instance with agents per type; altogether there are agents. The topology consists of nodes and is defined as follows. There are cliques of size each, and a node . In each clique there is a special node that is connected to . Also, for each there are auxiliary nodes ; each of these nodes is connected to a distinct set of nodes in . Let be the auxiliary node that is connected to . Figure 2 illustrates this topology for .
There is an optimal assignment where all agents of type are placed at the nodes of clique and the corresponding auxiliary nodes, so that all agents are connected only to agents of the same type and have maximum utility . Therefore, the optimal social welfare is .
In contrast, consider the following equilibrium assignment: node is empty, and for each all nodes in that are connected to the auxiliary node as well as itself are occupied by agents of type . Since node is connected to nodes that are occupied by agents of different types, any agent would get utility by deviating there. No agent occupying an auxiliary node has an incentive to deviate since she is connected only to agents of her type. For every clique, each agent is connected to exactly agents of the same type ( of whom occupy nodes of the clique and one that occupies the corresponding auxiliary node) and agents of different type; thus, her utility is . Consequently, no agent has an incentive to deviate, and the social welfare is . Hence, the PoA is at least ; this expression becomes arbitrarily close to as grows.
For the upper bound, consider an arbitrary instance with agents and types so that there are agents per type. We will show that the social welfare of any equilibrium assignment is at least . The bound on the PoA then follows, since the optimal social welfare is at most .
Recall that we assume that the number of available nodes exceeds the number of agents and the topology is connected, so there must exist some empty node with at least one nonempty neighbor. Suppose that is connected to agents of type , for , and let . Consider an agent of type . A deviation to would give her utility if she is not connected to , and utility otherwise (for readability we use the convention that ). Since at equilibrium no agent has any incentive to deviate, her utility is at least the utility she would get by deviating to . Therefore, the social welfare at equilibrium is at least
The proof is complete. ∎
In the setting considered in Theorem 5.1 the PoA improves significantly if we require each type to have the same number of agents. In the presence of stubborn agents, to ensure that the price of anarchy does not depend on the number of agents , we additionally require that this constraint holds both for strategic and for stubborn agents.
Theorem 5.5.
For typed Schelling games with agents the PoA

is for each even if there is an equal number of agents per type;

is if each type has the same number of strategic agents and the same number of stubborn agents.
Again, we prove each statement separately.
Lemma 5.6.
For typed Schelling games with no stubborn agents and strategic agents, the price of anarchy is for each , even if there is an equal number of agents per type.
Proof.
Pick a positive integer and consider an instance with agents such that there are strategic agents of type , one strategic agent and stubborn agents of type , and stubborn agents of type for each . The topology is a star with nodes, and all stubborn agents occupy leaf nodes. Then, any assignment where the strategic agent of type occupies the center node is an equilibrium with social welfare , while the social welfare of any assignment where the center node is occupied by an agent of type is . Hence, the price of anarchy is at least . ∎
Lemma 5.7.
For typed instances, where all types have the same number of strategic agents and the same number of stubborn agents, the price of anarchy is .
Proof.
We first establish the lower bound. Suppose that
is odd, and consider an instance with
types of agents such that there are strategic agents and one stubborn agent per type . The number of strategic agents is . The topology is depicted in Figure 3 and consists of cliques of size , which are connected to each other via an auxiliary node . The stubborn agent of type occupies the node of the th clique that is adjacent to .In an optimal assignment all strategic agents of type occupy the nodes of the th clique: this ensures that the utility of each strategic agent is and the social welfare is equal to . In contrast, consider an assignment where the auxiliary node is left empty, and the th clique includes one agent of type and pairs of agents of different types.^{2}^{2}2To see how such an assignment can be computed, split agents of type into pairs and think of each pair as one ball of color and each clique as a bin. Then, there are balls of each color, which must be placed in bins so that each bin contains balls of different color. To accomplish this, we can order the balls so that balls of type appear in positions ; hence, we can simply put the first balls in the first bin, the next balls in the second bin, etc. This is an equilibrium since all strategic agents have utility , which is exactly the utility they would get by deviating to . Therefore, the social welfare achieved by this equilibrium assignment is , and the price of anarchy is at least .
When is even, we can modify the instance as follows. For each , there are strategic agents and one stubborn agent per type . The topology consists of cliques of size , which are connected to each other via an auxiliary node , together with dummy nodes each connected to a single node occupied by a stubborn player. For , the stubborn agent of type occupies the node of the th clique that is adjacent to , and the stubborn agent of type occupies one of the dummy nodes.
If all strategic agents of type , for , occupy the nodes of the th clique, and the agents of type occupy the dummy nodes, then the social welfare is equal to . On the other hand, there is an equilibrium where agents of type occupy dummy nodes and agents of other types are distributed over the cliques as in the equilibrium for odd . Then, for , the utility of each strategic agent of type is . The social welfare in this case is , and so the price of anarchy is at least .
For the upper bound, consider an arbitrary typed instance with strategic and stubborn agents per type, for some integers and . We will show that the social welfare of any equilibrium assignment is at least . The bound then follows since the utility of every strategic agent is at most , meaning that the optimal social welfare is at most .
Let be an arbitrary equilibrium assignment. Since the number of available nodes exceeds the number of agents and the topology is connected, there must exist some empty node with at least one nonempty neighbor. Suppose that is connected to agents of type , for , and of them are strategic. Also, let . Now, consider a strategic agent of type . A deviation to would give her utility if she is not connected to , and utility otherwise; again, for readability, we use the convention . Since at equilibrium no strategic agent has any incentive to deviate, her utility is at least the utility she would get by deviating to . Therefore, the social welfare at equilibrium is at least
where the last inequality follows since . The proof is complete. ∎
Finally, we show that in Schelling games even the best equilibrium need not be socially optimal, even if all agents are strategic.^{3}^{3}3Note that the assumption of a connected topology is no longer necessary for meaningful bounds on the price of stability, since the PoS deals with the bestcase equilibrium assignment rather than the worstcase one.
Theorem 5.8.
For typed Schelling games the PoS

can be unbounded for each ;

is at least for each even , if there is the same number of stubborn agents per type;

is at least for each , even in the absence of stubborn agents.
The proof of the above theorem follows by the next three lemmas.
Lemma 5.9.
For typed Schelling games, the price of stability can be unbounded for each .
Proof.
We prove this lemma only for ; our instance can then be generalized to any number of types by adding isolated nodes in the topology which are occupied by stubborn players of different types.
Let be a parameter such that and are integer numbers. Consider an instance with stubborn red agents, one stubborn blue agent, and two strategic blue agents. The topology and the placement of the stubborn agents is depicted in Figure 4. There are only three possible assignments depending on which pair of nodes (out of the three available) the two strategic blue agents occupy.
We claim that the only equilibrium assignment is the one where node is left empty with social welfare . First, observe that this assignment is indeed an equilibrium since no strategic agent has any incentive to deviate: node can give utility to the agent occupying node and utility to the agent occupying node . Since the two agents get utility and , respectively, none of them has any incentive to deviate. To verify the uniqueness of the equilibrium, observe that in the other two possible assignments there exists a strategic agent that can deviate to the empty node in order to increase her utility from to in case the strategic blue agents are connected, or from to in case the strategic blue agents are not connected.
In contrast, the assignment according to which the strategic blue agents are connected to each other (by occupying nodes and ) is the optimal one with social welfare . Therefore, the price of stability is at least , which tends to infinity as tends to zero. ∎
Lemma 5.10.
For typed Schelling games, the price of stability is at least , for each even , if there is the same number of stubborn agents per type.
Proof.
For simplicity, we will prove the lemma for . Let be a parameter and consider an instance with two types of agents (red and blue) such that there are stubborn red agents, stubborn blue agents, and two strategic blue agents. The topology and the placement of the stubborn agents are depicted in Figure 5. There are only three possible assignments depending on which pair of nodes (out of the three available) the two strategic blue agents occupy.
We claim that the only equilibrium assignment is the one where node is left empty with social welfare . First, observe that this assignment is indeed an equilibrium since no strategic agent has any incentive to deviate: node can give utility to the agent occupying node and utility to the agent occupying node . Since the two agents get utility and , respectively, none of them has any incentive to deviate. To verify the uniqueness of the equilibrium, observe that in the other two possible assignments there exists a strategic agent that can deviate to the empty node in order to increase her utility from to in case the strategic blue agents are connected, or from to in case the strategic blue agents are not connected.
In contrast, the assignment according to which the strategic blue agents are connected to each other (by occupying nodes and ) is the optimal one with social welfare . Therefore, the price of stability is at least , which tends to as becomes arbitrarily large.
The bound can easily be extended to the case of types (for even ) by replicating times the whole instance and connecting the topologies via an empty node. ∎
Lemma 5.11.
For typed Schelling games, the price of stability is at least , for each , even in the absence of stubborn agents.
Proof.
For the sake of simplicity, we prove the lemma for , for which the desired lower bound is ; we will discuss how to generalize our construction to at the end of the proof.
Consider an instance with two types of agents (red and blue) such that there are five red and five blue agents; the topology is depicted in Figure 6.
Let be the following assignment: node , node and all three type nodes are occupied by red agents, while node , all type nodes and node are occupied by blue agents. One can easily verify that is an equilibrium since no agent has any incentive to deviate to the empty node ; the social welfare is .
Let be the following assignment: node , node and all three type nodes are occupied by red agents, while node , two of the type nodes, node and node are occupied by blue agents. This is not an equilibrium assignment since the blue agent occupying has utility and hence has an incentive to deviate to the empty type node in order to increase her utility to . However, it achieves an improved social welfare of .
In order to complete the proof, we need to argue that is an equilibrium with the maximum social welfare. To this end, we establish some properties of equilibrium assignments.

Node must be occupied. Assume otherwise that is left empty. If nodes , and are occupied by agents of the same type, then at least one of them will be connected to some agent of the other type, and therefore will have an incentive to deviate to in order to connect only to agents of the same type. Hence, without loss of generality (due to symmetry), at , and there are two red agents and one blue agent. Trivially, the blue agent cannot be connected to any red agents, since otherwise any such red agent would get zero utility and have an incentive to deviate to in order to increase her utility to . Since there are four remaining blue agents, at least one of them must be connected to one of the two red agents occupying nodes at the second layer. Hence, this blue agent gets zero utility and has an incentive to deviate to in order to increase her utility to .

Nodes and must be occupied. Assume otherwise that one of these nodes, say , is left empty, while node is occupied by a red agent (without loss of generality). If all type nodes are occupied by agents of the same type, then all these agents get zero utility and have an incentive to deviate to in order to increase their utility to at least . So, agents of both types must appear at the type nodes. But then, the red such agent has an incentive to deviate to in order to increase her utility from zero to at least .

Agents of both types must appear at the nodes of the second layer. Assume otherwise that only agents of the same type appear at these nodes, while node is occupied by a red agent (without loss of generality). Let us further assume that , and are all occupied by blue agents. Then, since the empty node is one of those at the third layer, two of the blue agents occupying nodes , and have an incentive to deviate in order to increase their utility from strictly less than (since they are connected to the red agent occupying node ) to . In case , and are all occupied by red agents, then all blue agents occupy nodes at the third layer, meaning that at least two of the red agents occupying , and get utility strictly less than , and only one of them can be connected to the empty node. Hence, the other such red agent has an incentive to deviate to the empty node and increase her utility to . Therefore, the empty node must be one of those at the second layer.
Since and are occupied, has to be the empty node. If is occupied by a red agent, then this agent gets zero utility and has an incentive to deviate to in order to connect to the red agent occupying . Hence, must be occupied by a blue agent. If and are occupied by blue agents, then either one of them is connected only to red agents or both are connected to three red agents (including the one at ) and one blue agent. In any case, at least one of them has an incentive to deviate to and increase her utility from or to . So, nodes and must be occupied by red agents. But then, all blue agents occupy nodes at the third layer, get zero utility, and the four of them that are connected to the red agents occupying and have an incentive to deviate to in order to increase their utility to .

The type of agents that appears at node can appear only once more at nodes , or . Assume otherwise that is occupied by a red agent (without loss of generality) and two nodes at the second layer, say and , are occupied by red agents as well; the case where and are occupied by red players is similar. By the discussion above, must then be occupied by a blue agent. Observe that since there are four remaining blue agents, one of them (agent ) has to be connected to one of the red agents occupying and . Trivially, none of the type nodes can be empty, since this would give an incentive to to deviate there in order to increase her utility from zero to . But then, this means that one of the type nodes or node is empty, thus giving an incentive to the red agent occupying to deviate in order to increase her utility from to .
Given the above structural properties, there can only be two equilibria (and two more symmetric ones, produced by exchanging agents of different types):

Nodes and are occupied by red agents, while nodes and are occupied by blue agents; the assignment for the nodes of the third layer is then trivially defined. Such an equilibrium has social welfare .

Nodes and are occupied by red agents, node is occupied a blue agent, and node is empty; the assignment for the nodes of the third layer is trivially defined so that node is occupied by the last blue agent that gets zero utility. Such an equilibrium has social welfare .
Hence, the second type of equilibrium assignment is the one with maximum social welfare, and the lower bound on the price of stability follows.
We can generalize the above instance to agent types as follows. Let be the topology used in the above instance for two agent types. Now, consider an instance where the topology consists of and isolated nodes. There are five agents of type , five agents of type , and one agent per type for ; the agents of type and correspond to the red and blue agents in the instance for .
Observe that the agents of type for get zero utility in any possible assignment, since they are unique of their type. Consequently, even though there are many equilibrium assignments where these agents occupy nodes of , none of these equilibria achieve higher utility than the ones where these agents occupy isolated nodes, and agents of types and occupy the nodes of . Consequently, following the same reasoning as in the above instance for , we can conclude that the price of stability is at least . ∎
6 Variants and Extensions
Throughout this paper, we focused on a setting where agents are classified into types and their utilities are defined by the proportion of their friends among their neighbors. In this section, we introduce three variants of this model and briefly discuss some preliminary results; a more thorough investigation of these alternative models is left for future work.
6.1 Schelling games with social networks
In typed Schelling games, the friendship relation is defined by types: an agent’s set of friends consists of all agents of the same type. One can also consider a more general friendship relation, defined by an arbitrary undirected graph with vertex set , which we will refer to as the social network: the set of friends of agent consists of all neighbors of in . We refer to the resulting class of games as social Schelling games.
By definition, typed Schelling games form a subclass of social Schelling games: a typed game corresponds to a social network consisting of cliques. Hence, our next theorem implies Theorem 3.1 in Section 3.
Theorem 6.1.
Every social Schelling game where the topology is a star or a graph of maximum degree admits at least one equilibrium assignment, which can be computed in polynomial time.
Proof.
Consider a social Schelling game with a set of agents , where is the set of strategic agents and is the set of stubborn agents, a topology , a social network , and a function that describes the locations of the stubborn agents; for each , let denote the set of nodes of that are adjacent to .
Suppose that is a star with center . Consider an assignment such that for some . All strategic agents are indifferent among the leaves, so no agent in has a beneficial deviation. Now, consider agent . If is stubborn, she cannot deviate; if is strategic, she does not want to deviate, as any leaf node would give her zero utility. Hence, is an equilibrium.
Now, suppose that is a graph of maximum degree . Our analysis for this case is inspired by Theorem 6 in the work of Chauhan et al. (2018). For each , let denote the degree of a vertex in . Given an assignment , for each edge , we define
Let . We claim that is an ordinal potential function for our setting, i.e., if an agent deviates to increase her utility, the potential function increases.
To see this, consider an assignment and an agent with that deviates to an empty node ; denote the resulting assignment by . Given an edge , let
Also, for , let . Note that ’s move only changes the potential of edges incident to and . Hence, if and are not adjacent, we have . We will now prove that ; if and are not adjacent, this establishes our claim; towards the end of the proof we will explain how to handle the case . We make the following observations.

As no agent benefits from moving to an isolated node, it must be .

If , let be the edge that is adjacent to . Since is empty in , we have that . Since agent benefits from moving to , we have that . Hence, and, consequently, .

If , let and be the two edges incident to . Since is empty in , we have that . Since agent benefits from moving to , we have that . Hence, .

If then by definition .

If , let be the edge that is incident to . Since benefits from moving away from , we have that . Since is left empty in , we have that and, consequently, .

If , let and be the two edges incident to . Since is left empty in , we have that . Since agent benefits from moving away from , we have that . Thus, .
By the above observations, it follows that unless and . However, this is impossible: only if in agent is adjacent to one friend and one enemy, and only if in agent is adjacent to one friend and one enemy; but in such a case, agent would have no incentive to move, a contradiction. This completes the analysis for when .
Now, suppose that and are adjacent. In this case we have that . However, since is empty in and is empty in , it must be , and hence implies in this case as well.
Finally, note that the potential function takes values in the set , where is the number of nodes of the topology graph. Therefore, any best response dynamics starting from an arbitrary initial configuration converges to an equilibrium in steps. ∎
Conversely, all our nonexistence results (Theorem 3.2), hardness results (Theorems 4.1 and 4.2) and lower bounds on the PoA and PoS (Section 5) apply to social Schelling games as well. In fact, maximizing the social welfare in social Schelling games is NPhard even if all agents are strategic (whereas our hardness reduction for typed games uses stubborn agents). Moreover, this hardness result holds even if is a graph of maximum degree , i.e., social welfare maximization may be hard even when finding equilibria is easy.
Theorem 6.2.
Given a social Schelling game and a rational value , it is NPcomplete to decide whether admits an assignment with social welfare at least . The hardness result holds even if all agents are strategic and even if is a graph of maximum degree .
Proof.
It is immediate that our problem is in NP. To show NPhardness, we will use a reduction from the Hamiltonian Cycle (HC) problem. An instance of HC is an undirected graph ; it is a yesinstance if and only if the vertices of this graph can be ordered as so that and for each it holds that .
Given an instance of HC, where is the set of nodes and is the set of edges, we construct an instance of our social welfare maximization problem as follows:

For every node , we have a strategic agent with set of friends .

The topology is a cycle consisting of nodes together with an isolated node .
By construction, a social welfare of can be achieved if and only if the agents can be assigned to the nodes of the cycle so that each of them is adjacent to two friends; this is possible if and only if admits a Hamiltonian cycle. ∎
Identifying special classes of social Schelling games that allow for good upper bounds on the price of anarchy and the price of stability is an interesting research direction. We note that the upper bounds in Section 5 only apply to typed instances with further restrictions on the structure of each type, so they cannot be extended to the social setting.
6.2 Schelling games with enemy aversion
In our model, if an agent is not adjacent to any friends, it does not matter how many enemies she is adjacent to. This is also the case in fractional hedonic games: agents are indifferent between being alone and being in coalitions consisting of their enemies. This assumption makes sense when the “enemies” of an agent are simply agents that do not contribute to her welfare. However, an agent may prefer being alone to being in a group full of enemies. In the context of hedonic games, such preferences are modeled by modified fractional hedonic games (Olsen, 2012; Elkind et al., 2016; Bredereck et al., 2019), where the utility of an agent in a coalition with friends and enemies is , i.e., the agent herself is included in the set of her friends.
Many of our results extend to this definition of utility. For example, we can construct instances without equilibria even for typed games, using ideas similar to those in the reduction of Theorem 4.1. Further, for typed games with a tree topology and a constant number of types, equilibrium existence can be decided in polynomial time, by adapting the proof of Theorem 4.3. However, it remains an open question if instances with no stubborn agents always admit an equilibrium in this model.
6.3 Schelling games with linear utilities
Throughout the paper we assume that an agent’s utility is determined by the fraction of her friends among her neighbors. Alternatively, an agent may simply care about the number of friends in her neighborhood or the difference between the number of friends and the number of enemies ; more broadly, her utility may be an arbitrary linear function of and (in the context of hedonic games, this model corresponds to a subclass of additively separable hedonic games; e.g., see (Aziz and Savani, 2016)). It turns out that games of this form are potential games and therefore have at least one equilibrium; furthermore, in the absence of stubborn agents there is always an equilibrium that is socially optimal.
Theorem 6.3.
Consider a variant of the (social) Schelling model where the utility of each agent , who is adjacent to friends and enemies, is for some . Then, every instance has an equilibrium assignment which can be computed in polynomial time. Moreover, if no agent is stubborn, the price of stability is .
Proof.
Consider a game with a set of strategic agents , a set of stubborn agents , a topology and a friendship relation that is defined by a social network . Fix nonnegative constants and such that the utility of an agent who is adjacent to friends and enemies in the topology is given by . Our analysis is inspired by Proposition 2 in the work of Bogomolnaia and Jackson (2002), showing that a Nash stable partition always exists in symmetric additively separable hedonic games.
Let and be an assignment. For each let , and . We will argue that is an ordinal potential function for our game. Note that if all agents are strategic, is equal to the social welfare of . However, in general this is not the case: intuitively, ascribes “strategic” utilities to the stubborn agents.
Consider an assignment and an agent with . Suppose that has a beneficial deviation from to another node , which is empty in ; denote the resulting assignment by . Suppose that agent has friends and enemies at , and friends and enemies at . Then, since the deviation is profitable, it holds that . We claim that .
Indeed, consider an agent . If is a neighbor of in both and , or if is not a neighbor of in both and , then .
Now, suppose that is adjacent to in , but not in . If is a friend of , then , and if is an enemy of , then . Similarly, if is adjacent to in , but not in , then if is a friend of , then , and if is an enemy of , then . Thus, the overall change in potential can be computed as
It follows that, if the strategic agents follow the best response dynamics starting from any initial configuration, they will converge to an equilibrium. Moreover, the assignment that maximizes is an equilibrium, so if all agents are strategic, this equilibrium maximizes the social welfare. Note also that the function takes values in the set , where is the number of agents. Thus, any best response dynamics converges in iterations. ∎
7 Conclusions
In this paper, we investigated Schelling games on graphs, both from the perspective of equilibrium analysis and from the perspective of social welfare. Concerning equilibrium existence, our positive results are rather limited in scope: while an equilibrium always exists for very simple topologies, such as stars and paths, it may fail to exist even if the topology does not contain cycles. It would be interesting to obtain a complete characterization of topologies that guarantee existence of equilibria.
For welfare maximization, a natural question is whether one can efficiently compute assignments with nearly optimal social welfare. We note that our NPhardness reductions are not approximation preserving, so they do not rule out this possibility. Another interesting algorithmic question is whether the problem of computing equilibria in typed games remains hard in the absence of stubborn agents; we conjecture that this is indeed the case, but were unable to prove it.
References
 Alba and Logan [1993] R. Alba and J. Logan. Minority proximity to whites in suburbs: An individuallevel analysis of segregation. American Journal of Sociology, 98(6):1388–1427, 1993.
 Anshelevich et al. [2008] E. Anshelevich, A. Dasgupta, J. M. Kleinberg, É. Tardos, T. Wexler, and T. Roughgarden. The price of stability for network design with fair cost allocation. SIAM Journal on Computing, 38(4):1602–1623, 2008.
 Aziz and Savani [2016] H. Aziz and R. Savani. Hedonic games. In Handbook of Computational Social Choice, pages 356–376. 2016.
 Aziz et al. [2014] H. Aziz, F. Brandt, and P. Harrenstein. Fractional hedonic games. In Proceedings of the 2014 International conference on Autonomous Agents and MultiAgent Systems (AAMAS), pages 5–12, 2014.
 Barmpalias et al. [2014] G. Barmpalias, R. Elwes, and A. LewisPye. Digital morphogenesis via Schelling segregation. In Proceedings of the 55th IEEE Annual Symposium on Foundations of Computer Science (FOCS), pages 156–165, 2014.
 Barmpalias et al. [2015] G. Barmpalias, R. Elwes, and A. LewisPye. From randomness to order: unperturbed Schelling segregation in two or three dimensions. CoRR, abs/1504.03809, 2015.
 Benard and Willer [2007] S. Benard and R. Willer. A wealth and statusbased model of residential segregation. Journal of Mathematical Sociology, 31(2):149–174, 2007.
 Benenson et al. [2009] I. Benenson, E. Hatna, and E. Or. From Schelling to spatially explicit modeling of urban ethnic and economic residential dynamics. Sociological Methods and Research, 37(4):463–497, 2009.
 Bogomolnaia and Jackson [2002] A. Bogomolnaia and M. O. Jackson. The stability of hedonic coalition structures. Games and Economic Behavior, 38(2):201–230, 2002.

Brandt et al. [2012]
C. Brandt, N. Immorlica, G. Kamath, and R. Kleinberg.
An analysis of onedimensional Schelling segregation.
In
Proceedings of the 44th Symposium on Theory of Computing Conference (STOC)
, pages 789–804, 2012.  Bredereck et al. [2019] R. Bredereck, E. Elkind, and A. Igarashi. Hedonic diversity games. In Proceedings of the 2019 International conference on Autonomous Agents and MultiAgent Systems (AAMAS), 2019.
 Chauhan et al. [2018] A. Chauhan, P. Lenzner, and L. Molitor. Schelling segregation with strategic agents. In Proceedings of the 11th International Symposium on Algorithmic Game Theory (SAGT), pages 137–149, 2018.
 Clark and Fossett [2008] W. Clark and M. Fossett. Understanding the social context of the Schelling segregation model. Proceedings of the National Academy of Sciences, 105(11):4109–4114, 2008.
 Drèze and Greenberg [1980] J. H. Drèze and J. Greenberg. Hedonic coalitions: optimality and stability. Econometrica, 48(4):987–1003, 1980.
 Easley and Kleinberg [2010] D. A. Easley and J. M. Kleinberg. Networks, Crowds, and Markets – Reasoning about a Highly Connected World. Cambridge University Press, 2010.

Elkind et al. [2016]
E. Elkind, A. Fanelli, and M. Flammini.
Price of Pareto optimality in hedonic games.
In
Proceedings of the 20th AAAI Conference on Artificial Intelligence (AAAI)
, pages 475–481, 2016.  Immorlica et al. [2017] N. Immorlica, R. Kleinberg, B. Lucier, and M. Zadomighaddam. Exponential segregation in a twodimensional Schelling model with tolerant individuals. In Proceedings of the 28th Annual ACMSIAM Symposium on Discrete Algorithms (SODA), pages 984–993, 2017.
 Koutsoupias and Papadimitriou [1999] E. Koutsoupias and C. H. Papadimitriou. Worstcase equilibria. In Proceedings of the 16th Annual Symposium on Theoretical Aspects of Computer Science (STACS), pages 404–413, 1999.
 Olsen [2012] M. Olsen. On defining and computing communities. In Proceedings of the 18th Computing: Australasian Theory Symposium (CATS), pages 97–102, 2012.
 Pancs and Vriend [2007] R. Pancs and N. Vriend. Schelling’s spatial proximity model of segregation revi