# Collapse and rescue of cooperation in evolving dynamic networks

## Abstract

The evolutionary dynamics of social traits depend crucially on the social structure of a population. The effects of social structure on social behaviors are well-studied, but relatively little is known about how social structure itself coevolves with social traits. Here, I study such coevolution with a simple yet realistic model of within-group social structure where social connections are either inherited from a parent or made randomly. I show that cooperation evolves when individuals make few random connections, but the presence of cooperation selects for increased rates of random connections, which leads to its collapse. Inherent costs of social connections can prevent this negative feedback, but these costs can negate some or all of the aggregate benefits of cooperation. Exogenously maintained social inheritance can mitigate the latter problem and allow cooperation to increase the average fitness of a population. These results illustrate how coevolutionary dynamics can constrain the long-term persistence of cooperation.

## Introduction

Cooperation is easy to evolve. In the last half century, we have discovered that there are myriad ways natural selection can favor organisms providing benefits to each other. These pathways include population structure1, phenotypic feedbacks2,3, payoff synergies4, partner choice5, among others e.g., see reviews in refs. 6,7,8 When operating together, these pathways to cooperation can reinforce6,9,10,11 or counteract each other12. This extensive literature overwhelmingly tries to explain how cooperation can persist in the face of conflicts of interests. But with so many ways cooperation might be selected for, it is worth asking why cooperation is not even more prevalent.

The answer to this question lies in how the conditions leading to cooperation themselves evolve, i.e., how selection acts on the setting in which the interaction takes place i.e., the payoff structure, interaction network, etc.13[,14, and how the setting coevolves with cooperation. This question has recently been garnering attention. An emerging common thread is that these coevolutionary processes might impose inherent limits to the maintenance of cooperation in the long term. For example, in a model of evolution of incentives for cooperation, Aky and Roughgarden14 showed that incentives that favor cooperation may invade but not fix, leading to stable polymorphisms where cooperation and defection are both maintained in the population. In another model of payoff evolution, Stewart and Plotkin15 showed a different kind of dynamic self-limitation: when cooperation is established in the population, it tends to drive the evolution of payoffs for cooperation so high that the temptation for defecting becomes overwhelming, leading to the collapse of cooperation. In a model incorporating environmental feedbacks that affect the payoffs, Weitz et al.16 showed that negative feedbacks between social strategies and environmental variables that favor them can create oscillations between cooperative and non-cooperative outcomes. More recently, Mullon et al.17 showed that in settings where dispersal and cooperation coevolve, selection might result in stable polymorphisms where non-cooperators persist by evolving higher dispersal rates.

One major factor in the evolution of cooperation is the social structure of groups (i.e., who interacts with whom), represented by social networks18,19. Social networks and variation in individuals’ positions in them are shown to affect important life history traits such as reproductive success20, survival21,22, infant survival23, as well as selection on particular behaviors24, and resilience of social groups25. Yet despite the emerging evidence about the importance of dynamic fine-scale social structure, it has not yet been integrated fully into social evolutionary theory, where most models deal with special kinds of networks e.g., lattice structured26, fixed networks27,28,29, dynamic networks with random connections30,31, or shifting connections amongst a fixed set of individuals32,33,34. A recent study by Cavaliere et al.35 comes closest to the current work: they model the evolution of cooperation on a dynamic heterogenous network structured by pure social inheritance (as defined below), though without a feedbacks between the evolutionary dynamics of social structure and cooperation (see Discussion for more). Although each of these modeling approaches captures important aspects of how population structure affects cooperation, we know relatively little about how social traits might evolve in more realistic dynamic social networks, and how these traits might feed back on the structure of networks.

This gap is in part caused by the lack of a generally applicable model for network dynamics that can capture important features of social networks and variation therein. Recently, Ilany and Akçay36 proposed such a model, where social ties are formed by a mixture of individuals “inheriting” connections from their parents, i.e., connecting to their parents’ connections, and randomly connecting to others. They showed that this simple process of social inheritance can capture important features of animal networks such as their degree and clustering distributions as well as modularity. Importantly, the animal networks investigated by Ilany and Akçay tended to have relatively high probabilities of social inheritance, while having low (but non-zero) probability of random linking. These findings suggest that the social inheritance process is a good candidate for modeling the fine-scale dynamics of animal social networks and the evolution of social behaviors on them. Importantly, they raise the question of how social inheritance affects the evolutionary dynamics of social behaviors, and how social inheritance coevolves with these behaviors.

In this paper, I present a computational model of the evolution of a cooperative behavior on a dynamic network that is assembled through social inheritance. I find that cooperation evolves when the probability of random linking is low, mostly independently of the probability of social inheritance. However, when these two linking probabilities themselves coevolve with cooperation, I show that in cooperative populations, probabilities of random linking are selected to increase, which in turn leads to the collapse of cooperation. This result highlights a new way in which some forms of cooperation can inherently be self-limiting. I then show that costs of making and maintaining social links can counteract the self-limiting feedback through the evolution of social structure. At the same time, costly links lead to unexpected non-monotonic patterns in long-term frequency of cooperation. Overall, my results shed light on new kinds of evolutionary feedbacks between traits that structure social networks and the social behaviors that evolve on them.

## Results

### Overview of model

My model builds on Ilany and Akçay’s36 by adding selection caused by social interactions on a dynamic, binary, and undirected network. I assume a death–birth process, where at each time step, a random individual is selected to die, and another individual is selected to reproduce to replace them. The newborn individual makes social connections as follows: (i) it connects to its parent with certainty, (ii) it connects to each individual that is connected to its parent (at the time of birth) with probability pn, and (iii) it connects to each individual that is not connected to its parent (at the time of birth) with probability pr. Ilany and Akçay36 showed that this basic model (with no selection) can capture important aspects of social structure in the wild. Here, I add selection caused by social interactions, where the probability of being selected to reproduce is an increasing function of the payoffs individuals obtain from their social interactions. In particular, I assume there are two types of individuals, cooperators and defectors: cooperators provide their connections a total benefit B, divided equally amongst all their connections, and pay a cost C; defectors pay no costs and provide no benefits. I also consider scenarios where two connected cooperators each get a synergistic benefit D, divided by the product of their degrees. Details of the model are given in the Methods section. Below, I first consider pn and pr to be fixed and the same for every individual. Then, I let the linking probabilities pn and pr be heritable and vary between individuals, so that they evolve according to their fitness consequences.

I first consider the fate of a cooperation allele in groups that have fixed probabilities of random linking pr and social inheritance pn, and no costs to linking. I find that cooperation is maintained only under relatively low pr (Fig. 1). Interestingly, for most of its range pn makes relatively little difference in the long-term frequency of cooperation. This indifference breaks down at very high levels of pn, which disfavors cooperation. These results represent relatively straightforward cases of kin selection: low random linking and not too high social inheritance produces high assortment between connected individuals, so that cooperators benefit more from interactions with other cooperators (Supplementary Fig. 1). Higher probability of random linking reduces the assortment, as might be expected. Intuitively, we might expect higher social inheritance to increase assortment and therefore favor cooperation, but in fact, the effect of social inheritance on assortment is neutral or negative (at high pn). This is because in the current model offspring have the same probability of inheriting all connections their parents make, regardless of whether those connections were inherited or made randomly. At high social inheritance, however, networks evolve to be very densely connected which reduces the potential for assortment36 (Supplementary Fig. 1). In more densely connected networks, the average benefit per link obtained from a cooperative partner also decreases due to the dilution effect (Eq. (1)). This also works against cooperation (compare with results for the prisoner’s dilemma game with constant benefit per link in Supplementary Note 2).

With positive synergism between cooperators the picture changes slightly. As expected, stronger synergistic interactions (higher D) make cooperation possible for a larger range of pn and pr value (Fig. 2), as synergism generates benefits that are only available to other cooperators4,37. However, this added benefit is mainly realized at low levels of social inheritance, when the average degree of individuals is low and therefore the synergistic benefits are less diluted. As a result, with positive synergism, increasing both social inheritance and random linking probabilities (both of which increase the average degree of individuals) favors defection.

### Coevolution of linking probabilities undermines cooperation

Next, I let the linking probabilities pn and pr coevolve with cooperation. Figure 3 shows a collection of sample trajectories that start with a low probability of random linking. Cooperation is quickly established in the population, but once it is established, it creates selection for the probability of random linking, pr, to increase. Increased pr in turn reverses selection on cooperation, and defection is established again in the population. These dynamics reveal that cooperation is self-limiting when the social structure co-evolves with it: once cooperation establishes in a population, it creates selection against the social structure that allowed it to evolve in the first place. The intuition behind this result is quite simple and general: in a cooperative population, it pays to make connections with any individual, since there is likely to be a benefit to be had from that connection. Therefore, individuals with higher probability of random linking (and thus, more connections) fare better in a cooperative population. This leads to a population with high probability of random linking, where we know cooperation cannot persist.

### Costs of linking can rescue cooperation

One possible mechanism that can counteract these dynamics is when making and maintaining social links is inherently costly, regardless of one’s phenotype or that of partners. Such costs can counteract the incentive to seek out more connections, and prevent the linking probabilities (specifically, pr) from crossing the threshold beyond which cooperation cannot be sustained. Figure 4 confirms that costs of social connections can prevent cooperation from limiting itself: for a given value of benefit B, as the cost of linking, Clink increases, the long-term average frequency of cooperation tends to increase. Interestingly however, this long-term average displays a non-monotonic pattern in B for moderate to high Clink: as B increases from low values, cooperation at first becomes more prevalent, as one might intuitively expect. In contrast, at higher values of B, making cooperation more beneficial reduces its long-term frequency. This “paradox of enrichment” (no relation to the one observed in prey–predator dynamics38) is another manifestation of the self-limiting nature of cooperation in dynamic networks: as the benefit from cooperation increases, so does the incentive to make random links in a cooperative population. Therefore, pr evolves to higher values, which eventually undermines cooperation. Equivalently, a higher cost of linking is required to keep pr low and maintain cooperation. This effect can be seen by looking at the average pr (Fig. 4b), which increases with B for a given cost of linking. We observe this non-monotonicity of cooperation and increase of pr with the benefit B in both strong and weak selection (compare with Supplementary Fig. 6).

A final paradoxical result in Fig. 4c is that even when cooperation is sustained, the costs incurred may be too high, such that the average fitness of the population (calculated using Eq. (14)) can actually be lower in a more cooperative population than a less cooperative one (e.g., compare B = 2 and Clink = 0 and Clink = 0.4 in Fig. 4c). More generally, for a given level of benefit B, the mean fitness of a population follows a non-monotonic pattern with the costs of linking: the mean fitness first decreases and then increases with Clink. In other words, even though cooperation can be rescued by costs of social connections, the victory may prove pyrrhic.

When the main benefits from cooperation come from synergistic payoffs, cooperation tends to be stable when links are also costly, as shown in Fig. 5 for weak selection (strong selection yields similar results; see Supplementary Note 1). Here, synergism and costs of linking interact positively: for a given (non-zero) cost of linking, increasing synergy increases the frequency of cooperation, and vice versa. As a result, the more synergistic the payoffs, the lower the cost of linking required to maintain cooperation. Like the no-synergism case, cooperation tends to be accompanied by low pr and pn. Furthermore, pn and pr display monotonically decreasing patterns in both synergism and cost of linking 5(b, d), resulting in very sparsely connected networks (Supplementary Fig. 5). This is because synergistic benefits are inversely proportional to the product of degrees, and therefore selection on reducing the mean degree of cooperators is strong. In general, synergistic payoffs, together with some costs of linking promote cooperation and increase mean fitness 5(c), but result in very sparsely connected networks.

### Exogenously high social inheritance can rescue cooperation

One surprising aspect of the preceding results is that there is relatively little selection on the probability of social inheritance pn due to feedbacks from the social trait, in contrast to the probability of random linking, pr. This suggest that social inheritance might predominantly evolve due to other selection pressures or as a pleiotropic consequence of group living (e.g., due to offspring passively being in proximity of their parent’s connections). This raises the question of how cooperation and pr fare when social inheritance is fixed by an exogenous factor. Figure 6 shows that when pn is fixed exogenously but pr is left free to co-evolve with cooperation, high social inheritance can maintain high frequency of cooperation in conjunction with costly linking. This result may appear to be in contradiction with my first results above when both linking traits are fixed, where higher pn, holding pr fixed, reduces cooperation. The contradiction is resolved by observing that when pn is high, and links are costly, pr will evolve to be lower, because the higher pn the higher marginal cost of higher pr due to the steeper increase in the expected mean degree of an individual Figure 2 of ref. 36. This means that for a given benefit from cooperation, the marginal cost of increased random connections becomes equal to the marginal benefits at a lower level of pr, which favors cooperation. Biologically, this means that high social inheritance, if evolved (and maintained) for reasons other than cooperative benefits, can also function to sustain cooperative populations (see Discussion for more).

## Discussion

These results add to a growing theoretical literature that is uncovering cases where evolutionary dynamics lead to the establishing of cooperation, only to undermine it through altering the conditions that select for it in the first place. Previous results uncovered such negative feedbacks operating through the payoff structure of a game, whether by direct evolution of payoffs14,15 or through environmental feedbacks that alter the returns from different strategies16. Here, I identify a different kind of dynamical feedback between cooperation and the setting in which it evolves. By focusing on the interplay between a simple yet realistic model of network dynamics and social behaviors, I show that the structure of the society that favors cooperation can itself fall victim to cooperation. The logic behind this phenomenon applies generally beyond the current model: cooperation tends to be favored when population assortment is high. But regardless of the details of the process of acquiring connections, in cooperative populations, connections with most individuals are beneficial, and therefore individuals in such populations would be selected for making more connections indiscriminately. All else being equal, this would lead to more mixing in the population, which in turn disfavors cooperation. Thus, coevolution of the network structure with social traits such as cooperation sets up a fundamental negative feedback that has not previously been recognized. Furthermore, the negative feedback is stronger with higher benefits of cooperation, which increases the temptation to link randomly at high rates.

Costs to making and maintaining connections might counteract this negative feedback by reducing selection for increased probability of making random connections. Accordingly, I find that with high enough costs, cooperation can be maintained. Maintenance of social bonds in many animal and human societies involves costly investments39,40, which in many cases are not beneficial to either party. Previous theory hypothesized that such costs might serve signal partner quality41 or building trust42. My results show that regardless of their function at the level of the pair of individuals, costs of maintaining bonds shape the social structure of a group in a way that facilitates cooperation. Therefore, it is possible that such costs can evolve through cultural or genetic selection at the group level as a group-level adaptation that sustains selection for cooperation within groups. However, this expectation is tempered by the fact that even when cooperation is rescued, the costs of linking may be too high for cooperation to be a net benefit to the population on average (Fig. 4c).

A potential way for populations to avoid such a pyrrhic victory for cooperation is when social inheritance is kept high by factors exogenous to the current model. Then, costs of linking can promote cooperation and high payoffs (Fig. 6). This happens because high social inheritance effectively increases the costs of random linking, as these links are more likely to get inherited, and therefore increase the average degree of a lineage36. Thus, for a given cost of linking, higher pn means higher marginal costs of increasing pr, which in turn means that pr evolves to a lower level, which maintains more cooperation. I furthermore show that at least under weak selection, coevolving cooperation will not strongly oppose selection on pn due to other factors. Taken together, these results suggest a potential pathway to cooperation where high social inheritance can evolve for reasons other than cooperation, including possibly group-level selection on behavioral (or institutional) traits that favor both social inheritance and some costs of linking, thereby favoring within-group cooperation. Exploring the multi-level evolutionary dynamics of linking traits and their costs is likely to yield further interesting insights.

Finally, it is worth noting that the connection costs do not rescue cooperation in the Prisoner’s Dilemma game (see “Evolving linking probabilities” in Supplementary Note 2), where the benefits and costs from cooperation increase linearly with degree. This happens because connection links in such a scenario only serve to effectively increase the costs of cooperation. If cooperation evolves for a given level of linking costs, it implies that the benefit of being connected to a cooperator exceeds the joint costs of cooperation and linking. Therefore, random linking will necessarily increase and cooperation will collapse. This represents another way in which cooperation can be too beneficial for its maintenance.

A potential way to avoid these fundamentally self-limiting dynamics of cooperation is partner choice5, i.e., preferentially interacting with cooperators or avoiding defectors. Papers by Pacheco et al.30 and Santos et al.31 provide models of evolution of cooperation through partner choice in dynamic networks. In these models, players make and break connections with each other at rates that depend on the type of the partners. These models show that cooperation can evolve and be stable in dynamically changing networks. However, these models consider type-dependent linking rates as exogenously fixed, and do not consider how they might co-evolve with cooperation. When the coevolutionary dynamics are considered, it is likely that we would recover the self-limiting nature of cooperation in these models as well. This is because at highly cooperative populations, there would be little need to maintain differential connection rates, which means that they would erode, setting up the stage for the collapse of cooperation. Previous models have shown that in pairwise interactions adequate mutation rate43 or immigration from a source population with high variation44 is required to maintain choosiness and thus cooperation. How the dynamics of partner choice operate in a network context remains to be explored.

Another mechanism that can maintain cooperation is direct reciprocity between interacting individuals2,3. While I do not model reciprocity explicitly, we know that in pairwise interactions, the effects of reciprocity can be accounted for by a synergistic payoff function, where reciprocators achieve an extra benefit not available to non-reciprocators10,37. I find that synergistic payoffs such as those that might be expected from reciprocal cooperation tend to (unsurprisingly) favor cooperation, but they are still subject to the self-limitation problem. However, with reciprocity, the self-limitation problem is resolved more easily and costs of linking that prevent high random linking act in concert with synergistic benefits, rather than antagonistically like they do with additive benefits. This pattern is consistent with previous results that show behavioral responses and population structure tend to act in synergy with each other9,10,11. One caveat here is that strong synergism tends to select for sparsely connected networks with low pn and pr, due to the dilution effect on synergistic benefits.

It is interesting to relate the results in network-structured populations presented here to the rich literature on spatially structured models of social evolution, where dispersal determines a newborn’s social partners. For example, Koella45 modeled a scenario where investment into cooperation can coevolve with dispersal and interaction distances on a lattice. When dispersal and interaction were fixed and local, cooperation readily evolved, but when dispersal distance coevolves with cooperation, defectors evolve long-distance dispersal which leads to reduced investment by cooperators, analogous to what happens on my model with increased random linking and subsequent collapse of cooperation. When interaction neighborhood also evolves, cooperators and defectors can coexist in spatially alternating bands, with cooperators interacting hyper-locally. Another paper, by Smaldino and Schank46, explores how movement traits coevolve with cooperation in a spatially structured population where individuals move around a lattice looking for partners. They find that cooperation is more successful with less movement, which in terms of the interaction networks would correspond to most individuals staying near their parents and therefore making fewer random links and socially inheriting more. In contrast, when defectors moved a lot, they did better as they were able to find and exploit cooperator clusters. When cooperators and defectors used their respective best movement strategies, Smaldino and Schank observed persistently polymorphic populations. Likewise, Mullon et al.17 found that in patch-structured populations, cooperators and defectors can coexist with the former evolving low dispersal rates and the latter high. These results are analogous to those I find in larger networks (see “Evolution in large networks” in Supplementary Note 1), where cooperators and defectors can coexists for periods of time with cooperators evolving low linking probabilities and defectors high. Another interesting result from a lattice-structured model to compare to the current paper is that of Smaldino et al.47, who found that increasing the costs of cooperation can favor cooperation in the long-run. This result is some ways analogous to my finding that higher benefits can reduce the long-term frequency of cooperation, but happens due to a different mechanism: in Smaldino et al., high costs first cause most cooperators to die out, followed by defectors. Cooperators can then re-invade an empty landscape in clusters, which are subsequently surrounded by defectors but can get big enough to avoid the costs of being taken advantage of.

The closest existing model to the present one is one by Cavaliere et al.35, who consider the evolution of cooperation in a population with fixed (and moderately high) social inheritance, but no random linking. Consistent with my results with fixed linking probabilities, their populations evolve to be mostly cooperative. However, Cavaliere et al. find in their simulations that cooperative populations were densely connected while defector networks are sparse. This pattern arises because in cooperative societies more connected individuals are selected for, especially since Cavaliere et al. assume that the benefit per link from a cooperator is constant rather than being diluted as 1/degree as in this model. Although Cavaliere et al. assume no variation in individuals’ linking traits, individuals can still pass down their higher degree to their offspring through social inheritance, which happens in my model as well. However, since this effect is purely due to social inheritance, and not the evolution of linking traits themselves, it does not limit cooperation in the long-term. In contrast, once the average linking probabilities (especially pr) evolve to high values in my model, the population spends more time in low-cooperation states. It is also worth noting that the change in network structure found by Cavaliere et al. requires relatively strong selection (e.g., very high absolute values of B and C); under weak selection, the presence or absence of cooperation by itself has a relatively small effect on network structure. For the same reason, under weak selection and fixed linking probabilities, costly linking would also have little effect on network structure or the presence of cooperation, although with strong selection they can depress the connectivity of the network and therefore maintain cooperation for a wider range of (fixed) pn and pr values.

It is interesting to ask how the linking probabilities that favor cooperation compare to observed social networks in the wild. Ilany and Akçay36 find that animal social networks tend to be characterized by moderate to high social inheritance, pn (0.5–0.8), and low pr (0–0.1). These linking probabilities are generally consistent with the presence of cooperation for a range of payoff parameters in my model. Therefore, my results suggest that conditions for cooperation might be met in the wild. When the linking probabilities themselves evolve, I find that the random linking probability, pr, responds to different selective forces in an intuitive way: evolved pr decreases with increasing costs of linking, and increases with increasing benefits from cooperation. On the other hand, the social inheritance probability, pn seems to be somewhat less intuitive: at least under weak selection, pn behaves largely neutrally, exhibiting little sensitivity to benefits of cooperation or costs of linking (see “Results under strong selection” in Supplementary Note 1). Therefore, my results suggest that other factors that are not modeled here, such as obtaining support in social conflicts or between-group selection (as discussed above), might select for higher social inheritance. Alternatively, pn might be high simply as a by-product of the parent–offspring associations (offspring spending a lot of time with their parents and therefore the parents’ connections).

In conclusion, my results show that the evolution of social traits such as cooperation can have unexpected consequences for the social structure that determines the direction of social selection. I identify a fundamental negative feedback that causes cooperation to be self-limiting through its effects on the social network structure. These results highlight the need to understand dynamic feedbacks between selection acting social traits and the environment in which they evolve. These feedbacks might help explain why not every cooperation problem in nature will be solved despite the myriad theoretical mechanisms available in principle, or why the solution might not always prove to be beneficial on the net. Focusing on these feedbacks will allow us to move beyond explaining how selection can favor cooperation in principle to predicting when the conditions that favor it are likely to exist.

## Methods

### Social interaction and fitness

My model extends the previously published one by Ilany and Akçay36 by adding selection caused by social interactions. To add selection, I assume that each individual can be of one of two types: cooperators and defectors. Cooperators provide a benefit B to their partners (those that are connected to them on the network), distributed equally amongst all partners. In other words, if a given cooperator individual has d connections, each of its partners acquire a benefit B/d from it. Cooperators also pay a fixed cost C, regardless of the number of type of their connections. This game is a special case of the “coauthor game” of Jackson and Wolinsky48. Intuitively, it represents an interaction where cooperators have a fixed time or energy budget to help others e.g., by spending time grooming49 (or writing papers with) others, and that this benefit is divided equally amongst an individual’s connections. Defectors pay no cost of helping, provide no benefits, but benefit from the cooperators they are connected to. Finally, I allow the possibility that there is negative or positive synergism between cooperators, such that when two cooperators interact, their payoff is incremented by D/(di dj), where D is the synergistic benefit. Thus, the payoff of an individual i at time-step t, ui(t), is given by:

$$u_i\left( t \right) = {\mathop {\sum}\limits_{j \ne i}} p_ja_{ij}\left( {\frac{B}{{d_j\left( t \right)}} + p_i\frac{D}{{d_i\left( t \right)d_j\left( t \right)}}} \right) - p_iC,$$
(1)

where pj {0, 1} is the frequency of the cooperator allele in individual j, aij = 1 if i and j are connected, and 0 otherwise, and dj(t) is the degree (number of connections) of player j at time t. An individual with payoff ui has fitness wi, given by:

$$w_i = \left( {1 + \delta } \right)^{u_i},$$
(2)

where δ > 0 is the strength of selection.

An alternative to this payoff structure can be imagined where cooperators supply a constant benefit per link. The realism of constant total or constant per link benefits depend on the absolute magnitude of benefit and the variation in degree one observes in the networks. If variation in degree is high, as happens, for example, when social inheritance is high36, then it is less realistic to assume individuals can ramp up production of benefits indefinitely with partner numbers such that each partner continues to enjoy the same benefit. Thus, I focus on the fixed total benefit model in the main text, and present in the Supplementary Note 2, results for the case where cooperators provide a fixed benefit to each partner and pay a fixed cost per partner.

I assume deaths occur randomly, independent of payoff or social network position. The probability of a given individual being selected to reproduce at a given time step, πi(t), is proportional to their fitness in the preceding time step, wi(t − 1):

$$\pi _i\left( t \right) = \frac{{w_i\left( {t - 1} \right)}}{{\mathop {\sum}\nolimits_j {w_j} \left( {t - 1} \right)}}$$
(3)

At each reproduction event, the offspring copies its parent’s cooperation type with probability 1 − μ; with probability μ, the offspring switches to the other type. The cooperation type of an individual remains unchanged during their lifetime.

To model the coevolution of the linking probabilities pn and pr with cooperation, I let them vary between individuals, and be genetically inherited from parents. With probability μl, each of the $$p{\prime}_{\!\!n}$$ and $$p{\prime}_{\!\! r}$$ of the offspring (independently) undergo mutation, whereupon they become $$p{\prime}_{\!\! n} = p_n + \varepsilon _n$$, and $$p{\prime}_{\!\! r} = p_r + \varepsilon _r$$, where pn and pr denote the parent’s linking probabilities, and εn and εr are distributed normally with mean zero and standard deviation σn and σr, respectively. To restrict pn and pr to the unit interval [0,1], I set the numerical values to be at the relevant boundary if mutations fall outside this range.

To investigate how costs of making and maintaining social connections can alter the coevolutionary dynamics, I use the following extended payoff function:

$$u_i\left( t \right) = \mathop {\sum}\limits_{j \ne i} p_ja_{ij}\left( {\frac{B}{{d_j\left( t \right)}} + p_i\frac{D}{{d_i\left( t \right)d_j\left( t \right)}}} \right) - p_iC - d_i\left( t \right)C_{{\mathrm{link}}},$$
(4)

### Simulations

I analyze the above model using simulations written in the Julia programming language50. I initialize networks as random networks, and run the social inheritance model of Ilany and Akçay without selection for an inital burn-in period of 20 generations (i.e., 20 × N time steps). This burn-in period is sufficient to produce networks that have the stationary properties of the social inheritance process36. Then, I allocate the cooperation trait randomly to all individuals (i.e., with expected frequency of cooperation 0.5), and turn on selection. For simulations with evolving linking probabilities, I initialize the individual pn and pr values from a normal distribution with standard deviation given by the mutational variances σn and σr, and mean by initial values pn = 0.5 (except for the fixed pn scenario) and pr = 0.0001. These initial values do not have any effect on the long-run dynamics of the system as the system quickly evolves away from them.

### Code availability

The simulation code is available at https://github.com/erolakcay/CooperationDynamicNetworks.

### Data availability

Simulation output used in the figures is available upon request from the author.

## References

1. 1.

Hamilton, W. D. The genetical evolution of social behaviour. J. Theor. Biol. 7, 1–16 (1964).

2. 2.

Trivers, R. L. The evolution of reciprocal altruism. Q. Rev. Biol. 46, 35–57 (1971).

3. 3.

Axelrod, R. & Hamilton, W. D. The evolution of cooperation. Science 211, 1390–1396 (1981).

4. 4.

Queller, D. Kinship, reciprocity and synergism in the evolution of social behaviour. Nature 318, 366–367 (1985).

5. 5.

Bull, J. J. & Rice, W. R. Distinguishing mechanisms for the evolution of co-operation. J. Theor. Biol. 149, 63–74 (1991).

6. 6.

Lehmann, L. & Keller, L. The evolution of cooperation and altruism-a general framework and a classification of models. J. Evol. Biol. 19, 1365–1376 (2006).

7. 7.

West, S. A., Griffin, A. & Gardner, A. Evolutionary explanations for cooperation. Curr. Biol. 17, R661–R672 (2007).

8. 8.

Nowak, M. A. Five rules for the evolution of cooperation. Science 314, 1560–1563 (2006).

9. 9.

Akçay, E. & Van Cleve, J. Behavioral responses in structured populations pave the way to group optimality. Am. Nat. 179, 257–269 (2012).

10. 10.

Van Cleve, J. & Akçay, E. Pathways to social evolution: reciprocity, relatedness, and synergy. Evolution 68, 2245–2258 (2014).

11. 11.

Van Cleve, J. Stags hawks, and doves: Individual variation in helping in social evolution theory. Integr. Comp. Biol. 57, E435–E435 (2017).

12. 12.

Akçay, E. Population structure reduces benefits from partner choice in mutualistic symbiosis. Proc. R. Soc. B 284, 20162317 (2017).

13. 13.

Akçay, E., Roughgarden, J., Fearon, J. D., Ferejohn, J. A. & Weingast, B. Biological institutions: the political science of animal cooperation. SSRN Working Paper 2370952 (2010).

14. 14.

Akçay, E. & Roughgarden, J. The evolution of payoff matrices: providing incentives to cooperate. Proc. Biol. Sci. 278, 2198–2206 (2011).

15. 15.

Stewart, A. J. & Plotkin, J. B. The collapse of cooperation in evolving games. Proc. Natl Acad. Sci. USA 111, 17558–17563 (2014).

16. 16.

Weitz, J. S., Eksin, C., Paarporn, K., Brown, S. P. & Ratcliff, W. C. An oscillating tragedy of the commons in replicator dynamics with game-environment feedback. Proc. Natl Acad. Sci. USA 113, E7518–E7525 (2016).

17. 17.

Mullon, C., Keller, L. & Lehmann, L. Social polymorphism is favoured by the co-evolution of dispersal with social behaviour. Nat. Ecol. Evol. 2, 132 (2018).

18. 18.

Wey, T., Blumstein, D. T., Shen, W. & Jordán, F. Social network analysis of animal behaviour: a promising tool for the study of sociality. Anim. Behav. 75, 333–344 (2008).

19. 19.

Pinter-Wollman, N. et al. The dynamics of animal social networks: analytical, conceptual, and theoretical advances. Behav. Ecol. 25, 242–255 (2013).

20. 20.

Schülke, O., Bhagavatula, J., Vigilant, L. & Ostner, J. Social bonds enhance reproductive success in male macaques. Curr. Biol. 20, 2207–2210 (2010).

21. 21.

Silk, J. B. et al. Strong and consistent social bonds enhance the longevity of female baboons. Curr. Biol. 20, 1359–1361 (2010).

22. 22.

Lehmann, J., Majolo, B. & McFarland, R. The effects of social network position on the survival of wild barbary macaques, Macaca Sylvanus. Behav. Ecol. 27, 20–28 (2015).

23. 23.

Silk, J. B., Alberts, S. C. & Altmann, J. Social bonds of female baboons enhance infant survival. Science 302, 1231–1234 (2003).

24. 24.

Farine, D. & Sheldon, B. Selection for territory acquisition is modulated by social network structure in a wild songbird. J. Evol. Biol. 28, 547–556 (2015).

25. 25.

Goldenberg, S. Z., Douglas-Hamilton, I. & Wittemyer, G. Vertical transmission of social roles drives resilience to poaching in elephant networks. Curr. Biol. 26, 75–79 (2016).

26. 26.

Rousset, F. & Billiard, S. A theoretical basis for measures of kin selection in subdivided populations: finite populations and localized dispersal. J. Evol. Biol. 13, 814–825 (2000).

27. 27.

Ohtsuki, H., Hauert, C., Lieberman, E. & Nowak, M. A. A simple rule for the evolution of cooperation on graphs and social networks. Nature 441, 502–505 (2006).

28. 28.

Taylor, P. D., Day, T. & Wild, G. Evolution of cooperation in a finite homogeneous graph. Nature 447, 469–472 (2007).

29. 29.

Allen, B. et al. Evolutionary dynamics on any population structure. Nature 544, 227–230 (2017).

30. 30.

Pacheco, J., Traulsen, A. & Nowak, M. A. Coevolution of strategy and structure in complex networks with dynamical linking. Phys. Rev. Lett. 97, 258103 (2006).

31. 31.

Santos, F. C., Pacheco, J. M. & Lenaerts, T. Cooperation prevails when individuals adjust their social ties. PLoS Comput. Biol. 2, e140 (2006).

32. 32.

Skyrms, B. & Pemantle, R. A dynamic model of social network formation. Proc. Natl Acad. Sci. USA 97, 9340–9346 (2000).

33. 33.

Fu, F., Hauert, C., Nowak, M. A. & Wang, L. Reputation-based partner choice promotes cooperation in social networks. Phys. Rev. E 78, 026117 (2008).

34. 34.

Huang, K., Zheng, X., Li, Z. & Yang, Y. Understanding cooperative behavior based on the coevolution of game strategy and link weight. Sci. Rep. 5, 14783 (2015).

35. 35.

Cavaliere, M., Sedwards, S., Tarnita, C. E., Nowak, M. A. & Csikász-Nagy, A. Prosperity is associated with instability in dynamical networks. J. Theor. Biol. 299, 126–138 (2012).

36. 36.

Ilany, A. & Akçay, E. Social inheritance can explain the structure of animal societies. Nat. Commun. 7, 12084 (2016).

37. 37.

Fletcher, J. A. & Zwick, M. Unifying the theories of inclusive fitness and reciprocal altruism. Am. Nat. 168, 252–262 (2006).

38. 38.

Rosenzweig, M. L. Paradox of enrichment: destabilization of exploitation ecosystems in ecological time. Science 171, 385–387 (1971).

39. 39.

Mauss, M. The Gift: The Form and Reason for Exchange in Archaic Societies. Translated by W.D. Halls (Routledge, London, 1990).

40. 40.

Henkel, S., Heistermann, M. & Fischer, J. Infants as costly social tools in male barbary macaque networks. Anim. Behav. 79, 1199–1204 (2010).

41. 41.

Sozou, P. D. & Seymour, R. M. Costly but worthless gifts facilitate courtship. Proc. R. Soc. Lond. B: Biol. Sci. 272, 1877–1884 (2005).

42. 42.

Bergstrom, C. T., Kerr, B. & Lachmann, M. in Moral Markets: The Critical Role of Values in the Economy(ed. Zak, P.) 142–156 (Princeton University Press, Princeton, NJ, 2008).

43. 43.

McNamara, J. M., Barta, Z., Fromhage, L. & Houston, A. I. The coevolution of choosiness and cooperation. Nature 451, 189–192 (2008).

44. 44.

Foster, K. R. & Kokko, H. Cheating can stabilize cooperation in mutualisms. Proc. Biol. Sci. 273, 2233–2239 (2006).

45. 45.

Koella, J. C. The spatial spread of altruism versus the evolutionary response of egoists. Proc. R. Soc. Lond. B: Biol. Sci. 267, 1979–1985 (2000).

46. 46.

Smaldino, P. E. & Schank, J. C. Movement patterns, social dynamics, and the evolution of cooperation. Theor. Popul. Biol. 82, 48–58 (2012).

47. 47.

Smaldino, P. E., Schank, J. C. & McElreath, R. Increased costs of cooperation help cooperators in the long run. Am. Nat. 181, 451–463 (2013).

48. 48.

Jackson, M. O. & Wolinsky, A. A strategic model of social and economic networks. J. Econ. Theory 71, 44–74 (1996).

49. 49.

Seyfarth, R. M. A model of social grooming among adult female monkeys. J. Theor. Biol. 65, 671–698 (1977).

50. 50.

Bezanson, J., Edelman, A., Karpinski, S. & Shah, V. B. Julia: a fresh approach to numerical computing. SIAM Rev. 59, 65–98 (2017).

## Acknowledgements

I thank J. Van Cleve, B. Morsky, and M. Smolla for comments on the manuscript, and A. Ilany for discussions. I acknowledge support from the Defense Advanced Research Projects Agency NGS2 program (Grant D17AC00005), the Army Research Office (W911NF-12-R-0012-03), the US-Israel Binational Science Foundation (2015088), and the National Academies of Science Keck Futures Initiative.

## Author information

Authors

### Contributions

E.A. conceived and designed the study, wrote the code, analyzed model, and wrote the manuscript.

### Corresponding author

Correspondence to Erol Akçay.

## Ethics declarations

### Competing interests

The author declares no competing interests.

Publisher's note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Akçay, E. Collapse and rescue of cooperation in evolving dynamic networks. Nat Commun 9, 2692 (2018). https://doi.org/10.1038/s41467-018-05130-7

• Accepted:

• Published:

• ### Deconstructing Evolutionary Game Theory: Coevolution of Social Behaviors with Their Evolutionary Setting

• Erol Akçay

The American Naturalist (2020)

• ### Evolution of cooperation in a conformity-driven evolving dynamic social network

• Zhihu Yang
• , Zhi Li
•  & Long Wang

Applied Mathematics and Computation (2020)

• ### How demographic processes shape animal social networks

• Daizaburo Shizuka
• , Allison E Johnson
•  & Leigh Simmons

Behavioral Ecology (2020)

• ### Steering eco-evolutionary game dynamics with manifold control

• Xin Wang
• , Zhiming Zheng
•  & Feng Fu

Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences (2020)

• ### Evolutionary games with environmental feedbacks

• Andrew R. Tilman
• , Joshua B. Plotkin
•  & Erol Akçay

Nature Communications (2020)