Introduction

The structure of a population has important consequences for its evolution1,2,3,4,5,6,7,8,9,10. In particular, spatial or social network structure can promote the evolution of cooperative behavior, by allowing cooperators to cluster together and share benefits11,12,13.

Spatial structure can be represented mathematically as a graph or network, in which nodes represent individuals and edges indicate spatial or social connections6,14,15,16,17,18,19,20. Edges can be weighted to indicate the strength of the connection. To study cooperation or other forms of social behavior, interactions can be modeled as matrix games. Individuals play games with their neighbors, and the payoffs from these games determine reproductive success.

Mathematical studies of evolutionary games on graphs16,17,18,20,21,22,23,24,25,26,27,28,29 have typically assumed that the graph is regular, meaning that each individual has the same number of neighbors. Recently, a condition was derived that determines which strategy is favored in any two-player, two-strategy game, on any weighted graph, under weak selection30,31,32. Weak selection means that the game has only a small effect on reproductive success. For nonweak selection, determining the outcome of evolutionary games on graphs is PSPACE-complete33.

A weighted graph is called isothermal if the sum of edge weights is the same at each vertex (Fig. 1). This property has a natural interpretation: suppose that the edge weights represent the amount of time that two individuals interact with each other. Then the graph is isothermal as long as each individual devotes the same total time to interaction. Importantly, some individuals may divide their time thinly among many contacts, while others focus primarily on one or two contacts.

Fig. 1
figure 1

Isothermal graphs and their effective degrees. A graph is isothermal if the sum of edge weights is the same for each vertex. The effective degree \(\tilde{\kappa }\) of the graph, defined in Eq. (3), determines the outcome of evolutionary game dynamics. a An asymmetric isothermal graph; weights are shown for each edge. b A wheel graph, with one hub and \(n\) wheel vertices. All connections with the hub have weight \(1/n\). All connections in the periphery have weight \((n-1)/2n\). As \(n\to \infty\), the effective degree approaches 2. A formula for arbitrary \(n\) is derived in Supplementary Note 3. c A 30-vertex graph generated with preferential attachment62 and linking number \(m=3\). Isothermal edge weights are obtained by quadratic programming (see Methods). The effective degree, \(\tilde{\kappa }\approx 2.47\), is less than the average topological degree, \(\bar{k}=5.6\). d An island model, with edges of weight \(\alpha \ll 1\) between each inter-island pair of vertices. Shown here are two islands: a \({k}_{1}\)-regular graph of size \({N}_{1}\), and a \({k}_{2}\)-regular graph of size \({N}_{2}\)

Isothermal graphs have special relevance for evolutionary dynamics. All vertices of an isothermal graph have the same reproductive value—meaning that each vertex contributes equally to the future population under neutral drift10,34. The Isothermal Theorem6,35 states that isothermal graphs neither amplify nor suppress the effects of selection for mutations of constant fitness effect.

Here, we analyze evolutionary games on isothermal graphs, and obtain more powerful results than are available for arbitrary weighted graphs30,31,32. The condition for a strategy to be favored, under weak selection, takes a particularly simple form, in which the graph structure is summarized in a single statistic, which we term the ‘effective degree’, \(\tilde{\kappa }\). An isothermal graph of effective degree \(\tilde{\kappa }\) behaves like an unweighted \(\tilde{\kappa }\)-regular graph in its effect on strategy selection. In particular, cooperation is favored on a large graph (for particular update rules; see below) if and only if the benefit to others exceeds \(\tilde{\kappa }\) times the cost. We derive bounds on \(\tilde{\kappa }\) in terms of the graph’s spectral gap (the difference between the two largest eigenvalues), establishing a link to the theory of expander graphs36,37,38. Applying our results to power-law networks and to heterogeneous subdivided populations, we exhibit graphs of arbitrarily large average degree that provide arbitrarily strong support to cooperation.

Results

Model

We represent spatial structure by a weighted, connected, isothermal graph \(G\) of size \(N\). The edge weight between vertices \(i,j\in G\) is denoted \({w}_{ij}\). Without loss of generality, we scale edge weights so that \({\sum }_{j\in G}{w}_{ij}=1\) for each vertex \(i\). In this way, edge weights may be interpreted as probabilities or frequencies of interaction. Edges are undirected, meaning \({w}_{ij}={w}_{ji}\), and there are no self-loops: \({w}_{ii}=0\) for each \(i\). Two vertices are neighbors if they are joined by an edge of positive weight; the number of neighbors of vertex \(i\) is called its topological degree, \({k}_{i}\).

Vertices in an isothermal graph may differ widely in the distribution of edge weights among their neighbors (Fig. 1). We quantify these differences using the ‘Simpson degree’20 (Fig. 2), defined for each vertex \(i\) as

$${\kappa }_{i}={\left(\sum _{j\in G}{w}_{ij}^{2}\right)}^{-1}.$$
(1)

In words, if individual \(i\) randomly selects two neighbors, with probability proportional to edge weight, then \({\kappa }_{i}\) is the inverse probability that the same neighbor is selected twice. The Simpson degree \({\kappa }_{i}\) quantifies the effective number of contacts of individual \(i\), accounting for the time spent with each contact, analogously to how the Simpson index of biodiversity39 quantifies the effective number of species in a population40. If all edges from vertex \(i\) have equal weight, then the Simpson degree equals the actual number of neighbors: \({\kappa }_{i}={k}_{i}\). Otherwise, \({\kappa }_{i}\) is less than \({k}_{i}\), and decreases as the distribution of edge weights from \(i\) becomes more uneven.

Fig. 2
figure 2

Simpson degree and remeeting time. The Simpson degree \({\kappa }_{i}={\left({\sum }_{j}{w}_{ij}^{2}\right)}^{-1}\) quantifies the effective number (or diversity) of neighbors of a vertex \(i\), taking their edge weights into account. a If the edge weights to neighbors are nonuniform, the Simpson degree \({\kappa }_{i}\) is less than the topological degree \({k}_{i}\). Here, \({\kappa }_{i}=4\), which is less than the topological degree, \({k}_{i}=5\). b If each neighbor has equal edge weight \(1/k\), the Simpson degree is equal to the topological degree, \(k\). c The remeeting time \({\tau }_{i}\) is the expected time for two independent random walks from \(i\) to meet each other. The effective degree \(\tilde{\kappa }\) of a graph is the weighted harmonic average of the Simpson degrees, with weights given by the remeeting times

Individuals can be one of two types, A or B, corresponding to strategies in the game

$$\begin{array}{lc}&{\rm{A}} \quad {\rm{B}}\\ {\begin{array}{c}{\rm{A}}\\ {\rm{B}}\end{array}}& {\left(\begin{array}{lc}a&b \\ c & d\end{array}\right)}.\end{array}$$
(2)

Each time-step, each individual plays the game with all neighbors. Payoffs from the game are translated into fecundity (reproductive rate) by \({F}_{i}=1+\delta {f}_{i}\), where \({f}_{i}\) is the edge-weighted average payoff that \(i\) receives from neighbors, and \(\delta\) is a parameter quantifying the strength of selection. We study weak selection (\(0\ <\ \delta \ll 1\)) as a perturbation of neutral drift (\(\delta =0\)).

Evolution proceeds according to a given update rule. We first consider death-Birth (dB) updating16: A vertex \(i\in G\) is chosen, with uniform probability, to be replaced. A neighbor \(j\) of \(i\) is then chosen to reproduce, with probability proportional to \({w}_{ij}{F}_{j}\). The offspring of \(j\) replaces the occupant of \(i\) and inherits the type of its parent. The capitalization in dB indicates that death is uniform, whereas birth is dependent on payoff. Other update rules are considered later.

Over time, one of the competing types will die out and the other will become fixed. Consider an initial state with a single vertex of type A chosen uniformly at random, and all other vertices of type B. We define the fixation probability \({\rho }_{{\rm{A}}}\) as the (expected) probability that type A becomes fixed from this initial state. Similarly, \({\rho }_{{\rm{B}}}\) is the probability that type B becomes fixed from an initial state with one random (uniformly chosen) vertex of type B and all other vertices of type A. We say A is favored if \({\rho }_{{\rm{A}}}\ > \ {\rho }_{{\rm{B}}}\).

Condition for success

We find that the key quantity characterizing an isothermal graph is its effective degree \(\tilde{\kappa }\), which we define as a weighted harmonic average of the graph’s Simpson degrees:

$$\tilde{\kappa }=\frac{{\sum }_{i}{\tau }_{i}}{{\sum }_{i}{\tau }_{i}{\kappa }_{i}^{-1}}=\frac{{N}^{2}}{{\sum }_{i}{\tau }_{i}{\kappa }_{i}^{-1}}.$$
(3)

The weighting \({\tau }_{i}\) of vertex \(i\) is the expected remeeting time of two random walks that are initialized at \(i\) (see Fig. 2c and Methods). Remeeting times arise from tracing ancestries backward in time as coalescing random walks36,41,42,43. If all vertices have \(k\) neighbors of equal weight, the effective degree is equal to the topological degree: \(\tilde{\kappa }=k\).

We prove in Supplementary Note 1 that strategy A is favored, for death-Birth updating on an isothermal graph under weak selection, if and only if

$$\sigma a+b\ > \ c+\sigma d,\quad \,{\mathrm{with}}\,\quad \sigma =\frac{\tilde{\kappa }+1-4\tilde{\kappa }/N}{\tilde{\kappa }-1}.$$
(4)

As an interpretation of Condition (4), consider strategy A to represent cooperation and B to represent defection (noncooperation). For the purposes of this interpretation, we define the cost of cooperation as \(C=-{\!}\frac{1}{2}(a+b-c-d)\) and the benefit to the partner as \(B=\frac{1}{2}(a-b+c-d)\). Then Condition (4) can be algebraically rewritten as

$$(N/\tilde{\kappa }-2)B\ > \ (N-2)C.$$
(5)

The above definitions of benefit \(B\) and cost \(C\) are motivated by imagining a hypothetical situation in which one’s partner is equally likely to be of either type; in this case, playing A rather than B decreases the actor’s payoff by \(C\) and increases the partner’s payoff by \(B\). If \(B,C\ > \ 0\) (cooperation is costly to the actor and beneficial to the recipient) and \(\tilde{\kappa }\ll N\), then cooperation is favored as long as \(B/C\ > \ \tilde{\kappa }\). Well-known results for unweighted \(k\)-regular graphs16,17,20,23 are recovered by substituting \(k\) for \(\tilde{\kappa }\). In contrast, if \(\tilde{\kappa }\ge N/2\), then cooperation is never favored, but spiteful behaviors (\(B\ <\ 0,C\ > \ 0\)) can be favored.

According to Conditions (4) and (5), evaluating the conditions for success on a given isothermal graph amounts to computing the effective degree, \(\tilde{\kappa }\). This can be done in polynomial time by solving a system of linear equations for coalescence times (see Methods).

Random isothermal graphs

How does the effective degree relate to other degree statistics? Since \(\tilde{\kappa }\) is a weighted average, it lies between the minimum and maximum Simpson degrees: \({\kappa }_{\min }\le \tilde{\kappa }\le {\kappa }_{\max }\). However, these bounds are not very informative for strongly heterogeneous graphs.

To gain further insight, we investigated two models for random isothermal graphs. The first, a 2D spatial model (Fig. 3a), is applicable to populations in which each individual occupies a fixed location. An even number of vertices are randomly placed in the unit square. These vertices are repeatedly divided into pairs according to the following scheme: (1) pick an unpaired vertex \(i\) uniformly at random; (2) pair \(i\) with another unpaired vertex \(j\), chosen with probability proportional to \({e}^{-\beta d(i,j)}\); (3) repeat until all vertices are paired. Here \(d(i,j)\) is the Euclidean distance between \(i\) and \(j\), and \(\beta \ > \ 0\) tunes the decay of pairing probability with distance. After a specified number of pairing rounds, the edge weight between any two vertices is defined to be the fraction of rounds they were paired. Since each vertex is paired once per round, the resulting weighted graph is undirected and isothermal.

Fig. 3
figure 3

Effective degrees of random graphs. a A 2D spatial model in which individuals are randomly placed in the unit square and then randomly paired according to their distance from each other. b A shifted-linear preferential attachment network44,45, with isothermal edge weights obtained by minimizing \({\sum }_{i,j}{w}_{ij}^{2}\) subject to \({\sum }_{j}{w}_{ij}=1\) for all \(i\). c, d For each graph generated by these two models, the effective degree, \(\tilde{\kappa }\) (black line) is plotted against the arithmetic mean topological degree, \(\bar{k}\) (green dots); the arithmetic mean Simpson degree, \({\kappa }_{{\rm{A}}}\) (blue dots); and the harmonic mean Simpson degree, \({\kappa }_{{\rm{H}}}\) (magenta dots). Vertical gray bars show the quantile bounds (6) for each graph. In almost all cases, \({\kappa }_{{\rm{H}}}\) provides the best estimate for \(\tilde{\kappa }\); \({\kappa }_{{\rm{H}}}\) performs better only when \(\tilde{\kappa }\) is very small. Note that the arithmetic mean topological degree, \(\bar{k}\), is significantly larger than the other degree measures in almost all cases. See Methods for further details and parameter values

The second model (Fig. 3b) begins with a random graph topology generated by shifted-linear preferential attachment44,45, and obtains isothermal weightings on the edges via quadratic programming. While the first model is inspired by spatial biological populations, the second is more applicable to social networks.

For both random graph models, we compared \(\tilde{\kappa }\) to the (unweighted) arithmetic and harmonic average Simpson degrees (denoted \({\kappa }_{{\rm{A}}}\) and \({\kappa }_{{\rm{H}}}\), respectively) as well as to the arithmetic average topological degree \(\bar{k}\). We find (Fig. 3c, d) that the harmonic average Simpson degree \({\kappa }_{{\rm{H}}}\) provides the best estimate in most cases. Therefore, \(B/C\ > \ {\kappa }_{{\rm{H}}}\) closely approximates the condition for cooperation to be favored for weak selection on a large isothermal graph. This is significant for the evolution of cooperation, because the harmonic mean of a set of numbers is dominated by its smallest elements. Consequently, the presence of large-degree hubs need not preclude support for cooperation, even if they lead to a large arithmetic average degree (either topological or Simpson).

Spectral gap bounds for expander graphs

To formalize the relationship between the effective degree \(\tilde{\kappa }\) and the harmonic average Simpson degree \({\kappa }_{{\rm{H}}}\), we derive bounds on \(\tilde{\kappa }\) in terms of the spectral gap—the difference between the two largest eigenvalues of the adjacency matrix. Large graphs with non-negligible spectral gap are called expander graphs, and have important applications in mathematics38 and computer science37. For our purposes, we define a ‘family of isothermal expander graphs’ as a sequence of isothermal graphs with sizes tending to infinity and spectral gap tending to a positive value \(g\), which necessarily lies in the range \(0\ <\ g\le 1\) (see Methods).

We prove in Supplementary Note 2 that the remeeting times for such a family are asymptotically bounded by \({\tau }_{i}\le N/g\) for each vertex \(i\). We apply this result to bound the effective degree \(\tilde{\kappa }\). Let \({\kappa }_{[a,b]}\) denote the harmonic mean of the Simpson degrees lying between the \(a\)th and \(b\)th quantiles, for \(0\le a\ <\ b\le 1\). For example, \({\kappa }_{[0,1/4]}\) denotes the harmonic mean over the smallest fourth (first quartile) of Simpson degrees. For a family of isothermal expander graphs, we prove the following asymptotic bounds:

$${\kappa }_{[0,g]}\le \tilde{\kappa }\le {\kappa }_{[1-g,1]}.$$
(6)

As \(g\) increases, both bounds become closer to \({\kappa }_{[0,1]}={\kappa }_{{\rm{H}}}\). Combining (6) with classical inequalities, we obtain the looser but simpler bounds

$$g{\kappa }_{{\rm{H}}}\le \tilde{\kappa }\le \frac{{\kappa }_{{\rm{A}}}}{g}.$$
(7)

Promoters of cooperation with infinite average degree

Our results allow us to construct families of isothermal graphs that favor the evolution of cooperation even as the average degree (either topological or Simpson) diverges to infinity.

Let us first consider island-structured populations (Figs. 1d and 4). The islands are represented by isothermal, vertex-transitive graphs, \({G}_{1},\ldots ,{G}_{n}\), which may differ in their size and network structure. An overall isothermal graph \(G\) is formed by joining each inter-island pair of vertices by an edge of weight \(\alpha \ll 1\), and rescaling intra-island edge weights correspondingly (see Methods). We prove that, if the island sizes are equal, the effective degree \(\tilde{\kappa }\) of \(G\) is the (unweighted) harmonic mean of the Simpson degrees \({\kappa }_{1},\ldots ,{\kappa }_{n}\) of the separate islands. If the islands have different sizes, \(\tilde{\kappa }\) is a weighted harmonic mean of \({\kappa }_{1},\ldots ,{\kappa }_{n}\), with weights depending only on the islands’ sizes.

Fig. 4
figure 4

Island-structured “super-promoters" of cooperation. We use the island model (Fig. 1c) to construct families of graphs whose effective degree \(\tilde{\kappa }\) remains finite while the arithmetic average degree (both Simpson and topological) diverges to infinity. a Two islands of equal size: a cycle and a complete graph. As \(N\to \infty\), the effective degree \(\tilde{\kappa }\) converges to 4, which is the harmonic mean of 2 and infinity. b A small complete graph and a large cycle with alternating edge weights, \(\varepsilon \ll 1\) and \(1-\varepsilon\). Under the appropriate combination of limits, \(\tilde{\kappa }\) converges to 1—meaning that all cooperative behaviors with \(B\ > \ C\ > \ 0\) are favored—while \({\kappa }_{{\rm{A}}}\) diverges. Calculations are provided in the Methods

Suppose that one island is a cycle and the other a complete graph of equal size (Fig. 4a). Then as population size increases, the arithmetic mean Simpson degree \({\kappa }_{{\rm{A}}}\) diverges to infinity, while the effective degree converges to 4. Support for cooperation can be further increased by varying the island sizes and the edge weights of the cycle (Fig. 4b). In the most extreme limit, we have \({\kappa }_{{\rm{A}}}\to \infty\) but \(\tilde{\kappa }\to 1\), meaning that any cooperative behavior with \(B\ > \ C\ > \ 0\) is favored.

Second, we consider a hypothetical family of isothermal expander graphs whose limiting Simpson degree distribution is described by the power-law density \(f(\kappa )\propto {\kappa }^{-\gamma }\), on the range \({\kappa }_{0}\le \kappa \ <\ \infty\), for arbitrary \(\gamma \ge 2\) and \({\kappa }_{0}\ge 1\). Evaluating (6) for the corresponding quantile function, \(\kappa (x)={\kappa }_{0}{(1-x)}^{-1/(\gamma -1)}\), yields (Supplementary Note 3)

$$\left(\frac{\gamma }{\gamma -1}\right)\frac{{\kappa }_{0}g}{1-{(1-g)}^{\gamma /(\gamma -1)}}\le \tilde{\kappa }\le \left(\frac{\gamma }{\gamma -1}\right){\kappa }_{0}{g}^{-1/(\gamma -1)}.$$
(8)

These bounds are illustrated in Fig. 5. For \(\gamma =2\), the arithmetic average Simpson degree \({\kappa }_{{\rm{A}}}\) diverges to infinity, but the upper bound on \(\tilde{\kappa }\) is \(2{\kappa }_{0}/g\). Thus \(B/C\ > \ 2{\kappa }_{0}/g\) is sufficient for cooperation to be favored.

Fig. 5
figure 5

Bounds on effective degree for power-law expander graphs. We consider a large isothermal graph for which the Simpson degree distribution is described by the density \(f(\kappa )\propto {\kappa }^{-\gamma }\) on the range \([{\kappa }_{0},\infty )\). The upper and lower bounds (8) are shown for a \(\gamma =2\) and b \(\gamma =3\), both with \({\kappa }_{0}=1\). As \(g\) approaches 1, the upper and lower bounds both converge to the (unweighted) harmonic mean Simpson degree \({\kappa }_{H}\)

Other update rules

So far, we have considered only death-Birth updating. One may also consider Birth-death (Bd) updating16: An individual \(i\) is chosen, proportionally to its fecundity \({F}_{i}\), to reproduce; the offspring of \(i\) replaces neighbor \(j\) with probability \({w}_{ij}\). Alternatively, one may let selection act on mortality, leading to two further update rules20,21,22. For Death-birth (Db) updating, an individual \(i\) is chosen to die, proportionally to \({F}_{i}^{-1}\); a neighbor \(j\) is then chosen to reproduce into the vacancy, proportionally to \({w}_{ij}\). For birth-Death (bD) updating, an individual is chosen to reproduce, with uniform probability; the offspring displaces a neighbor \(j\) with probability proportional to \({w}_{ij}{F}_{j}^{-1}\).

We find (Supplementary Note 1) that bD updating leads to the same condition for success as for dB, Eq. (4). In contrast, for Bd or Db, type A is favored for weak selection if and only if

$$\sigma a+b\ > \ c+\sigma d,\quad \,\text{with}\,\quad \sigma =(N-2)/N.$$
(9)

This same condition for success was previously derived for well-mixed populations, under a variety of update rules, with arbitrary selection strength and mutation rate46,47,48. Thus isothermal graph structure has no effect on the conditions for evolutionary game success under weak selection. Rewriting Condition (9) as

$$-(N-1)C-B\ > \ 0,$$
(10)

we find that cooperation is never favored for positive \(B\) and \(C\). This generalizes, to all isothermal graphs, the previous finding that Bd and Db updating do not support cooperation on regular graphs16,17,20,22,23,26.

The equivalence of success conditions between dB and bD, and between Bd and Db, was previously observed for vertex-transitive graphs20,21,22, but does not hold for arbitrary graphs49. Here we have demonstrated these equivalences for all isothermal graphs. These equivalences are related to the scales of spatial competition induced by the various update rules. For Bd and Db, a type is favored if it has higher payoff, on average, than its immediate (one-step) neighbors. Having neighbors of high payoff increases the likelihood of being replaced by their offspring (for Bd), or decreases the likelihood of them providing a vacancy to reproduce into (for Db). In contrast, for dB and bD, a type is favored if it higher payoff, on average, than its two-step neighbors. This is because one competes with one’s two-step neighbor to fill a vacancy (for dB) or to avoid being replaced (for bD). These observations are made precise in Eq. (14) of the Methods.

Diffusible public goods

So far we have assumed that game interactions occur only between immediate neighbors. However, many microbial populations exhibit a form of cooperation in which some cells produce useful chemicals that diffuse through the environment and are utilized by other cells50,51. These chemicals may be termed “diffusible public goods”—examples include iron chelators52,53, hydrolyzed sugars54, antibiotic resistance agents55, and growth factors in tumor cells56. Public goods production can be exploited by “cheaters”, who utilize the good without producing it, leading to a social dilemma57,58.

We model the diffusion of public goods as a random walk on \(G\), starting at the vertex where the good is produced. A benefit \({b}_{n}\ge 0\) goes to the vertex at the \(n\)th step of this walk. That is, benefit \({b}_{0}\) goes immediately to the producer, benefit \({b}_{1}\) to a random neighbor, benefit \({b}_{2}\) to a random neighbor-of-neighbor (which may again be the producer itself), and so on. For the sake of generality, we do not assume any particular form for the \({b}_{n}\), only that the total benefit \(B={\sum }_{n=0}^{\infty }{b}_{n}\) is finite. Of the total benefit from public goods produced at vertex \(i\), the fraction received by vertex \(j\) is \({\phi }_{ij}=\frac{1}{B}{\sum }_{n=0}^{\infty }{p}_{ij}^{(n)}{b}_{n}\), where \({p}_{ij}^{(n)}\) is the probability that a random walk from \(i\) visits \(j\) at the \(n\)th step. The cost to produce the good is \(C\ > \ 0\).

Whether production of diffusible goods is favored depends on the costs to produce, the amount of benefit, the pattern of diffusion, and the spatial structure57,58. For Bd or Db updating on an isothermal graph, we show in Supplementary Note 4 that production is favored under weak selection if

$$-C(N-1)+B(N{\phi }^{(0)}-1)\ > \ 0.$$
(11)

Here \({\phi }^{(0)}={\sum }_{i\in G}\frac{{\tau }_{i}}{{N}^{2}}{\phi }_{ii}\) is the average amount that a producer benefits from its own good, with the producing vertex weighted by remeeting time. According to this condition, production is favored only if it provides a net benefit to the producers themselves (\(B{\phi }^{(0)}\ > \ C\), in a large population).

In contrast, for dB or bD updating, production is favored if

$$-C(N-2)+B\left[\right.N({\phi }^{(0)}+{\phi }^{(1)})-2\left]\right.\ > \ 0.$$
(12)

Above, \({\phi }^{(1)}={\sum }_{i\in G}\frac{{\tau }_{i}}{{N}^{2}}{w}_{ij}{\phi }_{ij}\) is the expected benefit received by a random neighbor of a producer, with the producing vertex again weighted by remeeting time. In this case, production is favored if the average benefit to a neighbor exceeds the net cost to self (\(B{\phi }^{(1)}\ > \ C-B{\phi }^{(0)}\), in a large population).

In short, production is favored for Bd or Db if there is a net benefit to the producer, and for dB or bD if there is a net benefit to the producer plus a randomly chosen neighbor. These results generalize previous findings for vertex-transitive graphs57. If we suppose that benefits go only to immediate neighbors (\({b}_{1}=B\) and all other \({b}_{n}=0\)), then \({\phi }^{(0)}=0\) and \({\phi }^{(1)}=1/\tilde{\kappa }\), whereupon Conditions (11) and (12) reduce to our conditions for two-player games, (10) and (5) respectively.

The distinct outcomes for the different update rules can be traced to their scales of spatial competition (one for Bd or Db, two for bD or dB). We show in Supplementary Note 4 that if spatial competition occurs at scale \(m\), then benefits accruing at distances \(< m\) from the producer contribute to selection for production, while those accruing at distances \(\ge m\) are canceled by spatial competition—see Eq. (39) of the Methods.

Discussion

Analytical results for evolutionary games on graphs have recently been extended from regular graphs to arbitrary weighted graphs30,31,32. Isothermal graphs represent an important class of intermediate generality: flexible enough to represent a wide range of population configurations, yet simple enough to yield powerful results. They represent scenarios in which individuals may differ in their number of connections, but are equal in their reproductive value. Isothermal graphs arise naturally from supposing that all individuals devote equal time to interaction, and can be generated via pairing schemes such as we consider in Fig. 3a.

For dB and bD updating, the condition for success under weak selection takes a simple form, Condition (4), in which the consequences of graph structure are summarized in the effective degree \(\tilde{\kappa }\). For large graphs, cooperation is favored if it provides more than a \(\tilde{\kappa }\)-fold benefit relative to the cost.

Our result allows us to identify graphs (e.g. Figs. 4 and 5a) for which the effective degree remains bounded while the arithmetic average degree (both topological and Simpson) diverges to infinity. This is possible because \(\tilde{\kappa }\) is a weighted harmonic average, and harmonic averages (unlike arithmetic averages) are dominated by the smallest elements of a set.

The weights in \(\tilde{\kappa }\) are given by the time, \({\tau }_{i}\), for two independent random walks from vertex \(i\) to rejoin each other. Using spectral graph theory, we derived bounds on these remeeting times, and in turn on the effective degree \(\tilde{\kappa }\), in terms of the graph’s degree distribution and spectral gap. The appearance of the spectral gap suggests an intriguing link between evolutionary game theory and the theory of expander graphs. Currently, expansion properties are much better understood for regular graphs than for non-regular graphs36,37,38. Isothermal graphs may serve as a useful intermediate class for generalizing expander graph theory.

For Bd or Db updating, the conditions for \({\rho }_{A}\ > \ {\rho }_{B}\) under weak selection are independent of the graph structure. In particular, for these update rules, isothermal graph structure does not promote the evolution of cooperation, relative to the baseline case of a well-mixed population. These results underscore the principle—previously observed in homogeneous population structures16,17,21,22,59—that, for spatial structure to support cooperation, the benefits of cooperation must be distributed at distances less than the scale of competition. Here we have extended this principle to isothermal graphs, with diffusible public goods providing the clearest illustration. Our findings for Bd or Db and are reminiscent of the Isothermal Theorem6,35, which states that the fixation probability of a mutation of constant fitness, for Bd or Db on any isothermal graph, is the same as in a well-mixed population. The common thread is that, for Bd or Db on isothermal graphs, key aspects of the evolutionary process are invariant with respect to spatial structure. Importantly, for non-isothermal graphs, Condition (9) is not generally valid, and the conditions for success under Birth-death updating vary from graph to graph60. It therefore appears that the cancellation principle observed here and in previous work16,17,21,22 is specific to isothermal graphs. The question of whether Bd or Db updating can promote cooperation on any (non-isothermal) weighted graph remains open.

Our work adds an important nuance to our understanding of the evolution of cooperation. Previous work on regular graphs16,17,18,20,22,23,24,25,26,27,28,29 showed that cooperation thrives (for dB or bD updating) when each individual has few neighbors, relative to the overall population size. Condition (4) shows that it is not the raw number of neighbors that matters, but their effective number, as quantified by \(\tilde{\kappa }\). Even in highly interconnected societies, cooperation can flourish if most individuals interact primarily with a few close contacts, rather than many loose acquaintances.

Methods

Model

We denote the state of the process by a vector \({\bf{x}}\), with entries \({x}_{i}\) indicating the type of each vertex \(i\in G\): \({x}_{i}=1\) if \(i\) has type A and \({x}_{i}=0\) if \(i\) has type B. The payoff to vertex \(i\) in state \({\bf{x}}\) is denoted \({f}_{i}({\bf{x}})\), and the fecundity is given by \({F}_{i}({\bf{x}})=1+\delta {f}_{i}({\bf{x}})\).

The four update rules we consider are defined by the probability \({e}_{ij}({\bf{x}})\) that the offspring of vertex \(i\) replaces the occupant of vertex \(j\) in state \({\bf{x}}\):

$${e}_{ij}({\bf{x}})=\left\{\begin{array}{lc}\frac{1}{N}\left(\frac{{w}_{ij}{F}_{i}({\bf{x}})}{{\sum }_{k\in G}{w}_{kj}{F}_{k}({\bf{x}})}\right)&{\rm{death}}-{\rm{Birth}}\ ({\rm{dB}})\\ \left(\frac{{\left({F}_{j}({\bf{x}})\right)}^{-1}}{{\sum }_{k\in G}{\left({F}_{k}({\bf{x}})\right)}^{-1}}\right){w}_{ij}&{\rm{Death}}-{\rm{birth}}\ ({\rm{Db}})\\ \left(\frac{{F}_{i}({\bf{x}})}{{\sum }_{k\in G}{F}_{k}({\bf{x}})}\right){w}_{ij}&{\rm{Birth}}-{\rm{death}}(Bd)\\ \frac{1}{N}\left(\frac{{w}_{ij}{\left({F}_{j}({\bf{x}})\right)}^{-1}}{{\sum }_{k\in G}{w}_{ik}{\left({F}_{k}({\bf{x}})\right)}^{-1}}\right)&{\rm{birth}}-{\rm{Death}}\ ({\rm{bD}}).\end{array}\right.$$
(13)

Analysis of weak selection

Here we summarize the derivation of our main result; Supplementary Note 1 for a full derivation. The key quantity in analyzing selection is the expected change \(\Delta ({\bf{x}})\) in the number of A individuals from state \({\bf{x}}\). Based on Eq. (13), we calculate this for weak selection:

$$\Delta ({\bf{x}})=\left\{\begin{array}{lc}\frac{\delta }{N}{\sum }_{i\in G}{x}_{i}\left({f}_{i}({\bf{x}})-{f}_{i}^{(2)}({\bf{x}})\right)+{\mathcal{O}}({\delta }^{2})&{\rm{dB}}\ {\rm{or}}\ {\rm{bD}}\\ \frac{\delta }{N}{\sum }_{i\in G}{x}_{i}\left({f}_{i}({\bf{x}})-{f}_{i}^{(1)}({\bf{x}})\right)+{\mathcal{O}}({\delta }^{2})&{\rm{Bd}}\ {\rm{or}}\ {\rm{Db}}.\end{array}\right.$$
(14)

Above, we have introduced the notation \({f}_{i}^{(n)}({\bf{x}})={\sum }_{j}{p}_{ij}^{(n)}{f}_{j}({\bf{x}})\) for the expected payoff of an individual at the terminus of an \(n\)-step random walk from \(i\), where \({p}_{ij}^{(n)}\) denotes the probability that such a random walk terminates at \(j\).

Theorem 4 of Allen and McAvoy61 implies that \({\rho }_{{\rm{A}}}\ > \ {\rho }_{{\rm{B}}}\) if and only if \(\langle \Delta \rangle \ > \ 0\), where \(\langle \ \rangle\) denotes an expectation over a particular probability distribution over states, called the “rare-mutation conditional (RMC) distribution”. Combining with Eq. (14), type A is favored under weak selection if and only if

$$\sum _{i\in G}\left\langle {x}_{i}\left({f}_{i}({\bf{x}})-{f}_{i}^{(m)}({\bf{x}})\right)\right\rangle \ > \ 0,$$
(15)

where \(m=1\) for Bd or Db, and \(m=2\) for dB or bD.

Coalescence and remeeting times

We compute the expectation in Eq. (15) using coalescence times, defined by the recurrence relations

$${\tau }_{ij}=\left\{\begin{array}{lc}0 &i=j\\ 1+\frac{1}{2}{\sum }_{k\in G}\left({w}_{ik}{\tau }_{jk}+{w}_{jk}{\tau }_{ik}\right)&i\, \ne\, j.\end{array}\right.$$
(16)

Coalescence times are related to expectations over the RMC distribution by

$${\tau }_{ij}\ \propto \ \frac{1}{2}-\langle {x}_{i}{x}_{j}\rangle ,$$
(17)

for all pairs \(i,j\in G\).

The remeeting time \({\tau }_{i}\) is the expected time for two independent random walks from \(i\) to rejoin each other. It is obtained by the relation

$${\tau }_{i}=1+\sum _{j\in G}{w}_{ij}{\tau }_{ij}.$$
(18)

Remeeting times on isothermal graphs satisfy30

$$\sum _{i\in G}{\tau }_{i}={N}^{2}.$$
(19)

We denote the expected coalescence time from the two ends of an \(n\)-step random walk as \({\tau }^{(n)}=\frac{1}{N}{\sum }_{i,j\in G}{p}_{ij}^{(n)}{\tau }_{ij}\). The \({\tau }^{(n)}\) satisfy the recurrence relation

$${\tau }^{(n+1)}={\tau }^{(n)}+\frac{1}{N}\sum _{i\in G}{p}_{ii}^{(n)}{\tau }_{i}-1.$$
(20)

We observe that \({p}_{ii}^{(0)}=1\), \({p}_{ii}^{(1)}=0\) (no self-loops), and \({p}_{ii}^{(1)}=1/{\kappa }_{i}\) for each \(i\). Using Eqs. (3), (19), and (20), we obtain

$${\tau }^{(1)}=N-1$$
(21)
$${\tau }^{(2)}=N-2$$
(22)
$${\tau }^{(3)}=N+N/\tilde{\kappa }-3.$$
(23)

Conditions for success

We temporarily assume that the game satisfies \(a+d=b+c\); we will later show this assumption to be unnecessary. With this assumption, the payoff differences in Eq. (14) can be written as

$${f}_{i}({\bf{x}})-{f}_{i}^{(n)}({\bf{x}})=-C\left({x}_{i}-{x}_{i}^{(n)}\right)+B\left({x}_{i}^{(1)}-{x}_{i}^{(n+1)}\right),$$
(24)

where \({x}_{i}^{(n)}={\sum }_{j}{p}_{ij}{x}_{j}\) is the expected type at the end of an \(n\)-step random walk from \(i\), and \(B=\frac{1}{2}(a-b+c-d)\) and \(C=-\frac{1}{2}(a+b-c-d)\) as in the main text. Eq. (17) implies

$$\sum _{i\in G}\left\langle {x}_{i}\left({x}_{i}^{(n)}-{x}_{i}^{(m)}\right)\right\rangle \propto {\tau }^{(m)}-{\tau }^{(n)}.$$
(25)

Applying Eqs. (15), (24), and (25), type A is favored under weak selection if and only if

$$-C{\tau }^{(2)}+B\left({\tau }^{(3)}-{\tau }^{(1)}\right)\ > \ 0,$$
(26)

for dB or bD updating. Substituting from Eqs. (21)–(23) yield Conditions (5) of the main text. For Bd or Db, we obtain

$$-C{\tau }^{(1)}+B\left({\tau }^{(2)}-{\tau }^{(1)}\right)\ > \ 0,$$
(27)

and substituting from Eqs. (21)–(22) yields the condition \(-(N-1)C-B\ > \ 0\). Finally, the Structure Coefficient Theorem60 shows that the assumption \(a+d=b+c\) can be dropped, and Conditions (4) and (9) follow.

Spectral gap and expander graphs

The spectral gap of an isothermal graph is \(g=1-{\lambda }_{2}\), where \({\lambda }_{2}\) is the second-largest eigenvalue of the adjacency matrix. In Supplementary Note 2 we prove the following result:

Theorem 1. On an isothermal graph \(G\) of size \(N\) and spectral gap \(g\), the remeeting time \({\tau }_{i}\) for each vertex \(i\in G\) is bounded by

$${\tau }_{i}\le \frac{N-1}{g}{\,}+{\,}\frac{2N-1}{N}.$$
(28)

We formally define a ‘family of isothermal expander graphs’ as a sequence of isothermal graphs \({\{{G}_{j}\}}_{j=1}^{\infty }\), with corresponding sizes \({N}_{j}\) and spectral gaps \({g}_{j}\), such that \({N}_{j}\to \infty\) and \(\mathop{\mathrm{lim}}\nolimits_{j\to \infty }{g}_{j}=g\), with \(0\ <\ g\le 1\). Then the upper bound (28) is asymptotically \(N/g+{\mathcal{O}}(1/N)\).

Suppose that, as \(j\to \infty\), the Simpson degree distribution converges, pointwise in its quantile function, to some continuous function \(\kappa (x)\). This means that, in the limiting distribution, a fraction \(x\) of Simpson degrees are less than or equal to \(\kappa (x)\), for all \(0\le x\le 1\). Then the harmonic average Simpson degree over the quantile range \([a,b]\) is defined as

$${\kappa }_{[a,b]}=(b-a){\left({\int }_{a}^{b}{(\kappa (x))}^{-1}dx\right)}^{-1}.$$
(29)

Bounds on the effective degree are obtained by considering all the ways the weights \({\tau }_{i}\) can be apportioned among vertices, subject to the constraints of (19) and Bound (28). Placing the maximum weight on the vertices of largest Simpson degree yields \(\tilde{\kappa }\le {\kappa }_{[1-g,1]}\), while placing the maximum weight on the vertices of smallest Simpson degree yields \(\tilde{\kappa }\ge {\kappa }_{[0,g]}\). Bounds (7) follow from

$${\kappa }_{[0,g]}=g{\left({\int }_{0}^{g}{(\kappa (x))}^{-1}dx\right)}^{-1}\le g{\left({\int }_{0}^{1}{(\kappa (x))}^{-1}dx\right)}^{-1}=g{\kappa }_{{\rm{H}}},$$
(30)

and, using the harmonic-arithmetic means inequality,

$${\kappa }_{[1-g,1]}\le \frac{1}{g}{\int }_{1-g}^{1}\kappa (x)\ dx\le \frac{1}{g}{\int }_{0}^{1}\kappa (x)\ dx=\frac{{\kappa }_{{\rm{A}}}}{g}.$$
(31)

Random graph experiments

For the spatial model (Fig. 3a, c), the population size is \(N=200\), the decay parameter is \(\beta ={2}^{\ell /2}\) for \(\ell =6,7,\ldots ,14\), and the number of pairing rounds is \(100,200,\ldots ,800\). Ten random isothermal graphs were generated for each parameter combination. The clusters of points in Fig. 3c correspond to different values of \(\beta\).

The shifted-linear preferential attachment model44,45 (Fig. 3b, d) is defined as follows: Starting from a complete graph of size \(m+1\), new vertices were added one at a time, each linking to \(m\) existing vertices, chosen with probability proportional to \(k-am\), where \(k\) is vertex degree and \(a\) is a shift parameter. The process was iterated until the graph reached size \(N=400\). We used linking numbers \(m=4,5,\ldots ,20\), and shift parameter \(a\) varying from 0 to 0.9 in increments of 0.05. For each combination of \(a\) and \(m\), we generated ten graph topologies. For each topology generated this way, an isothermal weighting was obtained by minimizing \({\sum }_{i,j}{w}_{ij}^{2}\) under the constraint \({\sum }_{j}{w}_{ij}=1\) for all \(i\), using a numerical quadratic programming algorithm. This sum-of-squares minimization was chosen in order produce a unique set of edge weights that are relatively even—and therefore have relatively large Simpson degrees—given the constraints imposed by the topology and isothermality. Graph topologies that could not be made isothermal were removed from the ensemble; such graphs arose for small \(m\) and \(a\) close to 1 (see Supplementary Note 5 for further discussion). The horizontal bands for \(\bar{k}\) in Fig. 3D correspond to particular values of \(m\).

Island model

The island model is obtained by joining seperate isothermal graphs \({G}_{1},\ldots ,{G}_{n}\) of respective sizes \({N}_{1},\ldots ,{N}_{n}\). Each inter-island pair of vertices is joined by an edge of weight \(\alpha \ll 1\). Edge weights within each island \({G}_{x}\) are then rescaled by \(1-\alpha (N-{N}_{x})\) so that the sum of edge weights at each vertex remains 1. We show in Supplementary Note 3 that, in the limit \(\alpha \to 0\), coalescence times within each island \({G}_{x}\) are determined by

$${\tau }_{ij}=\left\{\begin{array}{lc}0\hfill &i=j\\ 1+{\sum }_{y=1}^{n}{N}_{y}{T}_{xy}+\frac{1}{2}{\sum }_{k\in {G}_{x}}({w}_{ik}{\tau }_{jk}+{w}_{jk}{\tau }_{ik})&i \, \ne \, j.\end{array}\right.$$
(32)

Above, the \({T}_{xy}\), for \(x,y\in \{1,\ldots ,n\}\), are themselves the solution to the system

$${T}_{xy}=\left\{\begin{array}{lc}0\hfill & x = y \\ \frac{1}{N}+\frac{1}{2N}{\sum }_{z=1}^{n}{N}_{z}({T}_{xz}+{T}_{yz})& x \, \ne \, y.\end{array}\right.$$
(33)

Solving Eqs. (32)–(33) yields the coalescence times, from which the remeeting times can be obtained from (18), and the effective degree can be obtained from (3) of the main text. We have obtained a closed-form expression for \(\tilde{\kappa }\) in two cases. First, if all islands have equal size, the effective degree is the unweighted harmonic mean of the Simpson degrees on the separate islands: \(\tilde{\kappa }=n{\left({\sum }_{x=1}^{n}{\kappa }_{x}^{-1}\right)}^{-1}\). Second, if there are \(n=2\) islands, the effective degree is

$$\tilde{\kappa }={N}^{3}{\left({N}_{1}^{2}({N}_{1}+3{N}_{2}){\kappa }_{1}^{-1}+{N}_{2}^{2}(3{N}_{1}+{N}_{2}){\kappa }_{2}^{-1}\right)}^{-1}.$$
(34)

For the case of Fig. 4A, we have \({N}_{1}={N}_{2}=N/2\), \({\kappa }_{1}=2\), and \({\kappa }_{2}=N/2-1\), giving \(\tilde{\kappa }=4(N-2)/(N+2)\). For Fig. 5B, we have \({\kappa }_{1}={N}_{1}-1\) and \({\kappa }_{2}=2(1-2\varepsilon +2{\varepsilon }^{2})\). We set \({N}_{1}=a{N}_{2}\), substitute in (34), and take the following sequence of limits: first \(\varepsilon \to 0\), then \({N}_{2}\to \infty\), then \(a\to 0\). Under this limit sequence, \(\tilde{\kappa }\to 1\) while \({\kappa }_{{\rm{A}}}\to \infty\).

Diffusible public goods

For diffusible public goods, Condition (15) still applies, but with the modified payoffs

$${f}_{i}({\bf{x}})=-C{x}_{i}+\sum _{n=0}^{\infty }{b}_{n}{x}_{i}^{(n)}.$$
(35)

The expected payoff to an individual \(m\) random walk steps from vertex \(i\) is

$${f}_{i}^{(m)}({\bf{x}})=-C{x}_{i}^{(m)}+\sum _{n=0}^{\infty }{b}_{n}{x}_{i}^{(n+m)}.$$
(36)

Condition (15) therefore becomes

$$-C\sum _{i\in G}\left\langle {x}_{i}\left({x}_{i}-{x}_{i}^{(m)}\right)\right\rangle +\sum _{n=0}^{\infty }{b}_{n}\left\langle {x}_{i}\left({x}_{i}^{(n)}-{x}_{i}^{(n+m)}\right)\right\rangle \ > \ 0,$$
(37)

where, as above, \(m=1\) for Bd or Db, and \(m=2\) for dB or bD. Upon applying Eq. (25), the condition becomes

$$-C{\tau }^{(m)}+\sum _{n=0}^{\infty }{b}_{n}\left({\tau }^{(n+m)}-{\tau }^{(n)}\right)\ > \ 0.$$
(38)

Applying (20) and the properties of random walks, we show in Supplementary Note 5 that this condition reduces to

$$-C\left(N\sum _{k=0}^{m-1}{p}^{(k)}-m\right)+B\left(N\sum _{k=0}^{m-1}{\phi }^{(k)}-m\right)\ > \ 0.$$
(39)

Above, we have defined \({p}^{(k)}={\sum }_{i\in G}\frac{{\tau }_{i}}{{N}^{2}}{p}_{ii}^{(k)}\) and \({\phi }^{(k)}={\sum }_{i,j\in G}\frac{{\tau }_{i}}{{N}^{2}}{p}_{ij}^{(k)}{\phi }_{ij}\). Both of these quantities refer to a \(k\)-step random walk with initial vertex \(i\) chosen proportionally to remeeting time; \({p}^{(k)}\) is the probability that such a walk terminates at its origin, and \({\phi }^{(k)}\) is the expected fraction of public good produced at the intial vertex that would be received at the terminus. We observe that the benefit term of Eq. (39) includes only benefits accruing at distances less than \(m\) from the producer. Substituting the appropriate values of \(m\), and noting that \({p}^{(0)}=1\) and \({p}^{(1)}=0\), we obtain Conditions (11) and (12) of the main text.

Reporting summary

Further information on research design is available in the Nature Research Reporting Summary linked to this article.