## Introduction

Epidemic dynamics are driven by the interplay of two processes, occurring at fundamentally different scales. First, at the individual level, once infected, the contracted pathogen undergoes replication, and potential mutation, within a host’s body. Then, once reaching a sufficient load, transmission between hosts helps the pathogen penetrate the social network. These two processes, each characterized by its own intrinsic timescales and relevant parameters, are often modeled independently: the in-host dynamics is captured by a random process of mutation and selection1,2,3,4; the inter-host propagation is tracked using compartmental dynamics, such as the susceptible-infected-recovered (SIR) model5,6, or its more elaborate variants7. While the former is inherently stochastic, most analytical advances on the latter5 are achieved via deterministic methods, i.e. ordinary differential equations (ODE). This combination often prohibits systematic analytical advances8, as we lack a unified toolbox by which to treat both the inter-host ODEs and the stochastic intra-host dynamics.

Here, we show that we can reduce the intra-host evolutionary dynamics into an effective random walk, biased or unbiased, in the transmissibility fitness space. This allows us to construct a tractable analytical framework by which to predict the mutation/selection dynamics of a spreading pathogen. In this framework, mutations occur during the intra-host replication process1,2,3,4. Selection for transmissibility, on the other hand, is driven by the inter-host contagion dynamics, as fitter strains proliferate more rapidly and take over the available susceptible population. Together, these two processes may lead to a mutation-driven phase, whose boundaries and transition dynamics we pursue below. In this phase an initially non-pandemic pathogen breaks through to reach an evolved pandemic state.

We find that besides the classic epidemiological parameters, i.e. infection/recovery rates, two additional components factor in the observed mutation rate σ, quantifying the intra-host evolutionary timescales, and the fraction of infected individuals η(t), which determines the likelihood of a critical mutation to occur within the relevant time-frame. Therefore, as opposed to classic pandemic transitions, which depend solely on the epidemiological parameters9,10,11,12,13, here the time-dependent prevalence of the pathogen η(t) and its replication stability, both have direct impact on its anticipated spread.

### Evolving pathogens and network contagion

Consider a pathogen spreading across a social network Aij. Once contracted by a specific host i, it begins to replicate within i’s body, until, after an average of ρ replication cycles, one (or more) of its offspring is transferred via infection to one of i’s network neighbors j. Throughout this in-host replication, the pathogen may undergo mutations, and hence j may potentially be infected by a different strain than the one originally contracted by i. To track this process14,15,16,17,18,19,20 we consider the different strains μ and the probabilities Mμν that upon replication a strain μ will mutate into an offspring ν (Fig. 1a–c).

Each strain μ is characterized by two distinct fitness parameters. The intra-host fitness φμ(i) quantifies its replication rate within the host i. This parameter is affected by i’s internal biological environment, e.g., i’s immune response, body temperature and so on. Strains with higher φμ(i) multiply more efficiently within the host’s body, and hence gain higher prevalence with each replication cycle. Complementing φμ(i) is the inter-host fitness ψμ, which characterizes the pathogen’s capacity to spread between hosts. This parameter, independent of i, increases if μ has phenotypical traits that enhance its tranmissibility, for example, an extended survival time outside the host’s body21, or a longer pre-symptomatic stage22,23, both of which offer more opportunities for an i → j transmission.

Within the host, this results in a mutation and selection process that favors high φμ(i), as, indeed, fitter strains benefit from an increased intra-host growth rate. Consequently, after an average of ρ in-host replication cycles, i’s pathogen population reaches a unique multistrain $${{{{{{{{\mathcal{Z}}}}}}}}}_{i}$$20, capturing a pathogen composition with a fraction Zμ(i) of the strain μ (Fig. 1b). This composition is determined by the interplay between the pathogen’s intrinsic mutation rates (Mμν), and its intra-host fitness landscape (φμ(i)). The multistrain $${{{{{{{{\mathcal{Z}}}}}}}}}_{i}$$ is characterized by the fitness distribution

$${f}_{i}(\varphi,\psi )=\mathop{\sum}\limits_{\begin{array}{c}{\varphi }_{\mu }(i)=\varphi \\ {\psi }_{\mu }=\psi \end{array}}{Z}_{\mu }(i),$$
(1)

capturing the probability that a randomly selected pathogen from $${{{{{{{{\mathcal{Z}}}}}}}}}_{i}$$ has intra and inter-host fitness φ and ψ, respectively. Upon transmission i → j, a single pathogen is sampled from (1), initiating j’s intra-host evolutionary dynamics with (Fig. 1c)

$$\varphi (j,\,0) \, \sim \, {f}_{i}(\varphi )\quad \quad \psi (j,\,0) \sim {f}_{i}(\psi ).$$
(2)

Here φ(j, 0) and ψ(j, 0) denote the fitness parameters of j’s originally contracted pathogen, and fi(φ) = ∑ψ = fi(φ, ψ), fi(ψ) = ∑φ = fi(φ, ψ) represent the marginal probabilities of (1). Hence, Eq. (2) describes a randomly selected pathogen from $${{{{{{{{\mathcal{Z}}}}}}}}}_{i}$$ that is transmitted from i to j, with initial fitness values φ(j, 0) and ψ(j, 0). From this starting point j’s own intra-host dynamics commences, resulting in a potential secondary transmission, this time extracted from $${{{{{{{{\mathcal{Z}}}}}}}}}_{j}$$.

Taken together, as the process unfolds - from i’s exposure, through its intra-host replication, mutation, selection, and eventually, transmission to j - we observe potential shifts in both the intra and the inter-host fitness of the pathogen population, such that

$$\varphi (j,\, 0)=\varphi (i,\, 0)+\Delta \varphi$$
(3)
$$\psi (j,\,0)=\psi (i,\, 0)+\Delta \psi .$$
(4)

The evolutionary steps Δφ, Δψ are governed by the intra-host mutation/selection processes, yet they impact the inter-host spreading dynamics through ψμ. On the other had, as fitter strains (higher ψμ) spread more efficiently, the inter-host contagion governs the ψ-selection process. Below we analyze the resulting interplay between these intra and inter-host patterns of pathogen spread (Fig. 1d).

## Results

To observe the spreading patterns under pathogen evolution we consider the susceptible-infected-recovered5 (SIR) dynamics on a random network Aij. In the classic SIR formulation the spreading dynamics are governed by three parameters: the recovery rate α, the infection rate β, and Aij’s average degree $$\overline{k}$$. Together, they provide $${R}_{0}=\overline{k}\beta /\alpha$$, the reproduction number, which determines the state of the system24,25,26,27,28 - pandemic (R0 ≥ 1) or infection-free (R0 < 1).

In the presence of mutations, however, these parameter may change over the course of the spread, with each strain μ characterized by its own specific αμ, βμ, and hence its unique reproduction number

$${R}_{\mu }={\psi }_{\mu }{R}_{0}.$$
(5)

Here ψμ, the inter-host fitness of the μ-strain, is defined as

$${\psi }_{\mu }=\frac{{\beta }_{\mu }/{\beta }_{0}}{{\alpha }_{\mu }/{\alpha }_{0}}$$
(6)

where α0, β0 are the recovery/infection rates of the wild-type. Therefore, the wild-type μ = 0 has ψ0 = 1, and consequently a reproduction number of precisely R0. As the spread progresses, mutations may push ψμ below or above this value, by introducing strains with varying αμ, βμ. The higher is ψμ the greater is Rμ, and hence the fitter is the strain for inter-host transmission (Fig. 1g).

We can now model the SIR dynamics by tracking the infection, recovery and mutation processes. For the process of infection we write (Fig. 1a–c)

$${I}_{i}+{S}_{j}\mathop{\longrightarrow }\limits^{\beta (\,\, j,0)}{I}_{i}+{I}_{j}$$
(7)
$$\psi (j,\, 0)=\max \left(\psi (i,\, 0)+\Delta \psi,\, 0\right),$$
(8)

in which a susceptible (S) individual j contracts the pathogen from their infected (I) neighbor i, leading to both i and j becoming infected. The rate of the process in (7), β(j, 0), represents the infection rate of the transmitted strain, i.e. the selected pathogen from $${{{{{{{{\mathcal{Z}}}}}}}}}_{i}$$, which will now begin to replicate and potentially mutate within j. The spreading fitness of j’s contracted strain, ψ(j, 0) in (8), is extracted from Eq. (4), with the $$\max$$ function conditioning that ψ(j, 0) ≥ 0, i.e. avoiding negative fitness. Next we consider the process of recovery

$${I}_{j}\mathop{\to }\limits^{{\alpha }_{j}}{R}_{j},$$
(9)

where an infected host transitions to the recovered (R) state. Here αj represents the effective recovery rate of j’s multistrain $${{{{{{{{\mathcal{Z}}}}}}}}}_{j}$$, whose composition results from j’s intra-host mutation/selection dynamics. The initial outbreak occurs at a randomly selected node o, with ψ(o, 0) = 1, the wild-type spreading fitness (Fig. 1d), from which point fitness is gained/lost via (8) upon each instance of infection.

### Evolutionary dynamics

To complete the processes (79) we now evaluate the magnitude of the evolutionary jumps Δψ at each infection cycle. We therefore, in Fig. 1e, f, model a single instance of intra-host evolutionary dynamics, from initial exposure to transmission. Assigning μ = 0 to represent the wild-type, we index all pathogen strains based on genetic similarity, such that μ = 1 is closest to the wild-type, and as μ is increased we reach more highly mutated variants. Prohibiting direct mutation between highly distant strains, the transition matrix Mμν → 0 in case μ and ν are far apart. Here we only allow transitions between directly neighboring strains, taking Mμν = p in case ν = μ ± 1, Mμν = 1 − 2p if μ = ν and Mμν = 0 otherwise (Fig. 1e). The parameter p, therefore, characterizes the stability of the pathogen, quantifying the expected frequency of mutations, where p → 0 indicates the limit of no evolution at all.

The fitness parameters for each strain are extracted from a pair of normal distribution $${\varphi }_{\mu }(i) \sim {{{{{{{\mathcal{N}}}}}}}}(1,{\sigma }_{\varphi }^{2})$$ and $${\psi }_{\mu } \sim {{{{{{{\mathcal{N}}}}}}}}(1,{\sigma }_{\psi }^{2})$$, such that every strain is independently assigned an intra and inter-host fitness. This independence captures the fact that the intra-host environment is fundamentally distinct from that of the inter-host transmission, and hence the phenotypic traits enhancing φμ(i) and ψμ are, by and large, uncorrelated. In Supplementary Section 4 we also examine the case where the two are related.

To observe the evolutionary dynamics, at t = 0 we infect i with a specific strain (φ(i, 0), ψ(i, 0), Fig. 1f, grey dot). As the pathogen multiplies within i, fitter strains are selected and the composition of the pathogen population shifts in favor of strains with greater φμ(i). In this process of mutation/replication, the composition of ψμ changes as well. After ρ reproduction cycles, we extract the two fitness distributions of Eq. (1) as obtained from the resulting multistrain $${{{{{{{{\mathcal{Z}}}}}}}}}_{i}$$: As expected, we find that fi(φ), the intra-host fitness, follows a shifted normal distribution, with an average fitness greater than the initial φ(i, 0) (Fig. 1f, blue). This is a direct consequence of the intra-host selection process, which favors the rapidly replicating variants (large φμ(i)).

The inter-host fitness, on the other hand, lacking selection within the host, drifts up and down at random (grey path), resulting in $${f}_{i}(\psi ) \sim {{{{{{{\mathcal{N}}}}}}}}(\psi (i,0),{\sigma }^{2})$$, a zero-mean normal distribution with variance σ2. Upon transmission to j, ψ(j, 0) in (8) is extracted precisely from this resulting normal distribution (Fig. 1f, green). Mathematically, this process is mapped to an effective random walk beginning at the initial starting point ψ(i, 0), and taking random steps of size ~ σ.

This captures our first key observation, that the detailed mutation/selection process taking place within the host can be reduced to an effective random walk in ψ-space. We can now use Eq. (4) to write Δψ = ψ(j, 0) − ψ(i, 0), which using the above observation, that $$\psi (j,\, 0) \sim {{{{{{{\mathcal{N}}}}}}}}(\psi (i,\, 0),\,{\sigma }^{2})$$, provides us with

$$\Delta \psi \sim {{{{{{{\mathcal{N}}}}}}}}(0,\,{\sigma }^{2})$$
(10)

a zero-mean normal distribution, whose variance depends on the intra-host evolutionary dynamics. Hence, the intra-host mutation/selection process condenses into the single parameter σ in (10) that helps characterize the observed inter-host evolutionary dynamics. In the limit where σ = 0, we have Δψ = 0 in (8) at all times, mutations are suppressed, and Eqs. (79) converge to the classic SIR model, with a stable R0. In contrast, as σ is increased, significant ψ-mutations become more frequent and the inter-host fitness rapidly evolves. We therefore, below, vary σ to control the mutation rate of the spreading pathogens.

Taken together, our modeling framework accounts for the dynamics of infection and recovery (SIR) under the effect of pathogen mutation. As the spread progresses, pathogens evolve via Eq. (8), blindly altering their inter-host fitness at random, as, indeed, the intra-host selection has no bearing on ψμ. The inter-host dynamics, however, will favor positive ψ-mutations, in which Δψ > 0. This is because such mutations lead to greater Rμ in (5), and hence to higher transmissibility. This, in turn, translates to higher prevalence, allowing fitter strains to eventually dominate the population (Fig. 1g).

### Critical mutation

Consider an outbreak of a wild-type with R0 < 1, i.e. below the epidemic threshold. This can be either due to the pathogen’s initial sub-pandemic parameters, or a result of mitigation, e.g., social distancing to reduce β0. In the classic SIR formulation, such pathogen will fail to penetrate the network. However, in the presence of mutations (σ > 0 in (10)) the pathogen may potentially undergo selection, reach Rμ > 1, and from that time onward begin to proliferate. This represents a critical mutation, which, using (5), translates to

$${\psi }_{c}=\frac{1}{{R}_{0}},$$
(11)

the critical fitness that, once crossed, may lead an initially non-pandemic pathogen to become pandemic. The smaller is R0 the higher is ψc, as, indeed, weakly transmissible pathogens require a longer evolutionary path to turn pandemic. Next, we analyze the spreading patterns of our evolving pathogens, seeking the conditions for the appearance of such a critical mutation.

### Phase-diagram of evolving pathogens

To examine the behavior of (710) we constructed an Erdős-Rényi (ER) network Aij with N = 5000 nodes and $$\overline{k}=15$$, providing a testing ground upon which we incorporate a series of epidemic scenarios (Fig. 2). Each scenario is characterized by a different selection of our model’s three epidemiological parameters: α0, β0, which determine the wild-type’s reproduction R0, and σ, which controls the effective inter-host mutation rate. We then follow the spread by measuring the prevalence η(t), which monitors the fraction of infected individuals vs. time (0 ≤ η(t) ≤ 1). We also track the pathogen’s evolution via the population averaged inter-host fitness $$\overline{\psi }(t)=(1/N)\mathop{\sum }\nolimits_{i=1}^{N}\psi (i,0)$$, i.e. the average fitness over all transmitted pathogens. We observe several potential spreading patterns:

#### Pandemic (Fig. 2a, b red)

In our first scenario we set α0 = 0.1, β0 = 8 × 10−3 and σ = 2 × 10−2. This captures a pandemic wild-type, which, using $$\overline{k}=15$$, has R0 = 1.2 > 1, namely it can spread even without mutation. Indeed η(t) rapidly climbs to gain macroscopic coverage, congruent with the prediction of the classic SIR model, only this time instead of a single infection wave, we observe a secondary peak, due to the introduction of fitter variants, that help increase $$\overline{\psi }(t)$$. Such successive waves of infection, driven by pathogen evolution, have, in fact, being observed in the spread of SARS-CoV-2 29,30,31,32,33,34.

#### Mutation-driven (Fig. 2c, d green)

Next we reduce the wild-type infection rate to β0 = 1.67 × 10−3, an initial reproduction of R0 = 0.25 < 1. This describes a pathogen whose transmissibility is significantly below the epidemic threshold, and therefore, following the initial outbreak we observe a decline in η(t), which by t ~ 30 almost approaches zero, as the disease seems to be tapering off (inset). In this scenario, however, we set a faster mutation rate σ = 2. As a result, despite the initial remission, at around t ~ 5, the pathogen undergoes a critical mutation as $$\overline{\psi }(t)$$ crosses the critical ψc = 1/R0 = 4 (grey dashed line) and transitions into the pandemic regime. Consequently, η(t) changes course, the disease reemerges and the mutated pathogens successfully spreads.

#### Infection-free (Fig. 2e, f blue)

We now remain in the sub-pandemic range, with R0 = 0.25, but with a much slower mutation rate, set again to σ = 2 × 10−2. As above, η(t) declines, however the pathogen evolution is now too slow, and cannot reach critical fitness on time. Therefore, the disease fails to penetrate the network, lacking the opportunity for the emergence of a critical mutation.

Hence, the dynamics of the spread are driven by three parameters: the initial epidemiological characteristics of the wild-type, α0 and β0, which determine R0, and the mutation rate σ, which governs the timescale for the appearance of the critical ψc. Therefore, below, to determine the conditions for a mutation-driven contagion, we investigate the balance between the decay in η(t) vs. the gradual increase in $$\overline{\psi }(t)$$.

### The mutation-driven phase

To understand the dynamics of the evolving pathogen model, we show in Supplementary Section 1.1 that at the initial stages of the spread, the prevalence η(t) follows

$$\eta (t)=\eta (0){e}^{\xi (t)}.$$
(12)

The time-dependent exponential rate ξ(t) is determined by the epidemiological/mutation rates via

$$\xi (t)=-{\alpha }_{0}(1-{R}_{0})t+\frac{1}{2}{\sigma }^{2}{\alpha }_{0}^{2}{R}_{0}^{2}{t}^{3},$$
(13)

whose two terms characterize the pre-mutated vs. post-mutated spread of the pathogen. The first term, linear in t, represents the initial stages of the spread, which are determined by the wild-type parameters, α0, R0. For R0 < 1 this describes an exponential decay, a là the SIR dynamics in the sub-pandemic regime. At later times, however, as t3 becomes large, the second term begins to dominate, and the exponential decay is replaced by a rapid proliferation, now driven by the mutation rate σ. The transition between these two behaviors–decay vs. proliferation–occurs at $${\tau }_{c}=\sqrt{2(1-{R}_{0})/3{\alpha }_{0}{\sigma }^{2}{R}_{0}^{2}}$$, which provides the anticipated timescale for the appearance of the critical mutation ψc in (11).

This analysis portrays the mutation-driven contagion as a balance between two competing timescales: on the one hand the exponential decay of the sub-pandemic pathogen, and on the other hand the evolutionary timescale τc for the appearance of the critical mutation. For the evolution to win this race the pathogen must not vanish before t = τc. This imposes the condition that (Fig. 3a–c)

$$\eta ({\tau }_{c}) \, > \,\frac{1}{N},$$
(14)

ensuring that at τc there are still one or more individuals hosting the pathogen. Indeed, η(τc) ≤ 1/N indicates that on average, at t = τc less than a single individual is left in the infected pool. Under this condition, the critical mutation is too late, the spread has already tapered off, and the exponential growth driven by the positive term in (13) is averted.

Taking η(τc) from (12), we can now use (14) to express the boundary of the mutation-driven phase, predicting the critical mutation rate as (Supplementary Section 1.1)

$${\sigma }_{c}\propto \left(\frac{\sqrt{{\alpha }_{0}{(1-{R}_{0})}^{3}}}{2{R}_{0}}\right)\frac{1}{\ln ({{{{{{{\mathcal{{I}}}}}}}_{0}}})},$$
(15)

where $${{{{{{{\mathcal{{I}}}}}}}_{0}}}=N\eta (t=0)$$ is the number of individuals infected at t = 0. Equation 15 describes the minimal mutation rate required for the wild-type to evolve into a potentially pandemic strain. For R0 = 1 it predicts σc = 0, as such pathogen can indeed spread even without mutation. However, as R0 is decreased, the pathogen prevalence rapidly declines, and hence it must evolve at an accelerated rate to reach critical fitness on time. This is expressed in (15) by an increased σc, which approaches infinity as R0 → 0.

Note that the condition in (14), that at t = τc there is a single infected individual, is not necessarily stringent, and hence, should be taken more loosely as η(τc) is of the order of 1/N. Indeed, even if the pathogen reaches its critical mutation when there are two or three infected individuals, due to the stochasticity of the spreading dynamics under such small numbers, pathogen extinction continues to be a probable scenario. Therefore σc in (15) is only predicted upto a multiplicative constant of order unity, as signified by the  sign, i.e. σcscales as, not equals to the expression on the r.h.s. We also note that, for simplicity the derivation leading to Eq. (15) in Supplementary Section 1.1 is conducted under β-mutations, namely setting αμ = α0 and allowing only the infection rate to evolve. In Supplementary Section 1.3 we further generalize the analysis, using a combination of analytical and numerical tools, to cover also α-mutations.

To test prediction (15) we simulate in Fig. 2i an array of 1050 realizations of Eqs. (710), representing different epidemiological scenarios. We varied R0 from 0 to 1.5, i.e. from non-transmissible to pandemic, and scanned a spectrum of mutation rates from σ = 10−3 to σ = 10, spanning four orders of magnitude. Simulating each scenario 50 times we observe the probability P for the disease to gain coverage. This is done by tracking the total fraction of recovered individuals $${r}_{\infty }=\int\nolimits_{0}^{\infty }\eta (t)\,{{{{{{{\rm{d}}}}}}}}t$$ and counting the realizations in which r → 0 vs. those where r > 0 (Supplementary Section 5.1). As predicted, we find that the pandemic state, classically observed only at R0 ≥ 1, now extends to lower R0 in the presence of sufficiently rapid mutations. This gives rise to the mutation-driven phase (green), in which an initially decaying contagion suddenly turns pandemic. The boundaries of this phase (grey zone) are, indeed, well-approximated by our theoretically predicted (15), as depicted by the black solid line separating the infection-free from the mutation-driven phases.

### Explosive transition

Unlike the classic pandemic threshold, the mutation-driven phase shift is of explosive nature35,36, capturing a first-order phase-transition (Fig. 2j). This is because once a critical mutation occurs, the pathogen gains prevalence, providing opportunities for additional mutations that push $$\overline{\psi }(t)$$ ever higher. This creates a positive feedback, which, in turn, leads to a discontinuous jump in r: below the boundary of (15) the total fraction of infected individuals is r → 0, yet once we cross this boundary, it abruptly rises to r 1.

Such discontinuous transition illustrates the risks of soft mitigation. Indeed, from social distancing to vaccination, our natural response in the face of a pandemic pathogen is to drive R0 below the critical threshold, be it R0 ≤ 1 absent mutations (σ = 0), or lower in case of an evolving pathogen (σ > 0), as predicted in (15). To minimize the ensuing socioeconomic disruption, it is tempting to tune our response, as much as we can, to push R0 just below this threshold, reaching a state in which the system fluctuates around criticality37,38,39. Under a continuous transition, as classically observed for most epidemiological models, such minimal response may suffice. However, here, the abrupt first-order transition portrays a system that is highly sensitive around the phase boundary. Hence, minor excursions above the threshold can potentially lead to a sudden jump in prevalence, as they unleash a potential sequence of breakthrough mutations. We, therefore, must remain at a safe distance from criticality when responding to an evolving pathogen.

### Time sensitivity

Equation (15) shows that σc depends not only on the epidemiological characteristics of the pathogen (α0, R0), but also on the initial condition, here captured by the number of infected individuals $${{{{{{{\mathcal{{I}}}}}}}_{0}}}=\eta (t=0)N$$. If $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$ is large the critical rate σc becomes lower, in effect expanding the bounds of the mutation-driven phase. To understand this consider the evolutionary paths followed by all pathogens as they spread. These paths represent random trajectories in fitness space, starting from ψ0 = 1, the wild-type, and with a small probability crossing the critical fitness ψc. The more such attempts are made, the higher the chances that at least one of these paths will be successful. Therefore, a higher initial prevalence $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$ of the pathogen increases the probability P for the appearance of a critical mutation, enabling a mutation-driven phase even under a relatively small σ. In simple words, even rare mutations may occur if the initial pathogen pool ($${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$) is large enough40,41,42,43. Indeed, in Fig. 3d we find that the phase boundary shifts towards lower σc as the initial prevalence is increased (grey shaded lines). Hence, the greater is $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$, the broader are the conditions that enable mutation-driven contagion.

This dependence on $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$ indicates that the risk of a critical mutation increases in case the pathogen is already widespread. For example, consider a pandemic pathogen (R0 > 1) that begins to spread, exhibiting an exponentially increasing η(t). At time t = tR we instigate our response, aiming to suppress R0, e.g., via social distancing. In case of a late response (tR large), our mitigation encounters an already prevalent pathogen, with a large $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$, and hence an increased probability to undergo a critical mutation. Therefore, early response is key, aiming to eliminate the pathogen while its population is still small, when it is still outside the bounds of the mutation-driven phase.

We emphasize, that also without mutations, the advantages of responding early are well known44,45,46,47, primarily to help us avoid a prolonged pandemic state. The crucial difference is, that in these classic formulations pushing R0 below criticality guarantees the desired transition to the infection-free phase. The only question being the temporal trajectory of this transition–prolonged or rapid. Here, however, responding late, may catch the pathogen when it has already entered a different phase, i.e. mutation-driven, and hence it is not just a matter of how long it will take for the pandemic to decay, but rather if it will decay at all. Indeed, our dynamics lead to a unique phenomenon where the phase boundary itself, as expressed in (15), shifts with time, due to the accumulation of infected individuals, which increases $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$. Therefore, the longer we wait the more likely we are to experience, at some point later in the pathogen’s spreading trajectory, a game-changing mutation. In simple terms - the risk is not just a prolonged decay, but an actual reemergence of the pandemic state.

To observe this, in Fig. 4a we simulated the spread of a pandemic pathogen with R0 = 1.2 (red). To counter the spread, we first employ our mitigation at tR = 20 days, reducing R0 by a factor of two to RR = 0.6 (blue). The result is a sharp turning point in the spread, as the pathogen begins to exponentially decay, eventually eradicated within several weeks. We then examine an alternative scenario of late mitigation, this time setting tR = 75 days (green). At first, the mitigation seems to be working, as η(t) begins to rapidly decline. However, as we have now caught the pathogen at a higher prevalence, our mitigation is insufficient, as RR = 0.6 is now within the bounds of the mutation-driven phase. Indeed, the phase boundary has shifted with t, and what was a sufficient response at tR = 20 is no longer enough now that tR = 75. Therefore, after an initial remission, we observe a second wave of infection, due to breakthrough mutations.

Our late response, we emphasize, did not simply lead to a prolonged pandemic state, but rather to a reemergence of the pandemic. This second wave, we emphasize, occurs at ttR, however its seeds were already planted at the time of our initial delayed response. This delay caused the pathogen to cross the boundary into the mutation-driven phase, sealing our fate to a potential future second wave. In Fig. 4b we examine this more systematically, plotting the probability P to reach critical mutation vs. our response time tR, as obtained for a range of mutation rates σ. As predicted, we find that the risk for mutation driven contagion consistently increases as we delay our response.

### Hysteresis

This dependence of the phase boundary on $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$ indicates that the transition point changes if we approach it from the infection-free state (small $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$) or from the pandemic state (large $${{{{{{{\mathcal{{I}}}}}}}_{0}}}$$). This captures a hysteresis phenomenon, in which the critical transition depends on the direction towards which we push R0: starting from low R0 we observe the transition at Rc,1; however, reversing the path, pushing R0 from high to low we approach the transition from a high prevalence state, and therefore only reach the infection-free phase at Rc,2 < Rc,1. This can be observed in case the pathogen spreads via the susceptible-infected-susceptible (SIS) dynamics, where as opposed to SIR, the pandemic fixed-point has a constant fraction of infected individuals, i.e. η(t → ) > 0 (see Supplementary Section 2).

### The volatile phase

The analysis above indicates that rapid intra-host mutations, i.e. large σ, support a pathogen’s ability to spread. This is thanks to the combination of fast mutation and inter-host selection, that leads to critical fitness within a sufficiently short timescale. There is, however, an upper limit to σ, beyond which mutation-driven spread cannot be sustained. Indeed, when σ is too large the pathogen fitness $$\overline{\psi }(t)$$ becomes unstable. As a result, while the pathogen rapidly reaches critical fitness, the random nature of its frequent mutations, renders it unable to uphold this fitness–resulting in an irregular $$\overline{\psi }(t)$$, that fluctuates above and below the critical ψc (Fig. 2g, h). The result is a second transition from mutation-driven contagion (Fig. 2i, green) to the volatile phase (blue), in which, once again, the pathogen fails to spread. The difference is that while in the infection-free phase (σ small) contagion is avoided because mutations are too slow, here the pathogen extinction occurs because they were too rapid.

To gain deeper insight into the volatile phase, consider the natural selection process, here driven by the inter-host reproduction benefit of the fitter strains. This process is not instantaneous, and requires several reproduction instances, i.e. generations, to gain a sufficient spreading advantage. With σ too high, natural selection is confounded, the pathogen shows no consistent gains in fitness and, as Fig. 2g indicates, η(t) decays exponentially to zero. In Supplementary Section 1.2 we use a timescale analysis, similar to the one leading to Eq. (15), to show that the volatile phase occurs when σ exceeds

$${\sigma }_{c}\propto \sqrt{\frac{{\alpha }_{0}}{3}}\frac{{({\psi }_{\max }{R}_{0}-1)}^{\frac{3}{2}}}{{R}_{0}}.$$
(16)

Here $${\psi }_{\max }=\mathop{\max }\limits_{\mu }\{{\psi }_{\mu }\}$$ represents the maximal inter-host fitness over all potential strains of the pathogen. This prediction is, indeed, confirmed by our simulated phase diagram in Fig. 2i (black solid line).

While related, the volatile phase is distinct from the classic error-catastrophe, that renders a pathogen non-viable due to high error rates during replication48. Indeed, the error-catastrophe captures a state in which mutations are frequent enough to disrupt the inter-generational preservation of genetic information. Such conditions prohibit the pathogen from producing enough viable offspring, resulting in failure to sustain its population. Here, however, the spreading bottleneck is different: the pathogen is able to successfully replicate, but it fails to lock-in its fitness gains. Indeed, by the time natural selection, here governed by the inter-host spreading dynamics, affords the fitter strains a sufficient spreading advantage, mutations have already driven the pathogen, or better yet–its offspring, into a different area in ψ-space. Hence, the pathogen extinction is not due to replication failure, indeed–it replicates viably within its host, but rather to the short memory of advantageous mutations, vs. the relatively longer natural selection timescales49,50,51,52,53. Consequently, absent selection, mutations drive the pathogen erratically across fitness-space, a volatile dynamics, in which the critical mutation, despite being reached, is short-lived, overrun by new mutations, before the fitter strain can gain sufficient ground.

Our phase-diagram illustrates the different forces governing the spread of pathogens in the presence of mutations. While spread is prohibited classically for R0 < 1, here we observe a mutation-driven phase, in which the disease can successfully permeate despite having an initially low reproduction rate. The conditions for this phase require a balance between three separate timescales: (i) The time for the initial outbreak η(0) to reach near-zero prevalence τ1; (ii) The time for the pathogen to evolve beyond critical fitness τc; (iii) The time for the natural selection to lock-in the fitter mutations τ2. Pathogens with small R0, we find, can still spread provided that

$${\tau }_{1} \, > \,{\tau }_{c} \, > \,{\tau }_{2},$$
(17)

illustrating the window of mutation-driven pandemic spread. The l.h.s. of (17) ensures that the pathogen can reach critical fitness before reaching near-zero prevalence. This gives rise to the first transition of Eq. (15), between the infection-free and the mutation-driven phases. The r.h.s. of (17) is responsible for the second transition, from mutation-driven to volatile. It ensures that fitter pathogens do not undergo additional mutation before they proliferate via natural selection. Therefore, we observe a Goldilocks zone, in which the mutation rate σ is just right: on the one hand, enabling unfit pathogens to cross the Rubicon towards pandemicity, but on the other hand, avoiding aimless capricious mutations.

## Reinfection

Our discussion up to this point focused on mutations that randomly increase R0 by impacting α0 or β0, namely the epidemiological parameters. We now complete our analysis considering a different breakthrough mechanism of reinfection via immunity evasion. Here, a mutant variant, distinct enough from the wild-type, can reinfect an already recovered individual. This mechanism is, of course, well-studied54,55,56,57,58,59, however, our analysis framework can help us advance by observing its outcomes under a range of variants μ = 0, 1, 2,….

To examine this in a realistic setting we consider the spread of SARS-CoV-2. We therefore collected data on the COVID-19 infection cycle60,61,62,63,64,65,66,67,68,69,70 (Fig. 5a): upon infection, individuals enter a pre-symptomatic state, which lasts, on average 5 days. During this period, typically within 2–4 days they begin to shed the virus and infect their network contacts (PS, purple). This continues until the onset of mild (IM), severe (IS) or critical (IC) symptoms, at which point they mostly enter isolation and cease to spread the virus. (Of course, individuals may not comply, and hence in Supplementary Section 5.3 we examine the case where ~30% of the mildly symptomatic (IM) continue to interact despite their symptoms.) In addition, a fraction (~30%) of infected individuals never go on to develop noticeable symptoms (AS, top arrow), and hence they continue to spread the virus until their full recovery (R), typically within ~7 days.

To evaluate the (wild-type) infection rate β0 we used empirical data on the observed spread in 12 different countries29 (Supplementary Section 5.3). Focusing on the early stages of the contagion, prior to the instigation of lock-downs or other mitigation schemes, we find that β0 = 5 × 10−2 days−1 best fits the observed spreading dynamics. This corresponds to a reproduction rate of R0 ≈ 2.6, congruent with existing60,71,72 valuations of R0 under COVID-19.

For the evolutionary dynamics, we consider, again, intra-host mutations, governed by Mμν and selected via each host’s idiosyncratic fitness landscape φμ(i). The result, as discussed above, is an effective random walk, starting from the wild-type μ = 0, and accumulating increasing levels of genetic variation along the μ-axis. Each variant μ is assigned a reinfection fitnessϕμ, capturing its probability to penetrate the wild-type induced immunity. The greater is μ, the higher the genetic distance from the wild-type, and hence also the greater is ϕμ16,73,74,75. In our simulations we use $${\phi }_{\mu }={z}^{h}/({z}_{r}^{h}+{z}^{h})$$, where $$z=\mu /{\mu }_{\max }$$ is the normalized distance (0 ≤ z ≤ 1) from the wild-type, and zr is a parameter governing the typical distance required for μ to reinfect a wild-type recovered individual. For zzr we have ϕμ → 0, i.e. no reinfection, and if zzr we have ϕμ → 1, a variant fully resistant to the wild-type antibodies.

Similarly to our previous analysis, also here, the emergence of a breakthrough mutation is driven by the timescales of the inter/intra-host dynamics. If mutations are slow compared to the spreading dynamics (σ small) the outbreak decays before the critical mutation z > zr is reached, and we observe a single wave of infection (Fig. 5b, c). If, however, mutations are rapid (σ large), z grows fast enough to reach zr on time, and we risk a second wave with relatively high probability (Fig. 5c, d). This gives rise to the R0, σ risk-map, capturing the probability P of a second wave, given the wild-type epidemiological parameters (encapsulated within R0) and the pathogen replication stability (encapsulated within σ); Fig. 5f.

Our sigmoidal ϕμ allows us to account for the gradual accumulation of reinfection fitness, as governed by the saturation parameter h. Under large h, ϕμ jumps abruptly from 0 to 1 at z = zr, mapping to existing frameworks in which one considers a discrete set of (typically two) variants76,77,78,79,80. Tuning h, however, or considering more complex ϕμ, we can take advantage of our analytical framework that helps capture the evolutionary dynamics across a continuum of variants.

### Prospects and limitations

Throughout our presentation we we have made several simplifying assumptions, selected primarily for methodical reasons, which can be relaxed to introduce more realism, where relevant. For example, our Gaussian fitness distributions $${{{{{{{\mathcal{N}}}}}}}}(1,\,{\sigma }_{\varphi }^{2})$$ and $${{{{{{{\mathcal{N}}}}}}}}(1,\,{\sigma }_{\psi }^{2})$$ (Fig. 1e) may be replaced with more complex fitness landscapes. This will impact the patterns of the observed inter-host fitness jumps, and hence replace the simplistic zero-mean random walk of Eq. (10) by a more specified exploration of the inter-host fitness space. Another potential generalization, relevant in real-world applications, considers the fact that individuals may experience different disease cycles. For instance, in COVID-19, most individuals exhibit a limited infection time-window, while few sustain the virus for extended periods. These latter individuals, hosting the virus for many replication cycles, are the main contributors to its genetic variability81,82,83,84,85,86. This heterogeneity across hosts translates to a distributed σ, i.e. σi, a potential complication that was not considered in our implementation. Finally, in our last example we focus solely on reinfection vs. the wild-type μ = 0, and hence we observed–at most–two infection waves. More generally, one may consider more complex fitness functions ϕμν, designed to capture the probability of ν to reinfect an individual recovered from μ. This, however, may require complex book-keeping of infections, which, if carried out in all detail, i.e. per each pair of μ, ν, may limit the feasibility of our framework.

## Discussion

The phase diagram of epidemic spreading is a crucial tool for forecasting and mitigating pandemic risks. First, it identifies the relevant control parameters, such as α0, β0 and $$\overline{k}$$, whose values determine R0. Then it predicts the phase boundaries that help us assess the state of the system–infection-free or pandemic. Finally, it provides guidelines for our response, from social distancing to reduce $$\overline{k}$$, through therapeutic treatment to increase α0 or mask wearing to suppress β0.

Here we have shown that mutations can fundamentally change this phase diagram. Instead of just one dimension, the relevant phase space is now driven by two control parameters: R0, the wild-type reproduction number, which encapsulates the inter-host epidemiological characteristics of the pathogen, and σ the observed mutation rate, which is determined by the intra-host evolutionary dynamics. This (σ, R0) phase space gives rise to a mutation-driven phase, whose boundaries we predict here, observing several characteristics that stand in contrast to most known pandemic transitions. Most notably, the abrupt first-order transition, that depicts extreme sensitivity in the vicinity of the phase boundary, and the dependence of the transition point on the current prevalence η(t), which predicts that similar responsive actions may lead to different outcomes at different stages of the spread44. As we are now experiencing, first hand, how novel mutations are driving the proliferation of SARS-CoV-2, we hope that these qualitative predictions will guide our response.

While the classic control parameter R0 is well-understood, our analysis introduces an additional relevant parameter σ, designed to capture the observed inter-host mutation rate. This parameter emerges from the microscopic model of the intra-host replication/mutation dynamics. It is, therefore driven by the intra-host fitness landscape φμ(i), ψμ, its patterns of mutation transitions Mμν, p and its replication cycle ρ. In Supplementary Section 5.2 we analyze the impact of each of these microscopic model characteristics on the observed mutation rate σ.

Our analysis assumed that the intra and inter host fitness parameters, φμ(i) and ψμ, are independent of each other. Indeed, the two environments, that of the in-host replication vs. that governing host-to-host transmission, are, by and large, unrelated, and hence being fit for one has no bearing on the pathogen’s fitness for the other75,87. One exception, is under drug-based mitigation. Drugs are designed to disrupt the intra-host replication, and by that increase the recovery rate α0 (reducing R0), thus suppressing the inter-host transmission. This naturally creates a positive correlation between φμ(i) and ψμ, since variants with higher drug resistance will not only be more fit for intra-host replication, but also have a lower α0, and hence higher transmissibility. The observed inter-host evolutionary dynamics will no longer follow a random walk in fitness space, as in Eq. (4), but rather show a systematic bias towards higher fitness (Supplementary Section 4). With an array of new drugs, some at final stages of approval88, being currently considered for the treatment of COVID-19, we believe that this analysis may offer key insights on the potential arms-race between our treatment and SARS-CoV-2’s evolution 89.

## Methods

### Simulations

All simulations were done on a random network of N = 5000 nodes and $$\overline{k}=15$$. The disease parameters were set to α0 = 0.1 and the infection rate was set variably to $${\beta }_{0}={\alpha }_{0}{R}_{0}/\overline{k}$$, to obtain the different values of R0. The mutation rate σ is specified in the relevant figure panels panel. In the results presented in the main text we employ α-mutations, and set β = β0 unchanged. This is complemented in Supplementary Section 3, where we examine β-mutations under fixed α = α0. In each scenario we set the initial condition to η(t = 0) = 0.02.

### Phase-diagram

To construct the phase-diagrams in Figs. 2 and 3 we varied R0 (0, 1.5) and σ (10−3, 10), amounting to a total of 1050 distinct epidemiological scenarios, as characterized by α0, β0 and σ. For each of these 1050 scenarios we ran 50 independent stochastic realizations, and measured the fraction P that resulted in r > ϵ; setting ϵ = 0.2. If the majority of realizations under a specific R0, σ failed to spread (r < ϵ) we have P → 0, and yet if most reached pandemic levels (r > ϵ) then P → 1.

### Reporting summary

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