1 Introduction
More than 50 years ago, Thomas Schelling (1969; 1971) presented the following simple probabilistic procedure in an attempt to model residential segregation. There are two types of agents who are uniformly at random placed at the nodes of a location graph (such as a line or a grid), and a tolerance threshold parameter . If the neighborhood of an agent consists of at least a fraction of agents of her own type, then the agent is happy and remains at her current location. Otherwise, the agent is unhappy and either jumps to a randomly selected empty node of the graph or swaps locations with another randomly chosen unhappy agent. Schelling experimentally showed that this random process can lead to placements such that the graph is partitioned into two parts, each containing mostly agents of the same type, even when the agents are tolerant towards having neighbors of the other type (that is, when ).
Since its inception, Schelling’s model and interesting variants of it have been studied extensively both experimentally and theoretically from the perspective of a plethora of different disciplines, including Sociology (Clark and Fossett, 2008), Economics (Pancs and Vriend, 2007; Zhang, 2004), Physics (Vinković and Kirman, 2006), and Computer Science (Barmpalias et al., 2014; Bhakta et al., 2014; Brandt et al., 2012; Immorlica et al., 2017)
. Most of these works have focused on the analysis of random processes similar to the one proposed by Schelling, either via agentbased simulations or via Markov chains, and have shown that segregation occurs with high probability.
A more recent stream of papers (Agarwal et al., 2020; Bilò et al., 2020; Chan et al., 2020; Chauhan et al., 2018; Echzell et al., 2019; Elkind et al., 2019) have considered Schelling games, that is, gametheoretic variants of Schelling’s model with multiple types of agents and general location graphs. The agents behave strategically and aim to maximize a utility function, which is defined as the minimum between the threshold parameter and the ratio of the other agents of the same type within one’s neighborhood over the (occupied) neighborhood size. These papers have considered both jump games, in which the agents are allowed to jump to empty nodes of the location graph, and swap games, in which the agents are only allowed to pairwise swap positions. Among other questions, they have studied the complexity of computing equilibrium assignments (i.e., placements such that no agent wants to jump to an empty node or no pair of agents wants to swap positions), the complexity of maximizing social welfare (i.e., the total utility of the agents), and have shown bounds on the price of anarchy (Koutsoupias and Papadimitriou, 1999) and the price of stability (Anshelevich et al., 2008).
One limitation of the utility function defined above and used in the related literature on Schelling games, which our model aims to address, is that it does not allow the agents to distinguish between neighborhoods that consist only of agents of their own type, but may vary in size. To give a concrete example, consider a red agent who faces the dilemma of choosing between two empty nodes, one of which is adjacent to one red agent, while the other is adjacent to two red agents. Since the utility is defined as the fraction of red neighbors, both empty nodes offer the same utility of to our agent, which means that she can choose arbitrarily amongst them. However, it is arguably more realistic to assume that the second empty node is more attractive than the first one as it is adjacent to a strictly larger number of red agents, and consequently the agent would normally choose it. To strengthen the ability of the utility function to express preferences of this kind, we redefine it by assuming that the agent considers herself as part of the set of her neighbors, which simply translates to a “+1” term added to the denominator of the ratio; this is similar to fractional hedonic games (see the discussion below). Back to our example, the new modified utility function would yield utilities of and for the two empty nodes, respectively, reflecting the agent’s preference for the second node.



PoA  PoS  
arbitrary  balanced  line  tree  


N/A  
()  (  ()  
()  ()  

Our setting and contribution
We introduce the class of modified Schelling games. In such games, there are types of agents who occupy the nodes of some location graph and aim to maximize their utility, which is defined by the modified function discussed above, by jumping to empty nodes whenever such a move is beneficial. Since the modified utility function is able to express preferences over monochromatic neighborhoods of different sizes, a strategic game is induced even when there is a single type of agents. For , we argue that the bestresponse dynamics always converges to an equilibrium assignment in polynomial time, while this is not generally true for . Our main technical contribution is a thorough price of anarchy and price of stability analysis. We distinguish between games on arbitrary location graphs, balanced games in which there is the same number of agents per type (for ), as well as games with structured location graphs such as lines and trees. We show tight bounds on the price of anarchy, by carefully exploiting the structure of equilibrium assignments and the properties of the games we study. We also show lower bounds on the price of stability for , as well as an upper bound for ; to the best of our knowledge, this is the first nontrivial upper bound on the price of stability for general location graphs in the related literature. An overview of our results is given in Table 1.
Related work
We will mainly discuss the related literature on Schelling games. Chauhan et al. (2018) studied the convergence of the bestresponse dynamics to an equilibrium assignment in both jump and swap Schelling games with two types of agents and for various values of the threshold parameter . They presented a series of positive and negative results depending on the relation of to other parameters related to the location graph. Their results were later extended by Echzell et al. (2019) for more than two types of agents and for two different generalizations of the utility function: one that considers all types in the denominator of the ratio, and one that considers only the type of the agent at hand and the type of maximum cardinality among the remaining types.
Elkind et al. (2019) considered a variant of jump Schelling games with types of agents who may behave in two different ways: some of them are strategic and aim to maximize their utility, while some others are stubborn and stay at their initial location regardless of the composition of the neighborhood. Elkind et al. showed that equilibrium assignments may fail to exist, they proved that the problem of computing an equilibrium or an assignment with high social welfare is intractable, and also showed bounds on the price of anarchy and the price of stability. Furthermore, they discussed several extensions, among which that of social Schelling games, where the friendships among agents are specified by a social network. This class of games was further studied by Chan et al. (2020), who also assumed that the nodes of the location graph can be shared by different agents.
Agarwal et al. (2020) considered swap Schelling games. Besides studying complexity and price of anarchy questions similar to those of Elkind et al., they also considered related questions for a different objective function over assignments, called degree of integration, which aims to capture how diverse an assignment is; this function counts the number of agents who have at least one neighbor of different type. Very recently, Bilò et al. (2020) performed a refined price of anarchy analysis with respect to the social welfare in the model of Agarwal et al. for swap games: they showed improved bounds for , as well as for games with structured location graphs such as cycles, trees, regular graphs, and grids. Furthermore, they initiated the study of games with the finite improvement property, in which the agents can swap positions only with agents within a restricted radius from their current location. In a slightly different context, Massand and Simon (2019) studied games that are similar to swap social Schelling games, but with linear utility functions, instead of fractions.
As pointed out by Elkind et al., Schelling games are very similar to hedonic games (Bogomolnaia and Jackson, 2002; Drèze and Greenberg, 1980), but also quite distinct from them: while one can think of the neighborhoods as coalitions, these coalitions generally overlap depending on the structure of the location graph. Somewhat counterintuitively, the games studied by almost all the aforementioned papers are analogous to modified fractional hedonic games (Elkind et al., 2016; Monaco et al., 2020; Olsen, 2012), where the agents are connected via a weighted graph and are partitioned into coalitions; each agent derives a utility which is the total weight of her connections within her coalition divided by the size of the coalition excluding herself. In contrast, the modified Schelling games we study in this paper are analogous to fractional hedonic games (Aziz et al., 2019; Bilò et al., 2018), where the utility of an agent is defined as the total weight of her connections within her coalition divided by the size of the coalition including herself.
2 Preliminaries
There are agents who are partitioned into types. We denote by the set of all agents of type , and let such that ; also, let . Agents of the same type are friends, and agents of different types are enemies. The agents occupy the nodes of a simple undirected connected location graph with nodes; following previous work, we refer to this graph as the topology. An assignment
is a vector containing the node
occupied by each agent such that for .For an assignment , we denote by the set of agents that are adjacent to node . Moreover, let and denote by the number of agents of type in the neighborhood of node . Then, the utility of an agent of type who occupies node under assignment is defined as
To simplify our notation, we will omit whenever it is clear from context, and will sometimes use colors to refer to different types.
The agents are strategic and can jump to empty nodes of the topology to maximize their utility. An assignment is called a pure Nash equilibrium (or, simply, equilibrium) if no agent prefers to jump to any empty node, that is, for every agent and empty node , where is the assignment according to which agent occupies and all other agents occupy the same nodes as in . Let denote the set of all equilibrium assignments of a modified Schelling game .
The social welfare of an assignment is the total utility of the agents:
For a given game, the maximum social welfare among all possible assignments is denoted by . The price of anarchy of a modified Schelling game with is the ratio of the maximum social welfare achieved by any possible assignment over the minimum social welfare achieved at equilibrium, that is,
Then, the price of anarchy of a class of modified Schelling games is
Similarly, the price of stability of a modified Schelling game with is the ratio of the maximum social welfare achieved by any possible assignment over the maximum social welfare achieved at equilibrium, that is,
and the price of stability of a class of modified Schelling games is
Besides general modified Schelling games, we will also be interested in balanced games in which for there are agents of each type , as well as games in which the topology has a particular set of properties (for instance, it is a line or a tree).
3 Onetype Games
Interestingly, the modified Schelling model that we consider in this paper admits a game even when all agents are of the same type. This is in sharp contrast to the original model in which the utility of any agent who only has neighbors of the same type is always , implying that any assignment is an equilibrium when there is only one type of agents; see Section 1 for a more detailed discussion on the differences between the two utility models. In this section, we focus entirely on the case where there is one type of agents and study the equilibrium properties of the induced strategic games. We start by showing that there always exist equilibrium assignments in such games.
Theorem 1.
Modified Schelling games always admit at least one equilibrium assignment, which can be computed in polynomial time.
Proof.
Consider any modified Schelling game. For any assignment and node , let and . We define the function
We will argue that is an ordinal potential function for our setting: if the utility of an agent increases (decreases, respectively) after she jumps to an empty node, then we will observe an increase (decrease, respectively) in the potential of the corresponding assignments.
Consider two assignments and which differ on the node that an agent occupies. We observe the following:

For every node such that (that is, is not adjacent to in any assignment) or (that is, is adjacent to in both assignments), .

For every node such that (that is, is adjacent to in but not in ), .

For every node such that (that is, is adjacent to in but not in ), .
Now, consider agent , for whom and . By definition, we have that and . Furthermore, observe that for any integers . As a result, have that if , and if . Combined together with the above observations, we obtain that if , and if , which imply that is an ordinal potential as desired.
Finally, note that the maximum value that can take is at most , since every agent can have at most neighbors. This implies that the bestresponse dynamics converges to an equilibrium in at most steps. ∎
We continue by showing tight bounds on the price of anarchy of modified Schelling games for two cases. The first is the most general one in which the topology can be any arbitrary graph, while the second is for when the topology is a tree.
Theorem 2.
The price of anarchy of modified Schelling games on arbitrary graphs is exactly .
Proof.
Since the topology is a connected graph, it must be the case that, under any equilibrium assignment, every agent is connected to at least one other agent. Hence, the utility of every agent at equilibrium is at least . On the other hand, the maximum utility an agent can obtain (at any possible assignment) is , which happens when she is connected to all other agents. We can now conclude that the social welfare at any equilibrium is , while the optimal social welfare . Consequently, the price of anarchy is at most .
For the lower bound, consider a modified Schelling game with agents, in which the topology consists of a clique of size and additional nodes that form a path with one node of the clique. An assignment that allocates all agents on the path such that the agents are connected in pairs and there are two empty nodes between any two pairs of agents, is an equilibrium. Indeed, every agent has utility , while jumping to any empty node would give her at most the same utility. However, assigning the agents to the nodes of the clique, gives maximum utility to every agent, and the bound follows. ∎
Our next result shows that the price of anarchy slightly improves when the topology is more structured.
Theorem 3.
The price of anarchy of modified Schelling games on trees and lines is exactly .
Proof.
We begin by computing an upper bound on the maximum social welfare. Let be a modified Schelling game in which the topology is a tree. We claim that there exists a modified Schelling game in which the topology is a line with the same number of nodes as , such that the optimal social welfare of is upperbounded by the optimal social welfare of . This is trivial if the optimal assignment at is actually a path or a collection of paths.
Now, assume that at the optimal assignment of there exists an agent that occupies some node that is adjacent to strictly more than two agents. Let be an agent that occupies a node such that and for all nodes that are descendants of in . Let and be two paths that start from (excluding ) and end at the leaf nodes and , respectively. We claim that the social welfare will increase if we first remove the empty nodes of , and then append at the end of . Indeed, note that the utility of only two agents will change; one (extreme) agent on will get utility as opposed to that she had before, while will get utility as opposed to that she had before. Consequently, the total difference in utility is
since by assumption. By repeatedly transforming the initial assignment according to the above procedure, we end up with a single path which has strictly more social welfare, as desired.
It should be relatively easy to see that the assignment that maximizes the social welfare when the topology is a line is such that all agents form a single connected component. Then, exactly two agents have only one neighbor and utility , while all other agents have two neighbors and utility each. Hence, the optimal social welfare of a game with a tree topology is .
To prove our bound on the price of anarchy, it suffices to observe that the utility of any agent at equilibrium is at least , and therefore . In fact, there exists a game that has exactly this much social welfare at equilibrium: consider a modified Schelling game in which the topology is a line consisting of nodes, where is even. An assignment that allocates all agents on the line such that agents are connected in pairs and there are two empty nodes between any two pairs of agents, is an equilibrium; observe that each agent has utility exactly , and jumping to an empty node would again give her exactly the same utility. Consequently, the price of anarchy of games with tree and line topologies is exactly , as desired. ∎
We now turn our attention to the price of stability. By arguing about the structure of the optimal assignment, and by exploiting the properties of a variant of the bestresponse dynamics which gives priority to agents of minimum utility, we are able to show an upper bound on the price of stability. We remark that this is the first upper bound on the price of stability in the literature on Schelling games that holds for arbitrary graphs, albeit only when there is a single type of agents.
Theorem 4.
The price of stability of modified Schelling games is at most .
Proof.
Consider any modified Schelling game, and let be its optimal assignment. We first claim that if there exists an agent with utility in , then must be an equilibrium, and thus the price of stability is . To see this, suppose otherwise that is not an equilibrium and there exist agents with utility . Since someone can benefit by jumping to an empty node , it must be the case that there exists an agent with utility who can increase her utility by jumping to too. The utility of will then increase by at least , the utility of the agents in will increase by some strictly positive quantity (since the number of their neighbors increases by one), while the utility of ’s single neighbor in , who has neighbors in (including ), will decrease by , where the inequality follows since the topology is a connected graph, which implies that . Since , the jump of to leads to a new assignment with strictly larger social welfare than , which contradicts the optimality of . So, it suffices to consider the case where all agents have utility at least in the optimal assignment.
We now claim that starting from the bestresponse dynamics according to which the agent with the minimum utility jumps in each step, terminates at an equilibrium in which there are at most two agents with utility , while all other agents have utility at least . This will imply that the maximum social welfare we can achieve at equilibrium is at least . Since the optimal social welfare is at most , we will obtain an upper bound of on the price of stability, as desired.
We use a recursive proof to show that starting with any assignment where the minimum utility among all agents is at least , we will either reach another assignment with minimum utility , or an equilibrium where at most two agents have utility . This is sufficient by the fact that the best response dynamics is guaranteed to terminate to an equilibrium (recall from the proof of Theorem 1 that the game admits a potential function).
Let denote the minimum number of neighbors an agent has in the current assignment. Let be an agent that has minimum utility . If , then ’s jump to an empty node will lead to a new assignment where every agent has at least neighbors, as desired. If , then ’s jump leads to at most two agents with utility exactly in the new assignment. If this assignment is an equilibrium, then we are done. Otherwise, we distinguish between the following two cases:
Case (1): There are two agents and who have utility and are connected to each other. According to the bestresponse dynamics we consider, one of these agents, say , will jump to an empty node to increase her utility to . The jump of will leave with utility , who subsequently will jump to get utility at least . If ’s best response yields her utility exactly , then there is no empty node adjacent to strictly more than one agents, which implies that the resulting assignment is an equilibrium, in which is the only agent with utility . Otherwise, all agents have utility at least in the new assignment.
Case (2): There is either only one agent with utility , or there is also another agent with utility such that and are not neighbors. If can increase her utility by jumping, then she will no longer have utility , but such a jump might leave her neighbor with exactly one neighbor (and utility ). However, observe that no other agent can end up with utility after ’s jump, which means that the number of agents with utility in the resulting assignment cannot increase. Again, we distinguish between Cases (1) and (2).
Therefore, by starting with the optimal assignment, the process described above will terminate at an equilibrium with at most two agents with utility , and the bound follows. ∎
We also show a lower bound on the price of stability, which establishes that even the best equilibrium assignment (in terms of social welfare) is not always optimal.
Theorem 5.
The price of stability of modified Schelling games is at least , for any constant .
Proof.
Consider a modified Schelling game with agents, where is a positive integer whose value will be determined later. The topology consists of multiple components: a clique with nodes, and independent sets , , such that , and for every ; observe that there are nodes in total. These components are connected as follows: Every node of is connected to every node of ; every node of is connected to every node of ; one node of is connected to one node of ; every node of is connected to every node of for . The topology is depicted in Fig. 1.
The optimal social welfare is at least as high as the social welfare of the assignment according to which the agents occupy all nodes except for those in . Since the agents in have neighbors each, the agents in have , the agents in have , and the agents in have again, we obtain
OPT  
Now, consider the assignment where the agents are placed at the nodes of . The agents in have neighbors each, the agents in have , and the agents in have . Since every agent has utility at least and would obtain utility at most by jumping to any of the empty nodes, is an equilibrium. Its social welfare is
We will now show that is the unique equilibrium of this game. Assume otherwise that there exists an equilibrium where at least one agent is at a node in for some . Let be an agent occupying a node of , where is the largest index among all such that contains at least one occupied node. Then, the utility of agent is at most (realized in case is fully occupied). Since agent has no incentive to jump to a node in , it must be the case that either there is no empty node therein, or each of these sets contains at most three occupied nodes. The first case is impossible since and we have assumed that agent occupies a node outside this set. Similarly, the second case is impossible since it implies that should contain at most occupied nodes, but the remaining agents do not fit in the nodes outside of this set. Therefore, the only possible equilibrium assignments are such that there is no agent outside , which means that is the unique equilibrium.
By the above discussion, we have that the price of stability is
which tends to as becomes arbitrarily large. ∎
We conclude this section with a result regarding the complexity of computing an assignment with maximum social welfare. Inspired by a corresponding result of Elkind et al. (2019), we show that, even in the seemingly simple case of modified Schelling games, maximizing the social welfare is NPhard.
Theorem 6.
Consider a modified Schelling game and let be a rational number. Then, deciding whether there exists an assignment with social welfare at least is NPcomplete.
Proof.
Membership in NP can be easily verified by counting the social welfare for a given assignment. To show hardness, we use a reduction from Clique. An instance of this problem consists of a graph and an integer . is a yesinstance if contains a clique of size , that is, it contains a subset of nodes such that every two of them are adjacent; otherwise it is a noinstance. Given , we can straightforwardly define a modified Schelling game with agents and topology the graph . If admits a clique of size , then we can achieve social welfare (which is the maximum possible for any game with agents) by assigning the agents to the nodes of the clique. Then, every agent has neighbors and utility , leading to a social welfare of . Otherwise, if there is no clique of size , then at least two agents will have utility at most , while every other agent will have utility at most , yielding social welfare strictly smaller than . ∎
4 Multitype Games
In this section, we consider the case of strictly more than one type of agents. We will show bounds on the price of anarchy and the price of stability, both for general games as well as for interesting restrictions on the number of agents per type or on the structure of the topology.
4.1 Arbitrary Graphs
We start by showing tight bounds on the price of anarchy for games on arbitrary graphs when there are at least two agents per type. When there is only one agent per type, any assignment is an equilibrium, and thus the price of anarchy is . When there exists a type with at least two agents and one type with a single agent, the price of anarchy can be unbounded: Consider a star topology and an equilibrium assignment according to which the center node is occupied by this lonely agent; then, all agents have utility . In contrast, the assignment according to which an agent with at least one friend occupies the center node guarantees positive social welfare.
Theorem 7.
The price of anarchy of modified Schelling games with at least two agents per type is exactly .
Proof.
For the upper bound, consider an arbitrary modified Schelling game in which there are agents of type . Clearly, the maximum utility that an agent of type can get is when she is connected to all other agents of her type, and only them. Consequently, the optimal social welfare is
(1) 
Now, let be an equilibrium assignment, according to which there exists an empty node which is adjacent to agents of type , such that for at least one type ; let . We will now count the contribution of each type to .

. In order to not have incentive to jump to , every agent of type must have utility at least if she is not adjacent to , or otherwise. Hence, the contribution of all agents of type to the social welfare is at least

Let and be the two agents of type . First observe that it cannot be the case that since then both and would have utility and incentive to jump to to connect to each other, and thus increase their utility to positive. So, . If and is adjacent to , then and must be neighbors, since otherwise they would both have utility , and would want to jump to to increase her utility to positive. Hence, has utility at least and has utility at least . Overall, the contribution of the two agents of type is
Let be the set of all types with exactly two agents. By the above discussion, the social welfare at equilibrium is
If , since , we obtain
Otherwise, we have
Since , it is , and thus in any case. By (1), the price of anarchy is at most .
Observe that the proof of the upper bound implies that the worst case occurs when at equilibrium there exists an empty node that is adjacent to a single agent of some type such that there are only two agents of type . Using this as our guide for the proof of the lower bound, consider a modified Schelling game with agents who are partitioned into types such that there are agents of type and agents of type . The topology consists of a star with a center node and leaf nodes , as well as cliques such that has size . These subgraphs are connected as follows: is connected to a single node of for each ; see Fig. 2.
Clearly, in the optimal assignment the agents of type are assigned to the nodes of clique so that every agent is connected to all other agents of her type, and only them. Consequently, the optimal social welfare is exactly
On the other hand however, there exists an equilibrium assignment where is occupied by one of the agents of type and all other agents occupy the leaf nodes . Then, only the two agents of type have positive utility, in particular, and , respectively. Hence, the price of anarchy is at least
This completes the proof. ∎
From the above theorem it can be easily seen that the price of anarchy can be quite large in general. This motivates the question of whether improvements can be achieved for natural restrictions. One such restriction is to consider balanced games in which the agents are evenly distributed to the types, so that there are exactly agents per type. In the following we will focus exclusively on balanced games.
Theorem 8.
The price of anarchy of balanced modified Schelling games with at least two agents per type is exactly .
Proof.
For the upper bound, consider an arbitrary balanced modified Schelling game in which there are agents of each type . By (1), we have that the optimal social welfare is
Now, let be an equilibrium assignment according to which there exists an empty node which is adjacent to agents of type , such that for at least one type ; let . In order to not have incentive to jump to , each of the agents of type that is not adjacent to must have utility at least , and each of the agents of type that is adjacent to must have utility at least . Hence,
(2) 
Since , the social welfare is
(3) 
which yields that the price of anarchy is at most .
For the lower bound, consider a balanced modified Schelling game with four agents per type; so, there are agents. The topology consists of several components. There is a starlike tree with root node , which has children such that the first are leaves, while has a single child which, in turn, has two children , and which are leaves. There are also cliques such that each has size . These subgraphs are connected as follows: is connected to a single node of for each ; see Fig. 3.
In the optimal assignment, the agents of type are assigned to the nodes of clique so that every agent is connected to all other agents of her type, and only them. Consequently, the optimal social welfare is exactly . On the other hand, there exists an equilibrium assignment where is occupied by an agent of type , the nodes are occupied by the agents of type different than , and the nodes are occupied by the remaining agents of type . Then, the only agents with positive utility are those occupying the nodes. In particular, each of them has utility exactly , and therefore the price of anarchy is at least
This completes the proof. ∎
We continue by presenting a lower bound on the price of stability for modified Schelling games, which holds even for the balanced case.
Theorem 9.
The price of stability of modified Schelling games is at least , for any constant .
Proof.
Consider a balanced modified Schelling game with agents, such that half of them are red and half of them are blue. We set and let
be an odd positive number to be defined later. The topology consists of a clique
with nodes, and two independent sets , with and . Every node in is connected to every node in ; see Fig. 4.The optimal social welfare is at least as high as that of the assignment according to which all nodes of are occupied by red agents, each node of is occupied by a blue agent, while the remaining red and blue agents occupy nodes of ; note that a node of remains empty. The red agents at have utility , the blue agents at have utility , the red agents at have utility , and the blue agents at have utility . Putting everything together, we have that
OPT  
(4) 
where, the second inequality holds since .
Our next step is to argue about the structure of any equilibrium assignment. Consider an equilibrium and let , , and be the number of red agents in , , and , respectively. We define , , and for the blue agents accordingly. We first claim that . Assume otherwise that (without loss of generality). This implies that the red agents in and the blue agents in have utility strictly less than ; the existence of at least one blue agent in is guaranteed by the fact that there can be at most one empty node in and there are at least two red agents are in . We now enumerate the empty node:

The empty node is in . Then, any red agent in has incentive to jump to the empty node, as then she would obtain utility .

The empty node is in . Then, any blue agent in has incentive to jump to the empty node since her utility would become .

The empty node is in . If , then a red agent in has incentive to jump to the empty node since her utility would be . Otherwise, a blue agent in has incentive to jump to the empty node since her utility would be which is strictly larger than her current utility of ; this holds since and .
We also claim that . This holds since is odd, , and . Consequently, the social welfare of any equilibrium is
(5) 
In the first inequality, the first term bounds from above the utility from the (at most) agents in , each of which has utility at most , while the second term bounds from above the utility from the (at most) agents in ; each such agent has at most neighbors of the same type and at least neighbors in total.
We now show that there exists an equilibrium for this game. Consider the assignment where hosts red agents, hosts red and blue agents, while hosts red and blue agents; thus, a node in remains empty. It is not hard to see that no agent has an incentive to jump to the empty node.
4.2 Line Graphs
We now turn our attention to balanced modified Schelling games on restricted topologies. We start with the case of line graphs, and show the following statement.
Theorem 10.
The price of anarchy of balanced modified Schelling games on a line is exactly for , and exactly for .
The proof of the theorem will follow by the next three lemmas, which show upper and lower bounds for and .
Lemma 11.
The price of anarchy of balanced modified Schelling games on a line is at most .
Proof.
Consider an arbitrary balanced modified Schelling game on a line. Let there be agents, with half of them red and half of them blue. Since the topology is a line, in the optimal assignment the agents of same type are assigned right next to each other and the two types are wellseparated by an empty node (which exists). Consequently, for each type, there are two agents with utility and agents with utility , and thus
(6) 
Now, let be an equilibrium assignment, and consider an empty node which, without loss of generality that, is adjacent to a red agent . We distinguish between three cases:
is adjacent to another red agent . Then, cannot be an equilibrium. If and are the only red agents, they get utility and want to jump to to get . Otherwise, there exists a third red agent that gets utility at most (by occupying at best the end of a red path) who wants to jump to to get .
is also adjacent to a blue agent . Since is connected to a red and a blue agent, every agent must have utility at least in order to not want to jump to . However, observe that defines two paths that extend towards its left and its right. The two agents occupying the nodes at the end of these paths must be connected to friends and have utility ; otherwise they would have utility and would prefer to jump to . Therefore, we have two agents with utility exactly and agents with utility at least ; we do not really know anything about the utility of and . Putting all these together, we obtain
and the price of anarchy is at most .
is a leaf or is adjacent to an empty node. Any of the remaining red agents must have utility at least in order to not have incentive to jump to . So, all red agents are connected only to red agents, which further means that is also connected to another red agent (otherwise she would be isolated, have utility and incentive to jump), and all blue agents are only connected to other blue agents. Therefore, everyone has utility at least , yielding price of anarchy at most . ∎
Lemma 12.
For every , the price of anarchy of balanced modified Schelling games on a line is at most .
Proof.
Consider an arbitrary balanced modified Schelling game on a line with types. We will first establish two upper bounds on the social welfare of the optimal assignment for two different cases. Since the topology is a line, the optimal assignment is such that the agents of same type are assigned right next to each other and the types are wellseparated, depending on the number of empty nodes.
No matter how many empty nodes there are, a straightforward upper bound on the optimal social welfare OPT is obtained by assuming that all types can be separated. Then, for each type, there are two agents with utility and agents with utility . By summing over all types, we obtain
(7) 
We also consider the special case where the game is such that there is only one empty node; that is, the line has nodes. Let denote the optimal social welfare for such a game. Then, only one type can be wellseparated, for which there are two agents with utility and with utility . For two of the other types, there is one agent with utility (the one that is either next to the empty node or positioned at the end of the line), one agent with utility (connecting this type to another one), and agents with utility . For the remaining types, there are two agents with utility and agents with utility . Putting everything together, we obtain
(8) 
Now consider an equilibrium assignment . We say that an empty node is open if it is adjacent only to other empty nodes, openended if adjacent to only one agent, and closed if it is adjacent to two agents of different type. Observe that the existence of an open empty node implies the existence of an openended empty node, but not vice versa. Moreover, empty nodes that are adjacent to two agents of the same type cannot appear as then would not be an equilibrium: If there are two agents per type, then these two agents would want to jump to the empty node to connect to each other. Otherwise, there exists another agent of the same type with utility at most who would prefer to jump and increase her utility to . We now distinguish between cases.
There are no closed empty nodes. Then, there exists an openended empty node that is adjacent to an agent of some type , which means that the remaining agents of type must have utility at least in order to not have incentive to jump to . For this to be possible, all these agents of type must be connected only to agents of type . This further means that agent must also be connected to other agents of type ; otherwise there would exist an openended empty node where would have incentive to jump. Since all agents of type are connected only to agents of type , there must exist another openended empty node that is adjacent to an agent of some type . By repeating the above argument recursively, we can now easily show that all agents are connected only to agents of their own type and thus have utility at least . Hence, . Moreover, from (7) we immediately have that , which implies that the price of anarchy is at most .
There is at least one closed and one openended empty node. Let be the type of the agent who is adjacent to the openended empty node. Then, all agents of type must have utility at least so that they do not have incentive to jump to this empty node. Let be the type of one of the agents who is adjacent to the closed empty node. Then, each of the remaining agents of type must have utility at least in order to not have incentive to jump. Consequently, we have that
By (7), we have that the price of anarchy is at most
where the last inequality follows by the fact that .
There are only closed empty nodes. We will now distinguish between a few more subcases as follows:

. Consider any of the closed empty nodes. Let and be the two agents that are adjacent to this empty node. Then, the only friend of must be connected to in order to get positive utility and not have incentive to jump to the empty node (in which case she would get utility ). Similarly, the only friend of must be connected to . Therefore, we have at least two agents ( and ) with utility and two agents (’s friend and ’s friend) with utility , yielding
In this case, the upper bound on the optimal social welfare from (7) can be simplified to , and thus the price of anarchy is at most . So, in the following cases we assume that .

There is a single empty node. This node is inbetween two agents of different types, say and . Hence, all the remaining agents of types and must have utility at least in order to not have incentive to jump to the empty node. Therefore, we have that
By (8) and since , we now obtain the following bound on the price of anarchy:

There are at least two empty nodes. Consider an agent of type who is adjacent to one of the empty nodes. Then, all the remaining agents of type must have utility at least in order to not have incentive to jump to the empty node. Thus, if there exists another agent of type who is adjacent to a different empty node, then all agents of type have utility at least . Let be the number of different types with at least one agent adjacent to an empty node, and let be the number of these types with at least two agents adjacent to empty nodes. We have that
By (7), the price of anarchy is
If , then since there are at least two empty nodes, we have that . Combined with the assumption that , we obtain
On the other hand, if , then since and the function is nondecreasing in , we have that
This completes the proof. ∎
Lemma 13.
The price of anarchy of balanced modified Schelling games on a line is at least for and for .
Proof.
We consider balanced modified Schelling games with three agents per type on a line with