Predicting transitions in cooperation levels from network connectivity

Networks determine our social circles and the way we cooperate with others. We know that topological features like hubs and degree assortativity affect cooperation, and we know that cooperation is favoured if the benefit of the altruistic act divided by the cost exceeds the average number of neighbours. However, a simple rule that would predict cooperation transitions on an arbitrary network has not yet been presented. Here we show that the unique sequence of degrees in a network can be used to predict at which game parameters major shifts in the level of cooperation can be expected, including phase transitions from absorbing to mixed strategy phases. We use the evolutionary prisoner's dilemma game on random and scale-free networks to demonstrate the prediction, as well as its limitations and possible pitfalls. We observe good agreements between the predictions and the results obtained with concurrent and Monte Carlo methods for the update of the strategies, thus providing a simple and fast way to estimate the outcome of evolutionary social dilemmas on arbitrary networks without the need of actually playing the game.


Introduction
In 1992 Nowak and May observed that cooperators form compact clusters and can thereby withstand invading defectors in an iterated prisoner's dilemma game on a square lattice [1]. This was a fascinating discovery because cooperators should have died out in agreement with the Nash equilibrium of the game [2,3]. This would, in fact, always happen in a well-mixed population, but not on a network [4][5][6]. The fact that the structure of a network can positively affect the evolution of cooperation is today known as network reciprocity [1,7], and it constitutes one of five key mechanisms for cooperators to survive social dilemmas [8].
However, despite the wealth of research concerning the evolution of cooperation on networks, fundamental results have been relatively scarce.
Tanimoto [58] and Wang et al. [59] introduced universal scaling parameters to account for the strength of a dilemma disrupting the promotion of cooperation that can evaluate the outcome of a game independently of the reciprocity mechanisms, and showed how these mechanisms relax the dilemma strength [60]. Ohtsuki et al. [61], for instance, presented a simple rule for the evolution of cooperation on graphs and social networks, proving that natural selection favours cooperation if the benefit of the altruistic act, divided by the cost, exceeds the average number of neighbours. Moreover, Allen et al. [62] derived a general formula for pairwise games under weak selection that applies to any graph or social network.
In this paper, we derive a simple conjecture for cooperation transitions in evolutionary social dilemmas based on the unique sequence of degrees in a network. As we will show, the conjecture predicts well at which game parameters important shifts in the level of cooperation can be expected, including phase transitions from absorbing to mixed strategy phases [63,64].
In what follows, we first present the derivation of the conjecture and then proceed with showing the results obtained for the evolutionary prisoner's dilemma game on random and scale-free networks. We conclude by discussing the implications of our research to optimise large-scale simulations of evolutionary processes on complex networks and the possibilities for the generalisation of the conjecture to related subjects.

Game and conjecture formulation
We start by considering a population of N agents playing the Prisoner's Dilemma (PD) game [65]. At each step of the game, agents are allowed to play different strategies, that is, a node can cooperate with some neighbours and defect with others [66], also known as the mixed strategy system with different offers [67,68].
Connections between players follow the network structure prescribed by the adjacency matrix A = (a uv ), where a uv = 1 if players u and v are linked, and a uv = 0 otherwise.
The payoffs in the PD game are extracted from the following matrix: which means that a cooperator (C) altruistically loses an amount c > 0 when playing with a defector (D), who wins an amount b > c in such interaction. An interplay between two cooperators results in a mutual benefit of b − c, whereas playing between two defectors results in a null interchange. Note that a defector never looses. Without loss of generality, one can take c = 1 (b > 1) and re-scale the payoff matrix as: According to the universal scaling for the dilemma strength introduced in Ref. [59], D g = D r = 1/(b − 1), the parameter b measures the dilemma weakness. For interacting players u and v, one can define the strategy variable x uv as and the strategy vector as x uv = x uv , 1 − x uv . In each round of the game, the payoff g uv earned by each player u from its interaction with v is: The average payoff g u collected by player u after an interaction round with its k u neighbors is thus given by being N (u) the set of neighbors of u. Evolution of the game is designed by means of the following update rule: at each time step, all pairs of linked players engage in the PD game and their payoffs g u are updated according to Eq. (4). Each player u then compares its performance with its neighborhood. Let us refer to the neighbor of u with the highest payoff as w, and as x wu its strategy adopted against u. Then, u updates its strategy x uv imitating its best neighbor strategy x wu with probability which is a Fermi function [69], i.e. a sigmoid function of the free parameter α (playing the role of a temperature) and the payoff difference ∆g u = g w − g u (playing the role of an energy). Therefore, the update rule of the strategy x uv (t) of u at time t is given by that is, player u imitates, at time t + 1, the strategy that its best neighbor w played against it in the previous step with k u p of its neighbors, and keeps the same strategy is actually playing with each one of the rest. One can define the node outcoming cooperation rate as and the incoming cooperation rate as and the macroscopic cooperation frequency of the whole network as Note that defection is very profitable when the benefit b is close to 1, while when b → ∞ the profitability of defection reduces. As a consequence, in well-mixed populations, defection is the dominant trait driving cooperation to extinction. However, it is known that, in structured populations, cooperation can survive provided the appropriate conditions [7,70].
In this context, we now explore how the transition from defection to cooperation depends on the connectivity, as the dilemma weakness b increases. To do this, let us consider two linked players u and v with strategy vectors x uv = (x uv , 1 − x uv ) and x vu = (x vu , 1 − x vu ). Using Eq. (2), one can write the payoff of the first player from engaging the second as Therefore, the total payoff accumulated by u is or, equivalently, using definitions (7) and (8) Let us focus now on the probability of changing strategy, which becomes 50% when the payoff difference ∆g u = 0 in Eq. (5). Whenever at some point during the iterated game a player u reaches such a null payoff difference with respect to its best performing neighbor w, the transition to keep the actual strategies x uv or to change to x wu is critical in the sense that it occurs for a particular value of the parameter b. This implies that, evaluating payoffs of u and w using Eq. (12), a critical value of b * is evaluated as From this relationship, one can formulate a simple conjecture based on the connectivity pattern to locate the values of b at which cooperation is likely to transit to higher (or lower) frequencies: given a PD game on a graph G, all phase transitions are located at points of the form where 0 ≤ p, r ≤ k v , 0 ≤ q, s ≤ k u , are integers (such that the denominator is non-zero). Note that the set of b * values resulting from Eq. (15) tells us about the possible locations of a phase transition. Equation (15) entirely depends on the unique sequence of degrees present in the graph and, therefore, it alone allows predicting the transitions without actually playing the game. However, the multiplicity of each b * does depend on the particular degree distribution, and one can extract important information about the transitions from this degeneracy, as shown in the next section.
While in the game framework described so far, a player can perform different strategies with its neighbors, in the more classic scenario, players adopt a single role in each run. We will refers to this updating rule as node strategy, in opposition to the link strategy defined by Eq. (6). It is straightforward to obtain the equivalent equation to that of Eq. (15) in this latter case: where 0 ≤ r ≤ k u and 0 ≤ s ≤ k v are integers (such that denominator is non-zero) and Eq. (16) indicates that the possible locations for a phase transition in a node strategy situation is reduced with respect to the link strategy choice. Notice that the two previous conjectures for link ( mixed) and node strategies, Eqs. (15) and (16) respectively, depend on the particular form of the payoff matrix. Therefore, the relationship between game parameters and topology has to be recomputed if we change the dilemma, as the critical points ∆g u = 0 depend on them. For example, in order to illustrate this with a case extensively investigated in the literature, we chose the dilemma's matrix with no cost as in Refs. [7,71,72]. Note that parameter b in Eq. (17) now plays the role of a temptation to defect. In this case, the corresponding universal dilemma strengths [59] are D g = b and D r = 0, therefore, parameter b directly accounts for the strength of the dilemma.
Using a similar procedure as the one leading to Eq. (16) one can obtain an equivalent conjecture to locate the phase transitions for the dilemma P above, where n and m are integers such that 1 ≤ m ≤ n ≤ max(k), and max(k) is the maximum degree present in the network.

Results
We test our conjecture by running an extensive set of simulations of PD competition in a wide range of structural and dynamical conditions. Unless otherwise indicated, all the simulations were carried out for a population of N = 600 players using link strategy, with initially equal densities of cooperation and defection randomly distributed along with the links. Each simulation evolves over 10,000 time steps, and cooperation frequencies are averaged in the last 2,500 time steps. At each time step, all players update their strategies synchronously [1,73]. Average cooperation frequency is monitored as a function of b, and each point is an ensemble average over 100 network realisations.
As the conjecture implies that the number of possible transitions depends on the set of degrees present in the network, we initiate our exploration by showing the results of simulations on random regular (RR) graphs composed of groups of equal size N k whose nodes have all the same connectivity k. These graphs are constructed using the configuration model [74], which returns a random graph with no degree correlations consistent with a given degree distribution. Specifically, we explore in Fig. 1 the evolution of the cooperation frequency in RR graphs for the following degree distributions: a unique group of N k=5 = N nodes of degree k = 5 (upper panel);  15) for the chosen degree sequences. Note that the maximum degree is the same in the three cases but, as smaller degrees are included, the cardinality of b * increases adding new locations for a potential phase transition. We observe that all significant changes in the cooperation frequency always occur at one of the possible b * values predicted by Eq. (15). In order to inspect the role of the degree distribution in more detail, we carried out simulations with random Erdös-Renyi [75] and scale-free Barabási-Albert [76] networks, with N = 600 and average degree k = 4. In the upper panels of Fig. 2 we observe that ER networks support higher values of the cooperation frequency and that in both cases, cooperation increases in a stepwise manner, with more pronounced plateaux in the ER case. For such more complex networks, the set of possible b * values predicted by Eq.(15) is very numerous, and one sees that not in all of them does a significant change in the cooperation frequency appears. To explain this, we consider not only the sequence Vertical dotted lines in all panels correspond to the local maxima whose prominence is above the threshold marked by the red horizontal line (20% of the maximum value).
of unique degrees, but the degree distribution. By knowing how often each degree k appears in the network, we can calculate the multiplicity of each b * value, resulting in an excellent indicator of how probable is that a certain value b * determines a sharp variation in the cooperation frequency. In the bottom panels of Fig. 2 we plot the histograms of the average multiplicity of the b * values in Eq. (15) in the degree distributions of the ER (left) and SF (right) networks. The vertical dotted lines mark those local maxima whose prominence (height difference with respect to the local surrounding baseline) is above a given threshold (red horizontal line). Remarkably, the steps transitions observed in the cooperation frequency occur precisely at these more frequent b * , as shown by the same vertical dotted lines in the top panels.
To further investigate the role played by the second order structural details we study the impact of varying the correlation degree properties of the network while keeping its degree sequence. population is much larger than the other (N 3 = 5N 2 or N 2 = 5N 3 ). One clearly observes that the relevant jumps in the cooperation occur at exactly the same values of b, namely, b = 2, 3, 6, matching the predicted b * values highlighted by the vertical dotted lines. However, the steepness of the transitions is certainly not the same due to a difference in the b * multiplicity caused by different degree frequencies.
A more subtle but showing case is presented in Figure 3 (top right panel). Here the degree distribution is preserved in all cases and N 2 = N 3 = 300. Therefore, the theoretical b * multiplicity coming from the degree distribution is the same. However, in this example we control the level of degree-degree correlation measured by the associated Pearson coefficient r [77] (see legend in the right panel). Starting from uncorrelated networks (r = 0), we perform the rewiring procedure of Ref. [78] that preserves the degree distribution until the desired level of degree-degree correlation is achieved [79,80]. This way, one can produce graphs with very high positive correlation, in which nodes with the same degree tend to be linked among them (r ∼ 1), and networks whose nodes have k = 2 are more likely to be linked to nodes with k = 3 (r ∼ −0.7). The clear differences in the transitions (in particular for positively correlated networks) indicates that, since the calculation of b * involves all possible pairs of degrees, in correlated networks the real multiplicity could be shifted from the neutral one determined only  by the degree distribution. Indeed, the bottom panels in Fig. 3 show the histograms for the actual multiplicity of b * > k min considering the real pairings in the adjacency matrices, revealing that the height of the bars differs in each case, and they provide a closer predictor of a phase transition in the game. Notice that our conjecture states that if there is a sharp change in the cooperation frequency, the corresponding b is one of the b * values, but the reverse is not always true. This unidirectional correspondence can be verified, for instance, in Fig. 1, where not all the predicted b * values (indicated by the dotted vertical lines) lead to an abrupt change in the cooperation. As the conjecture involves a critical phenomenon, we also have to carefully inspect the role of the stochastic part of the dynamics, here represented by the temperature parameter α which controls the shape of the probability function for the strategy update. To this end, in Fig. 4 we show the evolution of cooperation in RR graphs with k = {3, 5} (N 3 = N 5 as in Fig. 1(b)) for several values of the temperature.
In addition, we also include the corresponding b * values as vertical dotted lines. One easily sees substantial changes in cooperation always coinciding with one of the vertical lines but, depending on the temperature, different b * are selected, and also differences in the height of the transition are observed. For instance, while lower temperatures support cooperation changes around b * = 7.5, for α = 0.1, cooperation does not evolve. Temperature dependence of the cooperation is shown on the right panel for values of b close to the major transitions observed in the left panel. The results suggest the existence of an optimal temperature that maximises cooperation, with a peak that shifts to lower temperatures as b increases. The overall scenario just described in the case of link strategy remains qualitatively unchanged for the simpler case of node strategy, considered as a particular case in Eq. (16). Figure 5 shows the cooperation curves for node strategy in RR graphs with k = {3, 5} and ER and SF graphs with the same average degree k = 4. In general, as compared with Fig. 1(b) and Figs. 2(a,b), one observes that cooperation frequencies reach higher values with node strategy games. Although Eq. (16) predicts a smaller set of b * than Eq.(15) for the same degree sequence, it is still able to capture the major transitions as shown by the vertical lines corresponding to the b * with higher prominence in their frequency distribution. For example, if we closely compare the transition to cooperation in the RR graphs using link and node strategies, Fig. 1(b) and Fig.5 (blue line), major changes take place at b = 3.0, 3.75 and 5, as predicted by both schemes.
For the sake of comparison with other classic studies [7,18], we also numerically check the conjecture obtained in Eq. (18) for the unpunished case P introduced at the end of Sec. 2. Furthermore, in this case the system evolution is carried out by implementing Monte Carlo simulations such that whenever the payoffs of two engaged u and v randomly selected players verify g v > g u , then player u imitates v's strategy with a probability p = D 2Γ for D < 2Γ and p = 1 otherwise, being D = (g v − g u )/(b max(k u , k v )) a normalized payoff difference. Notice that the slope Γ is playing a similar functional role than α in the sigmoidal function of Eq. (5) and that Γ = 0.5 corresponds to the case reported in Refs. [18,81]. Figure 6 shows how the cooperation evolves as a function of the game parameter b for the dilemma with no cost for both ER and SF networks and two values of the parameter Γ quantifying the uncertainty of strategy adoptions. We observe that cooperation evolves in a continuous way for Γ = 0.5 (transition probability is directly the normalised payoff difference as used in Ref. [7]) and, phase transitions from pure  Figure 6.
Extension of the conjecture to the prisoner's dilemma game with no cost and non synchronous strategy update of randomly selected agents. Average cooperation frequency ρ as a function of the temptation to defect (or dilemma strength) b for ER (left) and SF (right) graphs of size N = 500 and k = 4. Each curve is the average of 100 simulations of the same type of network implementing a Monte Carlo method following a transition probability given by p = D 2Γ for 0 ≤ D ≤ 2Γ and p = 1 for D > 2Γ. Equilibrium frequencies are obtained by averaging in the last 2,500 generations before the transient time of 10,000 generations. Vertical dotted lines in both panels correspond to those b * values from Eq. (18) whose pdf is above 10% and 5% for ER and SF networks respectively. cooperation to a mixed state (and from a mixed state to complete defection for ER topologies) are perfectly predicted by those b * values (marked as dotted vertical lines) in Eq. (18) whose probability density function is above a given threshold. One sees that reducing the value of Γ (i.e. increasing the likelihood of a player to change its strategy even for very low payoff differences) breaks the continuous evolution of the cooperation into a series of plateaux at different mixed levels of defection and cooperation.

Discussion
Cooperation is much more widespread in nature than the Darwinian premise of 'only the fittest survive' might suggest. Why and under which conditions cooperation thrives is, therefore, an evergreen subject across the social and natural sciences [82][83][84][85][86][87]. Evolutionary game theory is traditionally used to formalise the problem mathematically with social dilemmas [88][89][90], and networks are commonly used as the backbone for the simulation of these games. We have here shown that the structure of the former in terms of the unique sequence of degrees predict the outcome in the latter, particularly in terms of the game parameters at which significant shifts in the level of cooperation can be expected. In particular, we have proposed a conjecture for cooperation transitions in arbitrary networks, including phase transitions from absorbing to mixed strategy phases.
Results based on the evolutionary prisoner's dilemma game on random and scalefree networks of various sizes demonstrate the effectiveness of the conjecture. Indeed, since the conjecture is based on the different degrees present in the network, the network size does not modify the set of game parameters critical to produce shifts in the cooperation frequency. We have reported good agreements between the predictions and the results obtained with either a synchronous and asynchronous update of strategies, thus providing a viable alternative to computationally expensive and often timeconsuming simulations. We have shown that beyond the main qualitative information provided by the unique sequence of degrees, the degree distribution and the possible second order structural correlations provide further quantitative details about the transitions. Although we have explored the predictive power of the conjecture only for the prisioner's dilemma, it can be generalized to any social dilemma as the conjecture just operates on the payoff matrix and the critical game parameters are extracted only from the condition that the payoff difference between two agents is zero. Despite the success, we also note the requirements for the conjecture to work best. Namely, the presence of high stochasticity levels in the probability of strategy update may compromise the emergence of sharp transitions, which can explain the fact that these have not been previously observed.
In this light, the conjecture holds the promise of the optimisation of largescale simulations of evolutionary processes on complex networks, not just related to cooperation as a particular example of prosocial behaviour, but more generally for the broader class of moral behaviour where similar models are often employed [91]. By providing a fast and straightforward way to estimate the outcome of evolutionary processes on arbitrary networks and a wide class of games without the need for actual simulations, the conjecture should prove helpful in a wide range of research fields, further strengthening the role of physics and network science within them. I.S.N. and I.L. acknowledge support from the Ministerio de Economía, Industria y Competitividad of Spain under project FIS2017-84151-P and the Ministerio de Ciencia e Innovación under project PID2020-113737GB-I00. They also acknowledge the computational resources and assistance provided by CRESCO, the supercomputing center of ENEA in Portici, Italy. M.P. was supported by the Slovenian Research Agency (Grant Nos. P1-0403 and J1-2457).