## Figures

## Abstract

Resources are rarely distributed uniformly within a population. Heterogeneity in the concentration of a drug, the quality of breeding sites, or wealth can all affect evolutionary dynamics. In this study, we represent a collection of properties affecting the fitness at a given location using a color. A green node is rich in resources while a red node is poorer. More colors can represent a broader spectrum of resource qualities. For a population evolving according to the birth-death Moran model, the first question we address is which structures, identified by graph connectivity and graph coloring, are evolutionarily equivalent. We prove that all properly two-colored, undirected, regular graphs are evolutionarily equivalent (where “properly colored” means that no two neighbors have the same color). We then compare the effects of background heterogeneity on properly two-colored graphs to those with alternative schemes in which the colors are permuted. Finally, we discuss dynamic coloring as a model for spatiotemporal resource fluctuations, and we illustrate that random dynamic colorings often diminish the effects of background heterogeneity relative to a proper two-coloring.

## Author summary

Heterogeneity in environmental conditions can have profound effects on long-term evolutionary outcomes in structured populations. We consider a population evolving on a colored graph, wherein the color of a node represents the resources at that location. Using a combination of analytical and numerical methods, we quantify the effects of background heterogeneity on a population’s dynamics. In addition to considering the notion of an “optimal” coloring with respect to mutant invasion, we also study the effects of dynamic spatial redistribution of resources as the population evolves. Although the effects of static background heterogeneity can be quite striking, these effects are often attenuated by the movement (or “flow”) of the underlying resources.

**Citation: **Kaveh K, McAvoy A, Chatterjee K, Nowak MA (2020) The Moran process on 2-chromatic graphs. PLoS Comput Biol 16(11):
e1008402.
https://doi.org/10.1371/journal.pcbi.1008402

**Editor: **Mark Broom,
University of Sussex, UNITED STATES

**Received: **March 25, 2020; **Accepted: **September 27, 2020; **Published: ** November 5, 2020

**Copyright: ** © 2020 Kaveh et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

**Data Availability: **All relevant data are within the manuscript.

**Funding: **Army Research Laboratory (grant W911NF-18-2-0265) (M.A.N.); the Bill & Melinda Gates Foundation (grant OPP1148627) (M.A.N.); the NVIDIA Corporation (A.M.). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

**Competing interests: ** The authors have declared that no competing interests exist.

## Introduction

The survival of a mutant introduced into a population depends on its fitness as well as environmental factors, including the population’s spatial structure. Variations in migration patterns or dispersal can be modeled using a graph, where nodes represent individuals and edges represent neighborhoods. On such a graph, a standard measure of a mutant’s success is the probability that it takes over the population (“fixes”) [1–10]. It is known that there is a class of structures, which includes regular graphs, in which all graphs have the same fixation probabilities as those of an unstructured population, a result called the “isothermal theorem” [11]. Our concern here is with an analogue of this result for colored graphs, where each color represents a collection of fitness-influencing resources, in order to work toward a better understand the effects of background fitness heterogeneity on evolutionary dynamics.

Resource heterogeneity naturally results in variations in environmental conditions. For example, the local concentrations of nutrients (sugar) can vary across a population of *E. coli* bacteria. Locations with higher sugar concentration lead to higher reproductive fitness. However, in populations with more than one type of individual, resource heterogeneity can affect the fitness of the different types asymmetrically. Competing *E. coli* strains often metabolize different sugar types (e.g. glucose or lactose). Thus, variations in the concentration of one sugar type predominantly affect the fitness of one *E. coli* strain and not the other [12, 13]. The evolution of drug resistance is another notable example. The existence of a variable drug distribution across a population (e.g. a drug “gradient”) can have a strong effect on the onset of drug resistance in microbial evolution [14, 15]. Similar observations have been made in the contexts of virus [16–21] and cancer [22, 23] dynamics.

Driven by the ubiquity of heterogeneity within populations, there has been growing interest in understanding how it affects selection in simple mathematical models. Much of this work, ranging from earlier models in population genetics [24–27] to those with more fine-grained spatial structure [28–35], is summarized in a prequel to this study [36] (which deals with well-mixed dispersal structures and spatially-modulated fitness). However, a general understanding of the effects of heterogeneous resource distributions within structured populations is still lacking. The subtlety of resource heterogeneity in evolutionary dynamics arises from the interplay of several different parameters: the spatial structure and migration patterns in the population; how each genotype is affected by different concentrations of the resource; the spatial distribution of resources themselves; and finally the fitness of each competing type in the absence of heterogeneity. Due to this complexity, a good deal of the work in this area has been done through numerical simulations of agent-based models with specific structures and fitness distributions.

In this work, we consider heterogeneous resource distributions in graph-structured populations. A distribution of resources within a structured population can be represented by a colored graph, wherein the color of a node represents the resources at that location [30]. Our primary focus is on properly two-colored graphs, which have two distinct node colors together with the property that no two nodes of the same color are neighbors. Each node holds one individual, either a mutant (type *A*) or a resident (type *B*). For evolutionary updating on such a graph, we consider a variant of the well-known Moran process [37], which is a birth-death process with one replacement in each time step. A proper two-coloring of the graph in this context implies that an offspring’s resources are always different from those of the parent (except, of course, from the trivial case in which the colors have no meaningful effects on the types).

The first question we ask is which population structures and resource distributions result in the same evolutionary dynamics, as measured by the fixation probability of an invading mutant. For properly two-colored graphs in which all nodes of a given color have the same degree (“biregular”), we give an explicit formula for the fixation probability of a rare mutant that is valid for any intensity of selection (Theorem 1). We use this formula to derive a simple condition for when selection favors the mutant type relative to the resident (Theorem 2): if *g*_{A} and *g*_{B} are the geometric means of the fitness values of *A* and *B*, respectively, on the two possible colors of the nodes, then selection favors *A* relative to *B* if and only if *g*_{A} > *g*_{B}.

We then consider the effects of resource redistribution within a fixed structure, focusing on the notion of an “optimal” distribution of resources with respect to the evolutionary process. On a cycle, a proper two-coloring is typically optimal in the following sense: any reshuffling of colors away from a proper two-coloring leads to a decrease in fixation probability for advantageous mutants and an increase in fixation probability for disadvantageous mutants. We find that this behavior reversed on the star, and it lies somewhere in between on other bipartite graphs with unequal numbers of green and red nodes.

Finally, we explore dynamic graph colorings arising from resource mobility. Resources are redistributed occasionally through a shuffling of the node colors. We find that resource mobility attenuates the effects of background heterogeneity, at least when the level of background heterogeneity is not too large. In some cases, when redistribution occurs at every time step, the effects of background heterogeneity can be completely offset.

## Results

We begin by modeling the spatial structure of a population with a graph, in which vertices represent locations and edges represent neighbors. The adjacency matrix of this graph, , satisfies Γ_{ij} = 1 if *i* and *j* are neighbors and Γ_{ij} = 0 otherwise. There are two types of individuals on the graph, mutants (*A*) and residents (*B*), and each vertex is occupied by exactly one of these two types. When the individual at vertex *i* reproduces, the offspring is propagated to vertex *j* with probability Γ_{ij}/Γ_{i}, where is the out-degree of vertex *i*. The Moran process [37] is obtained by choosing one individual to reproduce in each time step, with probability proportional to fitness.

Whereas it is usually assumed that the fitness of *i* depends on only its type (*A* or *B*), here we are concerned with fitness that depends on local environmental conditions in addition to an individual’s type. To include environmental conditions, we assume that each vertex is assigned a color. For simplicity, we focus on graphs with two possible colors, green and red. For example, a green node might be rich in resources while a red node is poorer. More colors can be used to model a broader spectrum of resource values. We assume the total abundance of resources is constant and does not get degraded over time, which implies that the number of nodes of any given color remains fixed over the course of the evolutionary process.

A vertex coloring, , is a function that maps every vertex to a discrete set of values (color set). A coloring map, , is *proper* if no two nodes of the same color are connected to each other, i.e. whenever Γ_{ij} = 1. A graph is called *n*-colorable if it can be properly colored with *n* colors. A graph with *N* vertices is trivially *N*-colorable, but often times a graph can be properly colored with fewer colors. The smallest number of colors for which a proper coloring is possible is known as the *chromatic number* of the graph [38]. We are interested in graphs whose chromatic number is 2, which are also known as “2-chromatic” or “bipartite” graphs (see Fig 1).

If the fitness of *A* and *B* are *a*_{G} and *b*_{G} on a green site and *a*_{R} and *b*_{R} on a red site, respectively, then on each of these graphs we can explicitly calculate the probability that one type replaces the other (Theorem 1).

The effects of a color on fitness are described by a *color-to-fitness map*, which maps each color to an ordered set of fitness values, one for each type. For example, in the space of two types, *A* and *B*, and two colors, green (G) and red (R), the color-to-fitness map can be specified succinctly by a payoff matrix,
(1)

In other words, on a green node, *A* has fitness *a*_{G} and *B* has fitness *b*_{G}. On a red node, *A* has fitness *a*_{R} and *B* has fitness *b*_{R}. In evolutionary game theory, such a payoff matrix is usually used to define payoffs for one type against another. Here, this matrix gives the payoffs for a type against the environment.

To quantify the effects of the coloring scheme on evolutionary dynamics, we study the mutant type’s fixation probability, *ρ*_{A}, which is the probability that a single, randomly-placed *A* eventually takes over a background population of type *B*. Similarly, the probability that a single *B* fixes in a background population of type *A* is denoted by *ρ*_{B}. Selection is said to favor *A* relative to *B* if *ρ*_{A} > *ρ*_{B} [39, 40]. For all graphs of the variety depicted in Fig 1, we can calculate fixation probabilities explicitly:

**Theorem 1**. Consider a graph with a proper two-coloring, with *N*_{G} green nodes and *N*_{R} red nodes. If every green node has degree *k*_{G} and every red node has degree *k*_{R}, then the mean fixation probability of *A* appearing uniformly at random in a background population of *B* is
(2)

Similarly, the mean fixation probability of *B* appearing uniformly at random in a background population of *A* is
(3)

**Remark 1**. Under the assumptions of Theorem 1, we must have *N*_{G}*k*_{G} = *N*_{R}*k*_{R}. Thus, *N*_{G} = *N*_{R} if and only if *k*_{G} = *k*_{R} (the graph is regular), in which case *ρ*_{A} is independent of the degree.

From Theorem 1, we can derive a simple condition for selection to favor *A*:

**Theorem 2**. For a graph satisfying the hypotheses of Theorem 1,
(4)

We give proofs of Theorems 1–2, as well as an extension to weighted, directed graphs, in the Appendix.

### Parametrizing heterogeneity

Let *r*_{A} and *r*_{B} represent the mean fitness values of *A* and *B*, respectively, over all locations in the population, i.e.
(5a) (5b)

The difference between the fitness of *A* on a green node, *a*_{G}, and the mean fitness of *A*, *r*_{A}, is denoted . Similarly, for type *B* on a green node, we let . Since we usually consider green nodes to be beneficial, it is typically the case that . In this way, these two parameters quantify the (beneficial) effects of green nodes on the two types. On the other hand, red nodes are usually deleterious, which means that the quantities and are at least zero and quantify the degree to which red nodes are harmful to the two types. By Eq 5, we must have and . In particular, the heterogeneity can be parametrized by just two values, (mutant heterogeneity) and (resident heterogeneity). (Note, however, that these parameters are added to fitness on green nodes and subtracted from fitness on red nodes.) By Theorem 2, the selection condition is
(6)

Fig 2 illustrates this selection condition when *N*_{G} = *N*_{R} = 50, *r*_{A} = 1.5, and *r*_{B} = 1.

The graph is bipartite, regular, and properly two-colored with *N*_{G} = *N*_{R} = 50. The difference between fixation probabilities of the two types, *ρ*_{A} − *ρ*_{B}, is shown for several values of *σ*_{A} and *σ*_{B} when *r* = 1.5. Warmer colors represent greater differences between the fixation probabilities, *ρ*_{A} − *ρ*_{B}. *A* is neutral relative to *B* if and only if .

Several natural special cases emerge from this general accounting of heterogeneity:

*(i)*symmetric environmental interactions:*σ*_{A}=*σ*_{B};*(ii)*asymmetric environmental interactions:*σ*_{A}= −*σ*_{B};*(iii)*mutant heterogeneity:*σ*_{B}= 0;*(iv)*resident heterogeneity:*σ*_{A}= 0.

Note that each of these cases is a one-parameter model of heterogeneity. Our main focus here is on *(i)*, where the coloring affects the fitness of the two types symmetrically. We refer to this case as “heterogeneous background fitness” and use *σ* to denote the parameter *σ*_{A}. For simplicity, we also let *r*_{B} = 1 and *r* ≔ *r*_{A}.

For example, if *N*_{G} = *N*_{R} = *N*/2, then, under heterogeneous background fitness, Eq 2 simplifies to
(7)

From this expression, we see that the fixation probability of a mutant is an increasing function of *σ* when the mutant is advantageous (*r* > 1), a decreasing function of *σ* when the mutant is disadvantageous (*r* < 1), and independent of *σ* when the mutant is neutral (*r* = 1). This result is depicted in Fig 3 on a graph with *N*_{G} = *N*_{R} = 5.

Background heterogeneity increases the fixation probability of an advantageous mutant (black lines) and decreases that of a disadvantageous mutant (white lines). These effects are monotonic in background heterogeneity, *σ*. By Theorem 1, this behavior is identical to that of a regular (not necessarily complete) properly two-colored graph with equal numbers of green and red nodes.

### Resource redistribution and optimal colorings

On a colored graph, shuffling the node colors does not change the overall number of each color present in the population. In other words, shuffling leaves the total resource value constant. Having established formulas for fixation probabilities on biregular, properly two-colored graphs, we now turn to fixation probabilities on graphs with various permutations of proper two-colorings. This model of permuted colorings is related to (and inspired by) the work of [32], which explores how increasing the standard deviation of a bimodel fitness distribution affects fixation probabilities in simple structured populations. In the model we consider, we permute the colors at the beginning of the process and then leave them fixed for the remainder.

On the cycle, we find that shuffling the colors away from a proper two-coloring attenuates the effects of background heterogeneity (Fig 4a). On the star with *N*_{G} = 1 and *N*_{R} = *N* − 1, there are just two non-isomorphic colorings, one proper and one non-proper. Moving from the proper coloring to the non-proper coloring increases an advantageous mutant’s fixation probability and decreases that of a disadvantageous mutant (Fig 4b), which is strictly the opposite of the behavior observed for the cycle. In between these two population structures is a complete bipartite graph with 1 < *N*_{G} < *N*_{R} < *N*. On such a structure, the effects of moving away from a proper coloring are not quite as uniform: for some values of background heterogeneity, an advantageous mutant’s fixation probability is increased, while it is decreased for other values of *σ* (Fig 4c).

In each panel, we plot fixation probability against background heterogeneity for all (non-isomorphic) permutations of the proper two-coloring shown at the top. The proper two-coloring in each case is depicted in black, which is given by Eq 2. **a**, On the cycle, the proper two-coloring is “optimal” in the sense that it gives the maximum fixation probability for an advantageous mutant and the minimum fixation probability for a disadvantageous mutant. **b**, On the star, we observe the opposite behavior, with the proper two-coloring giving the minimum fixation probability for an advantageous mutant and the maximum for a disadvantageous mutant. **c**, On a complete bipartite graph with *N*_{G} ≠ *N*_{R} (shown here with *N*_{G} = 3 and *N*_{R} = 7), a mixture of these two results is possible. In particular, there need not be a coloring that is “optimal” for all levels of background heterogeneity. The fixation probabilities in all panels were approximated by building transition matrices for each process and looking at the exact distribution after 10^{7} steps.

### Dynamic coloring and resource mobility

So far, we have considered the case in which resources (and thus environmental conditions) are spatially distributed across the population but fixed over time. In many cases, resources and local conditions change over time as well. For example, an area with rich soil or a good climate can deteriorate with time, leading to poorer conditions (and vice versa). Resource agents, such as nutrients in a heterogeneous population of bacteria, can be mobile and diffuse across an evolving population. It is therefore natural to consider the effects of heterogeneity on evolutionary dynamics when the distribution of resources is itself dynamic.

Spatial and temporal heterogeneity have been observed (separately) to have quite different effects on the fixation probability of a mutant [35]. Here, we consider a model that combines these two kinds of heterogeneity. For simplicity, we focus on a graph-structured population with two colors. We consider a simple model of dynamic coloring in which, at each time step, the colors on the graph are shuffled according to a random permutation. To control the speed of resource movements, we assume that a shuffling happens with some fixed probability, *p*. With probability 1 − *p*, there is no movement and the color scheme remains the same as it was in the previous time step. This model is similar to others involving “motion” [41, 42], except here it acts on resources rather than traits.

As examples, we consider an undirected cycle, star, and another complete bipartite graph with *N*_{G} ≠ *N*_{R} for several values of the shuffling rate, *p*. Fig 5 shows the fixation probability as a function of *σ* starting from a two-colored assignment. For *p* = 0, Theorem 1 gives the exact fixation probability of *A*. As *p* increases, the effects of resource heterogeneity weaken, as long as the level of background heterogeneity is not too high. However, when background heterogeneity is sufficiently strong and the population is asymmetric, resource mobility can actually strengthen the effects of heterogeneity on a mutant’s fixation probability, relative to the fixed proper two-coloring when *p* = 0 (Fig 5c).

*ρ*_{A} is shown here as a function of resource heterogeneity, *σ*, for several values of the resource redistribution rate, *p*, and mutant mean fitness, *r*. The population initially has a proper two-coloring. At each time step, with probability *p* the colors are shuffled according to permutation chosen uniformly at random. With probability 1 − *p*, the coloring is not changed in that time step. In **a** and **b**, high environmental fluctuations (i.e. large *p*) attenuate the effects of background heterogeneity relative to the initial distribution of resources at *p* = 0 (corresponding to a proper two-coloring, shown in black and given by Eq 2). In **c**, this behavior holds for all but the highest levels of background heterogeneity. The fixation probabilities in all panels were approximated by building transition matrices for each process and looking at the exact distribution after 10^{7} steps.

## Discussion

Sources of heterogeneity abound in nature, at all scales. The distribution of a drug across a tumor can be highly heterogeneous due to non-uniformity in the vasculature as well as in the tumor’s tissue-like structure [23]. A good breeding site may give a bird an advantage, which is sometimes connected to its own behavior [43]. A good school district can have a profound impact on one’s education and career progression [44], and inherited wealth may positively affect reproductive success [45]. On the flip side, many modeling scenarios require environmental heterogeneity together with frequency-dependent fitness (i.e. “games”). Provided selection is sufficiently weak, analytical results on the effects of heterogeneity on an evolving population can be derived in that setting as well [46]. In contrast, the analytical results presented here hold for *any* selection strength, with the trade-off being that they require the assumptions of frequency-independent fitness and sufficient regularity in the population structure and coloring scheme.

While these assumptions are somewhat restrictive, they allow for a formal analysis of the model that reveals several interesting effects of background heterogeneity. When heterogeneity affects the two types (*A* and *B*) in the same way, it can increase an advantageous mutant’s fixation probability and decrease that of a disadvantageous individual. As the graph becomes more heterogeneous, here in the form of having unequal numbers of green and red nodes, both the effects of heterogeneity and the relationship between proper and non-proper colorings on the graph grow more nuanced. Our focus here was on an analogue of the isothermal theorem [11] for colored graphs, but other classes of colorings on more complicated heterogeneous graphs would also be relevant for understanding the evolutionary implications of background heterogeneity.

In addition to earlier work in population genetics, several steps have recently been taken to better understand the roles of heterogeneity in evolutionary dynamics [29, 31–33, 35, 36, 47]. However, a complete picture remains elusive. Due to the complexity of analyzing models that account for heterogeneity, such an understanding likely will not emerge for some time. Given the rapid development of the Moran model in structured populations over the past decade-and-a-half, we see generalizations involving both spatial and temporal resource heterogeneity to be natural next steps, both for their mathematical intrigue and their applicability to the heterogeneity that is present in nearly every natural population.

## Methods

### Calculating fixation probabilities

Consider a colored graph of size *N* in which each node is occupied by a single individual of type *A* (mutant) or *B* (resident). The fitness of a type depends on both the type itself and the color of its node. We denote the fitness of *A* and *B* at location *i* by *a*_{i} and *b*_{i}, respectively. The fitness values belong to a finite set defined by the number of colors. For example in case of two colors, green and red, the possible fitness sets for mutants are two values, *a*_{i} ∈ {*a*_{G}, *a*_{R}}, where *a*_{G} and *a*_{R} denote the fitness of *A* on green and red sites, respectively. Our focus is on graphs with two colors, having *N*_{G} green nodes and *N*_{R} red nodes.

#### Directed, weighted graphs.

The probability that an offspring produced at site *i* replaces an individual residing at a neighboring location, *j*, is determined by a directed, weighted dispersal graph with matrix , having no self-loops (meaning *w*_{ii} = 0 for *i* = 1, …, *N*). In a standard extension of the Moran model to graphs, an individual at location *i* replaces *j* with probability proportional to the product of *i*’s fitness and the edge weight *w*_{ij} [11]. The overall structure of the population is defined by both this dispersal graph and the coloring of the nodes.

A state of the process can be described by a vector, **x** ∈ {0, 1}^{N}, where *x*_{i} = 1 (resp. *x*_{i} = 0) indicates that the individual at location *i* has type *A* (resp. *B*). The total fitness of type *B* in the population is . Multiplying each location *j* by the edge weight *w*_{ji} if *i* has type *A* (and by 0 otherwise), we see that the probability of losing a mutant in location *i* is proportional to , where the term (1 − *x*_{j})*b*_{j} corresponds to the birth of type *B* and *w*_{ji} *x*_{i} corresponds to the death of a neighboring type *A*. Similarly, the probability of gaining a mutant at location *i* is proportional to . Finally, the probability that location *i* neither gains nor loses a mutant is proportional to
(8)

It follows that the probabilities of losing and gaining a mutant in state **x** are
(9a) (9b)
respectively. Conditioned on a change in mutant frequency (meaning the process cannot remain in the same state, provided this state is non-absorbing), the transition probabilities are given by
(10a) (10b)

For and **x** ∈ {0, 1}^{N}, let *ζ*^{x} denote the product . Let {*X*_{n}}_{n⩾0} represent the state of the process, with *X*_{n} = **x** indicating that the state of the population at time *n* is **x**. Due to the well-known connection between fixation probabilities and martingales [48], we are first interested in finding for which is a martingale with respect to {*X*_{n}}_{n⩾0}, which means that for every *n* ⩾ 0. Since {*X*_{n}}_{n⩾0} is a Markov chain and the law of *X*_{n+1} depends on only *X*_{n}, it suffices to find such that . Using Eq 9, we see that
(11)

Therefore, by Eqs 9 and 10, the equation is equivalent to (12)

By Eq 10, we see that Eq 12 holds for every **x** ∈ {0, 1}^{N} if and only if
(13)
for every **x** ∈ {0, 1}^{N}. The right-hand side of Eq 13 is a multi-linear polynomial representation of a pseudo-Boolean function (i.e. a mapping ) that is identically zero, so its coefficients must also all be zero by uniqueness of this representation [49, 50]. Therefore, for every *i*, *j* = 1, …, *N*, we obtain the system of equations
(14a) (14b)

Let *ρ*_{A}(**x**) denote the fixation probability of type *A* when starting in the initial configuration **x** ∈ {0, 1}^{N}. If there exist solving Eq 14, then it is well-known that the martingale property yields
(15)
[36, 48]. Solving for *ρ*_{A}(**x**) gives a fixation probability of
(16)

Thus, in what follows, we can reduce the problem of calculating fixation probabilities to finding that satisfy Eq 14.

In general, there need not be a solution to Eq 14. However, with a few simplifying assumptions, we can reduce this system of equations to something more manageable. Specifically, we seek a solution to this system for which *ζ*_{i} depends on only the color of *i*. For every node *i*, we use the notation *i* ∼ G (resp. *i* ∼ R) to denote that *i* is colored green (resp. red). The first assumption is that the graph is properly two-colored, which means that *w*_{ij} = 0 whenever *i*, *j* ∼ G or *i*, *j* ∼ R. The second assumption is that the indegree is the same for all nodes of the same color, as is the outdegree. Let and (resp. and ) denote the indegree and outdegree, respectively, of green (resp. red) nodes. Under these assumptions, such a solution to Eq 14a requires
(17a) (17b)

It is straightforward to see that the unique solution to these equations is given by (18a) (18b)

Now, the equation resulting from the quadratic terms of Eq 14, i.e. Eq 14b, requires (19a) (19b)

For the expressions in Eq 18 to satisfy Eq 19 as well, it must be the case that (20)

On a graph satisfying these properties, Eq 16 says that the fixation probability of a mutant whose initial location is chosen uniformly at random is thus (21)

#### Undirected, unweighted graphs.

The process described in the previous section is a modification of the Moran process due to [11] that allows for general, weighted and directed graphs. When the graph is undirected and unweighted, the Moran process described in the main text can be recovered with an appropriate choice of . Suppose that is the adjacency matrix for such a graph, i.e. Γ_{ij} ∈ {0, 1} and Γ_{ij} = Γ_{ji} for every *i*, *j* = 1, …, *N*. As before, we assume that there are no self-loops in the graph, so Γ_{ii} = 0 for *i* = 1, …, *N*. We let the probability of transitioning from *i* to *j* in one step of a random walk on the graph be . If an individual is selected for reproduction with probability proportional to fitness, and the offspring is subsequently propagated to a random neighboring node, then the probabilities of losing and gaining a mutant at location *i* in state **x** ∈ {0, 1}^{N} are
(22a) (22b)
respectively. Note that these equations are identical to those of Eq 9 when .

Since is stochastic, the outdegree of every node is 1. Suppose that this graph is bipartite and properly two-colored, with *N*_{G} green nodes and *N*_{R} red nodes (see Fig 1). Following our assumptions in the last section, we assume here as well that all nodes of a given color have the same indegree. Let and denote the indegrees of green and red nodes, respectively. By Eq 20, we have whenever *i* ∼ G and *j* ∼ R and whenever *i* ∼ R and *j* ∼ G. Since the graph is connected, these equations imply that there exist *k*_{G} and *k*_{R} such that *p*_{ij} = Γ_{ij}/*k*_{G} when *i* ∼ G and *p*_{ij} = Γ_{ij}/*k*_{R} when *i* ∼ R. In particular, all green nodes have *k*_{G} neighbors and all red nodes have *k*_{R} neighbors (i.e. the graph is “biregular”).

For this kind of graph, we can simplify the expressions of Eq 18 to get (23a) (23b)

It then follows from Eq 21 that the fixation probability of a randomly-placed mutant is (24)

Swapping the roles of *A* and *B* results in a formula for *ρ*_{B} as well, proving Theorem 1. In particular, any regular graph (meaning *k*_{G} = *k*_{R}, which requires *N*_{G} = *N*_{R}) has the same fixation probabilities as the complete bipartite graph with *N*_{G} green nodes and *N*_{R} (= *N*_{G}) red nodes (Fig 1b).

**Example 1** (star graph). On the star graph with one red node at the center (see Fig 1f), we have *N*_{G} = *k*_{R} = *N* − 1 and *N*_{R} = *k*_{G} = 1. Plugging these quantities into Eq 24 gives the formula
(25)

Finally, we conclude with the proof of Theorem 2. Suppose that *ρ*_{A} = 1/*N*, the fixation probability of *A* under neutral drift. By Eq 24, with *ζ*_{G} and *ζ*_{R} given by Eq 23, we have
(26)

Consider the function , which satisfies *f*(1, 1) = 0. If (*ζ*_{G}, *ζ*_{R}) ≠ (1, 1) and *f*(*ζ*_{G}, *ζ*_{R}) = 0, then the function *g*(*t*) ≔ *f*(1 − *t* + *tζ*_{G}, 1 − *t* + *tζ*_{R}) is differentiable and vanishes at both *t* = 0 and *t* = 1. By Rolle’s theorem, there must exist *t** ∈ (0, 1) for which *g*′(*t**) = 0. Letting *x** ≔ 1 − *t** + *t***ζ*_{G} and *y** ≔ 1 − *t** + *t***ζ*_{R} be the corresponding values of *x* and *y*, we see that
(27)

Since the numerators and denominators in Eq 23 are positive, and since we have the identities
(28a) (28b)
it follows that 1 − *ζ*_{G} and 1 − *ζ*_{R} must have the same sign (positive, negative, or zero). Since (1 − *x**, 1 − *y**) lies in the same quadrant as (1 − *ζ*_{G}, 1 − *ζ*_{R}), it cannot be true that *g*′(*t**) = 0. Therefore, Eq 26 is satisfied if and only if *ζ*_{G} = *ζ*_{R} = 1, which in turn happens if and only if *a*_{G}*a*_{R} = *b*_{G}*b*_{R}. For bipartite, properly two-colored, biregular graphs, we see that *ρ*_{A} = 1/*N* if and only if *a*_{G}*a*_{R} = *b*_{G}*b*_{R}. By similar reasoning, we find that *ρ*_{A} > 1/*N* > *ρ*_{B} when *a*_{G}*a*_{R} > *b*_{G}*b*_{R} and *ρ*_{A} < 1/*N* < *ρ*_{B} when *a*_{G}*a*_{R} < *b*_{G}*b*_{R}.

## Acknowledgments

We thank Igor Erovenko for many helpful comments on an earlier version of this paper.

## References

- 1.
Nagylaki T. Introduction to Theoretical Population Genetics. Springer-Verlag Berlin; 1992.
- 2.
Durrett R. Probability models for DNA sequence evolution. Springer Science & Business Media; 2008.
- 3. Traulsen A, Hauert C. Stochastic evolutionary game dynamics. Reviews of Nonlinear Dynamics and Complexity. 2009;2:25–61.
- 4.
Broom M, Rychtár J. Game-Theoretical Models in Biology. CRC Press; 2014.
- 5. Hindersin L, Traulsen A. Most Undirected Random Graphs Are Amplifiers of Selection for Birth-Death Dynamics, but Suppressors of Selection for Death-Birth Dynamics. PLOS Computational Biology. 2015;11(11):e1004437.
- 6. Allen B, Lippner G, Chen YT, Fotouhi B, Momeni N, Yau ST, et al. Evolutionary dynamics on any population structure. Nature. 2017;544(7649):227. pmid:28355181
- 7. Pavlogiannis A, Tkadlec J, Chatterjee K, Nowak MA. Construction of arbitrarily strong amplifiers of natural selection using evolutionary graph theory. Communications Biology. 2018;1(1). pmid:30271952
- 8. Tkadlec J, Pavlogiannis A, Chatterjee K, Nowak MA. Population structure determines the tradeoff between fixation probability and fixation time. Communications Biology. 2019;2(1). pmid:31044163
- 9. Tkadlec J, Pavlogiannis A, Chatterjee K, Nowak MA. Limits on amplifiers of natural selection under death-Birth updating. PLOS Computational Biology. 2020;16(1):e1007494.
- 10. Allen B, Sample C, Jencks R, Withers J, Steinhagen P, Brizuela L, et al. Transient amplifiers of selection and reducers of fixation for death-Birth updating on graphs. PLOS Computational Biology. 2020;16(1):e1007529. pmid:31951612
- 11. Lieberman E, Hauert C, Nowak MA. Evolutionary dynamics on graphs. Nature. 2005;433(7023):312–316.
- 12.
Thattai M, Shraiman BI. Metabolic Switching in the Sugar Phosphotransferase System of
*Escherichia coli*. Biophysical Journal. 2003;85(2):744–754. - 13. Guillaume L, Kussell E. Memory and Fitness Optimization of Bacteria under Fluctuating Environments. PLoS Genetics. 2014;10(9):e1004556.
- 14. Waclaw B, Bozic I, Pittman ME, Hruban RH, Vogelstein B, Nowak MA. A spatial model predicts that dispersal and cell turnover limit intratumour heterogeneity. Nature. 2015;525(7568):261.
- 15. Baym M, Lieberman TD, Kelsic ED, Chait R, Gross R, Yelin I, et al. Spatiotemporal microbial evolution on antibiotic landscapes. Science. 2016;353(6304):1147–1151. pmid:27609891
- 16. Kepler TB, Perelson AS. Drug concentration heterogeneity facilitates the evolution of drug resistance. Proceedings of the National Academy of Sciences. 1998;95(20):11514–11519.
- 17. Saksena NK, Potter SJ. Reservoirs of HIV-1 in vivo: implications for antiretroviral therapy. AIDS Reviews. 2003;5(1):3–18.
- 18. Singh R, Ray P, Das A, Sharma M. Penetration of antibiotics through Staphylococcus aureus and Staphylococcus epidermidis biofilms. Journal of Antimicrobial Chemotherapy. 2010;65(9):1955–1958.
- 19. Hermsen R, Deris JB, Hwa T. On the rapidity of antibiotic resistance evolution facilitated by a concentration gradient. Proceedings of the National Academy of Sciences. 2012;109(27):10775–10780.
- 20. Greulich P, Waclaw B, Allen RJ. Mutational pathway determines whether drug gradients accelerate evolution of drug-resistant cells. Physical Review Letters. 2012;109(8):088101.
- 21. Moreno-Gamez S, Hill AL, Rosenbloom DIS, Petrov DA, Nowak MA, Pennings PS. Imperfect drug penetration leads to spatial monotherapy and rapid evolution of multidrug resistance. Proceedings of the National Academy of Sciences. 2015;112(22):E2874–E2883.
- 22. Wu A, Loutherback K, Lambert G, Estevez-Salmeron L, Tlsty TD, Austin RH, et al. Cell motility and drug gradients in the emergence of resistance to chemotherapy. Proceedings of the National Academy of Sciences. 2013;110(40):16103–16108. pmid:24046372
- 23. Fu F, Nowak MA, Bonhoeffer S. Spatial Heterogeneity in Drug Concentrations Can Facilitate the Emergence of Resistance to Cancer Therapy. PLOS Computational Biology. 2015;11(3):e1004142.
- 24. Levene H. Genetic Equilibrium When More Than One Ecological Niche is Available. The American Naturalist. 1953;87(836):331–333.
- 25. Gillespie J. Polymorphism in Patchy Environments. The American Naturalist. 1974;108(960):145–151.
- 26. Frank SA, Slatkin M. Evolution in a Variable Environment. The American Naturalist. 1990;136(2):244–260.
- 27.
Gillespie JH. The Causes of Molecular Evolution. Oxford University Press; 1991.
- 28. Masuda N, Gibert N, Redner S. Heterogeneous voter models. Physical Review E. 2010;82(1):010103.
- 29. Hauser OP, Traulsen A, Nowak MA. Heterogeneity in background fitness acts as a suppressor of selection. Journal of Theoretical Biology. 2014;343:178–185.
- 30. Maciejewski W, Puleo GJ. Environmental evolutionary graph theory. Journal of Theoretical Biology. 2014;360:117–128.
- 31. Manem VSK, Kaveh K, Kohandel M, Sivaloganathan S. Modeling Invasion Dynamics with Spatial Random-Fitness Due to Micro-Environment. PLoS ONE. 2015;10(10):e0140234.
- 32. Mahdipour-Shirayeh A, Darooneh AH, Long AD, Komarova NL, Kohandel M. Genotype by random environmental interactions gives an advantage to non-favored minor alleles. Scientific Reports. 2017;7(1):5193.
- 33. Farhang-Sardroodi S, Darooneh AH, Nikbakht M, Komarova NL, Kohandel M. The effect of spatial randomness on the average fixation time of mutants. PLoS Computational Biology. 2017;13(11):e1005864.
- 34. Giaimo S, Arranz J, Traulsen A. Invasion and effective size of graph-structured populations. PLoS Computational Biology. 2018;14(11):e1006559.
- 35. Farhang-Sardroodi S, Darooneh AH, Kohandel M, Komarova NL. Environmental spatial and temporal variability and its role in non-favoured mutant dynamics. Journal of The Royal Society Interface. 2019;16(157):20180781.
- 36. Kaveh K, McAvoy A, Nowak MA. Environmental fitness heterogeneity in the Moran process. Royal Society Open Science. 2019;6(1):181661.
- 37. Moran PAP. Random processes in genetics. Mathematical Proceedings of the Cambridge Philosophical Society. 1958;54(01):60.
- 38.
Bollobás B. Graph Theory. Springer New York; 1979.
- 39. Proulx SR, Day T. What can Invasion Analyses Tell us about Evolution under Stochasticity in Finite Populations? Selection. 2002;2(1-2):2–15.
- 40. King OD, Masel J. The evolution of bet-hedging adaptations to rare scenarios. Theoretical Population Biology. 2007;72(4):560–575.
- 41. Krieger MS, McAvoy A, Nowak MA. Effects of motion in structured populations. Journal of The Royal Society Interface. 2017;14(135):20170509.
- 42. Herrerías-Azcué F, Pérez-Muñuzuri V, Galla T. Stirring does not make populations well mixed. Scientific Reports. 2018;8(1). pmid:29511246
- 43. Misenhelter MD, Rotenberry JT. Choices and consequences of habitat occupancy and nest site selection in Sage Sparrows. Ecology. 2000;81(10):2892–2901.
- 44. Cullen JB, Jacob BA, Levitt SD. The impact of school choice on student outcomes: an analysis of the Chicago Public Schools. Journal of Public Economics. 2005;89(5-6):729–760.
- 45. Essock-Vitale SM. The reproductive success of wealthy Americans. Ethology and Sociobiology. 1984;5(1):45–49.
- 46. McAvoy A, Allen B, Nowak MA. Social goods dilemmas in heterogeneous societies. Nature Human Behaviour. 2020;4(8):819–831.
- 47. Manem VSK, Kohandel M, Komarova NL, Sivaloganathan S. Spatial invasion dynamics on random and unstructured meshes: Implications for heterogeneous tumor populations. Journal of Theoretical Biology. 2014;349:66–73.
- 48. Monk T, Green P, Paulin M. Martingales and fixation probabilities of evolutionary graphs. Proceedings of the Royal Society A: Mathematical, Physical and Engineering Science. 2014;470(2165):20130730.
- 49.
Hammer PL, Rudeanu S. Boolean Methods in Operations Research and Related Areas. Springer Berlin Heidelberg; 1968.
- 50. Boros E, Hammer PL. Pseudo-Boolean optimization. Discrete Applied Mathematics. 2002;123(1-3):155–225.