A network epidemic model with preventive rewiring: comparative analysis of the initial phase

This paper is concerned with stochastic SIR and SEIR epidemic models on random networks in which individuals may rewire away from infected neighbors at some rate $\omega$ (and reconnect to susceptible individuals with probability $\alpha$ or else simply drop the edge if $\alpha=0$), so-called preventive rewiring. The models are denoted SIR-$\omega$ and SEIR-$\omega$, and we focus attention on the early stages of an outbreak, where we derive expression for the basic reproduction number $R_0$ and the expected degree of the infectious nodes $E(D_I)$ using two different approximation approaches. The first approach approximates the early spread of an epidemic by a branching process, whereas the second one uses pair approximation. The expressions are compared with the corresponding empirical means obtained from stochastic simulations of SIR-$\omega$ and SEIR-$\omega$ epidemics on Poisson and scale-free networks. Without rewiring of exposed nodes, the two approaches predict the same epidemic threshold and the same $E(D_I)$ for both types of epidemics, the latter being very close to the mean degree obtained from simulated epidemics over Poisson networks. Above the epidemic threshold, pairwise models overestimate the value of $R_0$ computed from simulations, which turns out to be very close to the one predicted by the branching process approximation. When exposed individuals also rewire with $\alpha>0$ (perhaps unaware of being infected), the two approaches give different epidemic thresholds, with the branching process approximation being more in agreement with simulations.


Introduction
Interactions among individuals in a population can be described by networks of who-contactswhom. Studies of contact networks in sexually transmitted diseases have long revealed a high variability in the number of contacts per individual and highlighted the importance of those individuals described as "super-spreaders" for the onset of an epidemic [1,22]. Similar conclusions about the importance of super-spread events were drawn from contact tracing data collected from recent epidemic outbreaks of airbone-transmitted diseases like those of the severe acute respiratory syndrome (SARS) in 2002 and 2003 [19,26].
On the other hand, the risk perception among people during an epidemic outbreak triggers behavioural responses to lower the risk of contagion [17,30], the avoidance of contacts with infected individuals being an example of such responses [8]. This sort of social distancing led to the idea of disease-avoiding link rewiring and is one of the basis of the so-called adaptive or dynamic networks. Such a preventive rewiring assumes transmission of information which allows people to gather knowledge about the disease status of their neighbours. Therefore, in such networks the contact pattern is no longer static but evolves with the spread of an infectious disease according to the rules defining the rewiring process [10,13,27,28,29,34].
Pairwise models have been the main approach used to analyse epidemic dynamics on adaptive networks [10,13,20,27,29,31,34]. This class of models was initially developed to deal with processes defined on regular (random) networks and offers a good description of their dynamics. In their classic formulation and over heterogeneous networks, however, their accuracy is far from being satisfactory, especially for its prediction of the epidemic threshold. The so-called effective degree models are extensions of them with a higher accuracy in their predictions (but also with a higher complexity). In these models, in addition to the disease status of nodes, the number of neighbours for each status is also considered [11,18,21].
In addition to the previous approach, stochastic models have been used to analyze epidemic outbreaks on dynamic networks. If the contact network has a large size and no cycles, it can be locally described as a tree and the initial phase of an epidemic can be approximated by a branching process [4]. An example of a stochastic model defined on a dynamic network is the one developed in [32,33]. The model assumes that, at a given rate, the identities of neighbours change stochastically by means of an instantaneous edge swap between a randomly selected pair of links. So, this neighbour-exchange mechanism is independent of the epidemic dynamics because it does not depend on the disease status of the involved nodes. In other words, it is not an example of behavioural response against the presence of the disease. Other models defined on dynamic networks whose architecture evolves by random edge swapping can be found in [24]. This paper aims mainly at comparing the predictions from both modelling methodologies (pairwise/stochastic) for the initial phase of Susceptible-Infectious-Recovered (SIR) and Susceptible-Exposed-Infectious-Recovered (SEIR) epidemics with preventive rewiring among individuals (so, with an interplay between the spread of the disease and the rewiring process, that is, between disease's dynamics and network dynamics). In particular, in the SIR model we will assume that susceptible individuals break off connections with infectious neighbors at a given rate ω and, in place of them, new connections to susceptible and recovered individuals are created with probability α. As for the SEIR model, we consider two alternative scenarios for the dynamics of exposeds (i.e., infected but not infectious individuals). In the first one, exposed individuals break off with their infectious neighbors at a rate ω EI and, with probability α, they reconnect to any non-infectious individual in the population. In turn, susceptibles can also reconnect, with the same probability α, to exposeds (in addition to other susceptibles and removed individuals) when breaking off with infectious neighbors. In the second scenario, exposed individuals do not rewire at all (ω EI = 0), and susceptibles rewire away from both exposeds and infectives, and create new connections with probability α. From a modeling viewpoint, the rewiring scenario can depend on whether exposed individuals realize they have been infected (for instance, because they show symptoms) or not (they are asymptomatic). In both scenarios, the degree distribution changes over time and its mean degree is preserved only when α = 1.
The introduction of a reconnection probability α allow us to consider different degrees of rewiring, ranging from a situation where each deleted link is replaced by a newly created one (α = 1) to the limit case where no new connection is made and edges are simply deleted (α = 0). In other words, α can be though of a measure of the intensity of social distancing of rewiring individuals. As it is claimed in [8], people value person-to-person contacts and are willing to accept some disease risk to gain contact-related benefits. So, different values of α could be considered according to the type of social relationship modeled by the network.
The basic reproduction number R 0 , namely, the average number of infections produced by a typical infectious individual when the fraction infected is still negligible, is one of the compared quantities. Its predicted value will be checked against stochastic simulations carried out on contact networks with degree distributions that follow a Poisson distribution and a power law, respectively. It is worth noting that, while the meaning of R 0 in randomly mixing homogeneous populations is straightforward because any infectious individual is as likely as any other to infect a susceptible one, in heterogeneous networks it requires that one specifies the meaning of typical individual [5,23]. In most network models (in particular, for those without multiple levels of mixing), this definition implies that one has to compute R 0 from the average number of infections per infective once the early correlations of disease status around infectious individuals have been formed, which takes a couple of generations after the occurrence of the primary cases. Interestingly, this computation/redefinition of R 0 has been obtained under both previous modelling approaches [7,14,25]. In fact, it is well known that both pairwise models and branching process approximations lead to the same epidemic (or invasion) threshold in networks without rewiring [15].
In Section 2 we present the SIR and SEIR epidemic models with rewiring, here denoted by SIR-ω and SEIR-ω respectively. In Section 3 we use the branching process approximation to analyse the early phase of an SIR-ω epidemic. In particular, we compute R 0 and the expected degree of infectives during this initial phase as a function of the rewiring rate ω. In Section 4 the same approximation is applied to the study of the early stage of an SEIR-ω epidemic under different types of rewiring processes. Section 5 contains the results of the initial phase obtained for both epidemic models using the pair approximation with the triple closure introduced in [13,20] for heterogeneous networks. In particular, the SEIR-ω pairwise model extends the one considered in [20] to account for the rewiring of exposed individuals and the possibility that susceptibles reconnect to exposed ones after breaking off an infectious link. In Section 6 numerical estimates of R 0 and the mean degree of infectives during the initial phase are obtained from continuous-time stochastic simulations on heterogeneous networks. Finally, in Section 7 we discuss the analytical results obtained from both approximations and compare them to the output of the stochastic simulations. Moreover, we comment about the new insight into the role of the rewiring process in the SEIR-ω epidemic model.

The stochastic network epidemic model with rewiring
Let us define our stochastic network epidemic model. The population consists of a fixed number N of individuals and the stochastic network model is given by the configuration model with degree distribution D ∼ {p k } having finite mean µ and finite variance σ 2 (e.g. [6]). This model is defined by all individuals having i.i.d. degrees D i and edge-stubs being pairwise connected completely at random with any loop or multiple edge being removed making the graph simple. We are primarily interested in the situation where N is large, and the approximations will rely on this.
On this network we now define an epidemic model where susceptible individuals may rewire if they are neighbors of infectious individuals. We start by defining an SIR epidemic where infected people immediately become infectious and later recover, and then extend the model to an SEIR model in which infected people are at first exposed (latent), then they become infectious, and eventually they recover. The latter model is a bit more complicated in that now the rate of rewiring could differ depending on whether the person rewiring is susceptible or exposed, and depending on whether the person he/she rewires away from is exposed or infectious.
Note that such a rewiring process causes the degree distribution to change over time. However, since we will focus our analysis on the early stage of an epidemic outbreak where only a tiny fraction of individuals is initially infected, we will assume that the degree distribution D does not change significantly during the initial phase of the epidemic.

The SIR-ω network epidemic with rewiring
In this model individuals are at first susceptible. If an individual gets infected he/she immediately becomes infectious, and after some random time he/she recovers and becomes immune for the rest of the outbreak. SIR hence stands for susceptible-infectious-recovered (e.g. [4] for more on SIR and SEIR epidemic models).
The SIR-ω model is defined on the network (described above) as follows. Initially one randomly selected individual is infectious and the rest are susceptible. An infectious individual transmits the disease to each of its susceptible neighbors at a rate β, and the infectious periods are i.i.d. following an exponential distribution with rate parameter γ (so infectious individuals recover at a rate γ). Further, susceptible individuals that are neighbors with infectious ones break off with such neighbors independently at rate ω and, with probability α, replace each lost connection by reconnecting to a randomly selected non-infectious (i.e., susceptible or recovered) individual in the community. Therefore αω is the effective rewiring rate, i.e., the rate at which new links are created by susceptibles in substitution for those previously deleted.
The SIR-ω network epidemic has the following parameters: β (infection rate), γ (recovery rate), ω (rewiring rate), α (reconnection probability), and the degree distribution D with mean µ and variance σ 2 . We will focus on what happens early on in the epidemic, before a substantial fraction of the community has been infected.

The SEIR-ω network epidemic with rewiring
In the SEIR-ω model an infectious individual transmits the disease to each of its susceptible neighbors at a rate β, but, when this happens, the neighbor first becomes exposed (or latent) and can transmit the disease only after a time delay. In other words, such an exposed individual becomes infectious at a rate φ, and at this moment can start infecting each of its susceptible neighbors at a rate β. As before, infectious individuals recover at a rate γ.
As regards to rewiring, it can be modelled differently depending on when an individual starts and stops having a rewiring rate and also depending on which individuals it rewires away from. Our model considers three different rewiring rates: a susceptible individual rewires away from each exposed neighbor at a rate ω SE , a susceptible individual rewires away from each infectious neighbor at a rate ω SI , and an exposed individual rewires away from each infectious neighbor at a rate ω EI . It is of course possible to also allow for rewiring from other states, e.g. that susceptible individuals rewire from recovered individuals, but since we are primarily focusing on the initial phase such rewiring would have negligible effects. If infected people are detected only when they become infectious (e.g. if the latent period is the same as the incubation period), and hence individuals rewire away from infected neighbors only when those become infectious and not while they are exposed, this would correspond to ω SE = 0 and ω SI = ω EI > 0: susceptible individuals are not aware of exposed (latent) neighbors being infected and hence do not rewire, and susceptible but also exposed (latent but unaware) individuals rewire away from the infectious ones. We could obtain a second scenario if also exposed (latent) individuals are known to have been infected (e.g. by contact tracing or because they show some symptoms). We would then have ω SE = ω SI > 0 and ω EI = 0: susceptible individuals rewire away both from exposed and infectious neighbors but exposed individuals do not rewire away since they know they have already been infected. In all cases, the reconnection probability α modulates the fraction of rewirings that are effectively done, and it is assumed to be the same both for susceptibles and for exposeds. Therefore, αω ij is the effective rewiring rate of individuals in state i away from individuals in state i.
The SEIR-ω network epidemic has all the parameters of the SIR-ω epidemic except that the rewiring rate ω now becomes three different rates: ω SE , ω SI and ω EI , and there is a rate φ at which latent individuals become infectious.

Branching process approximation of the initial phase of the SIR-ω epidemic
Most stochastic epidemic models allow for a branching process approximation of the early stages of an outbreak, an approximation which can be made rigorous as the population size N tends to infinity (e.g. [2]). This applies also to network epidemics -we now describe the approximation of the current model.
We derive expressions for the basic reproduction number R 0 , here denoted by R BA 0 to distinguish its expression from the one obtained using pair approximation. We also derive the exponential growth rate r (the Malthusian parameter) for the situation that R 0 > 1, and the average degree of infected individuals. Since rewiring is a focus of this paper, we look at both the degree of newly infected individuals as well as on the average of all infectious individuals, the latter expected to be smaller than the former since individuals rewire away from infectious neighbors.

The basic reproduction number R 0
Recall that R 0 is defined as the mean number of new infections caused by a typical infected individual during the early stage of the epidemic. Individuals that get infected during the early stage will, at the time of infection, have the size biased degree distribution of neighbors, D ∼ {p k }, wherep k = kp k / j jp j = kp k /µ (e.g. [3]). One of the neighbors is its infector whereas the remaining neighbors, with large probability during the early stage of an outbreak, will be susceptible. When considering the disease progress it is only theD − 1 susceptibles that are of interest since it is not possible to reinfect the infector.
From the derivation above, the mean number of susceptible neighbours a typical new infectee has during the early stages equals (e.g. [3]). The probability to infect a given such neighbor is obtained by considering the competing events that may happen: there could be an infection (rate β), the neighbor could rewire away from the infectee (rate ω), or the infectee can recover (rate γ). The probability of infection hence equals β/(β + γ + ω). The basic reproduction number equals the mean degree multiplied by the transmission probability, i.e.
If there is no rewiring (ω = 0), the basic reproduction number equals E(D − 1)β/(β + γ) as is well known. Therefore, the rewiring reduces R 0 , as expected. We note that R BA 0 is independent of α, so it has no effect on the beginning of an outbreak if rewired edges are dropped, always attached to new susceptible individuals or a mixture of two.

The exponential growth rate r
During the early stage and assuming a large population, the number of infectives in the epidemic will asymptotically (as N → ∞) evolve like a branching process. R 0 is the corresponding mean offspring distribution. Another important quantity associated to this branching process is λ(t), the expected birth rate (rate of new infections) of an infectee having "age" t, where age corresponds to time since infection. We now derive λ(t) which in turn will help us derive the exponential growth rate of the epidemic.
As derived earlier, the average number of susceptible neighbors upon infection is E(D − 1) = µ − 1 + σ 2 /µ, and the infectee will infect each neighbor independently. The average rate of infection (="birth") for each neighbor is obtained by considering what must be fulfilled for infection to happen. In order to infect a neighbor t time units after infection, the infectee must still be infectious, the neighbor should not have rewired, and the infectee should not yet have infected the neighbor. Given this, the infection rate equals β. Since all events are assumed to follow an exponential distribution this gives us the following expression for λ(t): The average total number of births (infections) is hence ∞ 0 λ(t)dt = E(D−1)β/(β +γ +ω) = R 0 as it should be. The mean birth rate λ(t) also determines the exponential growth rate of the epidemic, i.e. for which r, I(t) ∼ e rt (cf. [12]). This r, the Malthusian parameter, is given by the solution of the Lotka-Volterra equation For our model this gives us, after a bit of algebra, Also the exponential growth rate is independent of α.

The mean degree of infectives
We now turn to the mean degree of infectives during the early stages of the epidemic. We consider two different means. The first one is for newly infected, which in fact has already been shown: during the early stages newly infected individuals will have degree distributionD (when considering the degree distribution we also count the non-susceptible infector), so the mean degree of newly infected individuals equals E(D) = µ + σ 2 /µ.
The second mean, E(D I ), denotes the average number of neighbors of all infectives during the early stages, not only that of the newly infected ones. As described above, during the early stage of an outbreak the degree distribution of newly infected equalsD. However, while still infectious, an individual loses susceptible neighbors by rewiring: each susceptible neighbor is lost at a rate ω. The probability that a susceptible neighbor v is still a neighbor (i.e. has not rewired) t time units after our individual x was infected and given that x is still infectious, is obtained by conditioning on the potential infection time of the neighbor (v only rewires if not yet infected). So, we have P (v still a neighbor at t) = t 0 P (v still a neighbor at s | v infected at s)βe −βs ds Note that we condition on that x remains infectious at t. When deriving the degree distribution of all infectives during the early stage, we have to take into account both this decrease of degree with age, but also the fact that, in the exponential phase of the epidemic (recall that I(t) ∼ e rt ), "young" infectives will be over-represented. The ratio of individuals infected s time units ago over the number of individuals infected at present equals e −rs due to the exponential growth rate. And only a fraction e −γs of them are still infectious at present. Consequently, the fraction of infectives that were infected s time units ago or longer equals e −(r+γ)s , so the age distribution of infectives is exponential with parameter r + γ (this is the so-called stable age distribution of this branching process, [12]).
The mean degree of all infectives during the early stage is obtained by conditioning on their age: where, as before, E(D) = µ+σ 2 /µ, and r = βE(D −2)−γ −ω was defined in Equation (3). This mean degree should be valid after a couple of generations and will then change as the depletion of susceptibles will start affecting things. As seen in (4) also the mean degree of infectives is independent of α. At first this might seem surprising since the degree of infectious individuals are affected by rewiring. However, an infectious individual can loose edges (which reduces the degree) due to susceptible neighbours rewiring away from the infective, but it does not affect the degree of the infective whether these links are simply dropped or the rewiring susceptible connects to new individuals.

Branching process approximation of the initial phase of the SEIR-ω model
We now study the extended SEIR model recalling that individuals who get infected are now first latent for an exponentially distributed time with rate parameter φ, after which they become and remain infectious according to earlier rules. Individuals rewire away from infected neighbors. More precisely, a susceptible individual rewires from each exposed (latent) neighbor at a rate ω SE and from each infectious neighbor at a rate ω SI . Moreover, exposed individuals rewire away from infectious neighbors at a rate ω EI . Of course, some of these rewiring intensities may be zero (cf. Sec 2.2). As before, upon each rewiring event the individual reconnects to a randomly chosen susceptible or recovered individual with probability α and with the remaining probability the edge is simply dropped.

The basic reproduction number R 0 for the SEIR-ω model
During the early stage of an outbreak, at the time of infection an exposed individual e has degree distributionD as before, one neighbor i being the infector and the remaining neighbors being susceptible. So, e has E(D) − 1 expected susceptible neighbors. However, in the SEIR model this number can eventually increase by one, provided that e can rewire away from its infector i (if not yet recovered) and reconnect to a susceptible individual that will become a new neighbor. The probability for this to happen is αω EI /(φ + ω EI ). In consequence, the expected number of susceptible neighbors for e is E(D) − 1 + αω EI /(φ + ω EI ). Any such neighbor, say s, will get infected if e first becomes infectious (before s rewires away from e) and, then, an infection occurs (before e recovers or s rewires from e). Hence, the probability for this to happen is the product of the probabilities of these two events, namely, φ/(φ + ω SE ) · β/(β + γ + ω SI ). To conclude, the expected number of neighbors infected by e equals: By studying Eq. (5) we make the following observations. If there is no rewiring from any state, R BA 0 reduces to β/(β + γ) E(D − 1), i.e. the same as for the SIR case. Further, R BA 0 is decreasing in both ω SE and ω SI as expected. However, R BA 0 increases with α and ω EI . If ω SE = 0 and ω SI = ω EI = ω, the perhaps most realistic example discussed in Sec. 2.2, then R BA 0 can be increasing in ω for some parameter set-ups, implying that the quicker individuals rewire the larger epidemic outbreak! The explanation to this is that, when αω EI > 0, the exposed (latent) individuals can rewire away from their infector to a susceptible neighbor, with the effect that they may later (once they become infectious) infect the new susceptible neighbor.

The exponential growth rate r for the SEIR-ω model
As with the SIR-ω model, in order to compute the Malthusian parameter r we first derive an expression for λ(t), the average rate at which an individual, who was infected during the initial phase of the epidemic, infects new individuals t time units after his/her time of infection.
At the time when an individual gets infected he has on average E(D) neighbors, one being infectious (its infector) and the remaining E(D − 1) will, with large probability since we are in the beginning of the epidemic, be susceptible. At a rate β, the infected individual infects each of the E(D −1) initially susceptible neighbors t time units after infection if the following conditions are fulfilled: the infected individual must have terminated the latent period without the neighbor having rewired, and after that the infectious period should still be active, an infection should not yet have taken place, and the neighbor should not have rewired. As mentioned in the previous subsection, it is also possible that the infected individual infects through the link to the infector. This happens with a rate β at t time units after infection if the following holds: the infected individual rewired from its infector (and connects to a susceptible neighbor) while still latent, and after this the infected individual has become infectious, has not yet infected the neighbor nor has the new neighbor rewired. The above reasoning leads to the following expression for λ(t): λ(t) = βE(D − 1)P (infectious, neighbor did not rewire, neighbor not yet infected, at t) + βP (rewired while latent, infectious, neighbor not rewired, neighbor not infected, at t).
By conditioning on the end of the latency period, the first probability equals The second probability, now conditioning both on the time of first rewiring and the end of the latent period, equals Using these expressions in Equation (6) and solving the integrals results in the following expres-sion for λ(t): We now use λ(t) to derive the exponential growth rate r of the epidemic in case it takes off, and also to confirm our expression for R 0 . The latter is easy. If we compute ∞ 0 λ(t)dt using the expression above we get exactly R 0 as defined in Eq. (5), as it should be. As for the Malthusian parameter r this is given as the solution to the equation ∞ 0 e −rt λ(t)dt = 1. For the expression of λ(t) above, this can be shown to be equivalent to For αω EI > 0, this is a third order equation, but for positive values of r (the relevant values as we assume R 0 > 1) the left hand side is decreasing in r, starting from a value larger than 1 when r = 0 and decreasing to 0 as r → ∞ implying that there is a unique solution to the equation. Equation (7) is not explicit but it is still possible to see how various parameters affect the growth rate. For example, r is increasing in the infection rate β and the mean degree E(D). As regards to the rewiring rates, r decreases in ω SI and ω SE but increases with the "harmful" rewiring rate αω EI . Finally, as we increase the rate to leave the latent state (i.e. making the latent state shorter), the effect depends on other parameter values, but if we increase φ towards infinity it can be shown that we obtain the expression for r of the SIR-ω model (cf. Eq. (3)) as expected.

The mean degree of infectives and related quantities
For the SEIR-ω model it is also possible to derive specific features of infected individuals during the initial phase of an epidemic. For example, as we did for the SIR-ω case, we can compute E(D I ), the average degree of infectives during the early stage of the outbreak. However, other mean quantities might be equally relevant as, for instance, the mean degree E(D L ) of infected but still latent individuals, or the mean degree E(D I+L ) of either latent or infectives, or for that matter the expected number of susceptible neighbors while in one of these states. For brevity and because some of these quantities have even more complicated expressions, we compute E(D I ) without solving the integrals appearing in the derivation, and indicate how to modify the derivations if we want to compute another mean.
To compute E(D I ), let us pick at random an infectious individual i during the early stage of an outbreak and let T denote how long ago this individual was infected. We first compute the expected degree of i conditional upon T = t, denoted by E(D i |T = t). This is done by conditioning on the duration of the latent period L = s, which must lie between 0 and t since i is infectious t time units after infection: The second factor is given by f L (s|T = t) = φe −φs e −γ(t−s) / t 0 φe −φu e −γ(t−u) du . As for the first factor, the individual has E(D) expected neighbours at the time of infection, one being infectious and the rest being susceptible. For the susceptible neighbors we compute the probability that they are still neighbors. For the infector, it could have lost a neighbor from this edge only if i rewired away from the infector to a susceptible neighbor and the new neighbor later rewired away from i. We hence get E(D i |T = t, L = s) = E(D − 1)P (susceptible neighbor did not rewire|L = s, T = t) (8) + 1 − P (i looses edge to infector |L = s, T = t).
The first probability in (8) is obtained by conditioning on whether the susceptible neighbor was infected or not, and, in the former case, whether the latent period ended before t or not: Here there should be no α in front of ω EI because the event concerns an exposed neighbor and it is irrelevant for the degree of the infective whether this neighbor reconnects or not upon rewiring.
The second probability in (8) consists of two events. Either i rewired away from its infector and dropped the edge while exposed, or else i rewired away from infector and reconnected while exposed, and the new neighbor rewired away from i. The first event has probability P (i rewired and dropped edge | L = s, The second event is obtained by conditioning on the time when i rewires away from the infector and reconnects to a susceptible neighbor, whether the second rewiring happens during the latency or infectious period of i, and in the latter case whether infection takes place or not: P (i rewired and reconnected, and new neighbor rewired away from i | L = s, T = t) Note that α appears in front of ω EI only when it concerns the infective, because then it has to reconnect to make spreading to a new individual possible, whereas there is no α when the rewiring refers to exposed neighbors rewiring away from the infective. In the latter case it is irrelevant for the degree of the infective whether or not the exposed individual reconnects upon rewiring.
It remains to derive the distribution for T , the time since infection. For this we know that due to the exponential growth rate r of infectives, there is a fraction e −rt to choose from t units earlier as compared to present time. However, we also require that the individual is infectious at present, an event which happens with probability t 0 φe −φs e −γ(t−s) ds. The probability density of T is hence proportional to e −rt t 0 φe −φs e −γ(t−s) ds, which after a bit of algebra gives the following density Finally, the expected degree of a randomly chosen infective during the early stages is obtained by integrating with respect to this density: In order to compare this predicted E(D I ) with the one obtained from pair approximation (see next section), for each set of values of the parameters we obtain the value of r given by the positive solution of (7) and evaluate the resulting expression of the previous integral.
If we were to compute e.g. the average degree of a latent individual E(D L ), we would similarly condition on the time T since infection of the randomly chosen latent individual. This individual would have E(D) neighbours at the time of infection, one infectious and the rest susceptible, and we need to compute the probability that these neighbours would not have been lost similarly to what we did before. We would then integrate this expected value with respect to the probability density of T , which is proportional to e −rt e −φt .

R 0 and E(D I ) for the SIR and SEIR pairwise models with rewiring
We now derive expressions for R 0 and E(D I ) using an alternative deterministic approximation based on the closed-form equations for the dynamics of pairs of disease status, the so-called pairwise models. While the SIR-ω pairwise model was already introduced in [20], the SEIR-ω pairwise model is a generalization of the one also introduced in [20] that includes rewiring of exposeds and reconnection rules introduced in accordance with it. This extended model will allow for a better understanding of the impact of rewiring on R 0 derived under this approach, here denoted by R P A 0 .  [20] for details). Note that, since we focus our analysis on the early epidemic stage with a very small number of initially infectious nodes, we approximate the expected degree of the susceptible central node of a triple by E(D), the mean degree of a node reached by following a randomly chosen link in a wholly susceptible population at t = 0, i.e., when the degree distribution is the initial one.

The SIR-ω pairwise model
Upon introducing the triple closure into the original model, the initial dynamics of the SIR-ω model is determined by   [IR] [I] .
It is interesting to observe that the reconnection probability α does not appear in the system. This means that disconnections from infectious individuals play a role in the early epidemic dynamics, but the way the new connections are created, or even if they occur at all (α = 0), does not play any role at this stage. The first equation of (14) is decoupled from the other two and has a unique positive equilibrium ([SI]/[I]) * = E(D)−2−ω/β, which is globally asymptotically stable. From this equilibrium and (11), it immediately follows that which defines the same epidemic threshold R 0 = 1 as R BA 0 (cf. Eq. (1)), but overestimates R 0 when it is larger than one. A graphical comparison of the expressions of R 0 obtained from each modelling approach is shown in Fig. 1 using β as a tuning which is the same expression as the one obtained for E(D BA I ) (cf. Eq. (4)).

The SEIR-ω pairwise model
According to the rewiring processes described in Section 2.2, and using the same notation and the triple closure as before, the equations of the SEIR model at the initial phase of the  and δ = 0 otherwise. In the first case, susceptible individuals do not disconnect from exposed individuals and can reconnect to the latter when they rewire away from an infectious neighbor.
In the second case (ω SE > 0), susceptible individuals recognize exposed ones, rewire away from them, and only reconnect (with probability α) to other susceptibles or to recovereds (so, δ = 0). Note that, in both cases, F ([S], [E], [R]) → N at the early stage of an epidemic.
If ω EI > 0, exposed individuals who break off a link with an infectious neighbor randomly reconnect to any susceptible, recovered, or exposed individual with a probability α , respectively. This corresponds to the situation where latent individuals are asymptomatic and, so, they do not know they have already got the infection. Therefore, one can also assume that susceptible individuals do not know the disease status of the exposed neighbours and take ω SE = 0. Hence, susceptibles who break off a link with an infected neighbor reconnect to any susceptible, exposed or recovered individual with the same probabilities as the exposed ones, namely, α It is illustrative to check that the limit system for the dynamics of the local densities of disease status around an infectious individual (see Appendix) only contains one term with the reconnection probability α, namely, the one with α ω EI as a prefactor. Therefore, the other contributions from the remaining rewiring rates in (17) do not appear when we restrict ourselves at the early stage of an epidemic. In other words, the precise rules for reconnecting susceptibles who have rewired away from an infectious neighbor, even if there is no reconnection at all of those individuals (α = 0), does not affect the epidemic dynamics during the initial phase. This claim, however, is not true for exposed individuals. The last term of the equation for [SE]/ [I] tells us that exposeds enhance the spread of the disease by rewiring away from infectious neighbors (because they will replace the latter with susceptible ones) and, hence, R P A 0 must increase under this rewiring.
The expression of R 0 defined by (11), and computed from the corresponding positive equilibrium of the limit system for the local densities (see Appendix) is given by  is supercritical (i.e. larger than 1) for smaller β than R P A 0 .
That is, both approaches predict the same epidemic threshold when exposed individuals do not rewire (α ω EI = 0), but pair approximation predicts a higher epidemic threshold in terms of β than the one obtained from the branching process approximation when ω EI > 0 (see the right panel in Fig. 2). Moreover, simulations show that R P A 0 always overestimates the basic reproduction number when R BA 0 > 1 if ω EI = 0. Finally, from Eq. (20) it follows that ξ * increases with ω EI , which implies that R P A 0 also increases with ω EI as expected. On the other hand, from the positive equilibrium of the limit system for the local densities, Note that, when there is no rewiring (ω SI = ω SE = ω EI = 0), it follows that E(D P A I ) = E(D), as expected. Moreover, when ω EI = 0, ξ * is given by (21) and E(D P A I ) can be explicitly expressed in terms of the model parameters.
For ω EI > 0 and ω SE = 0, the numerical evaluation of the previous expression and its comparison with that of E(D BA I ) show that both predictions are very close to each other (see Fig. 3). Indeed, they are graphically distinguishable only for low values of β (left panel) or for high values of the rewiring rate ω (right panel), i.e., for those parameter values that give R 0 close to 1. In these cases, differences occur at the second decimal place of the predicted mean degree. For ω EI = 0 and ω SE ≥ 0, both expressions give the same value for E(D I ) (at least until the twentieth decimal digit).

Stochastic simulations
To carry out continuous-time stochastic simulations we generated Poisson networks with E(D) = 9 and scale-free (SF) networks with characteristic exponent 4 and minimum degree k min = 5, i.e. p(k) = 3k 3 min k −4 . So, in both cases, E(D) = 10. All the networks had N = 10000 nodes. The SF networks were generated using the configuration model algorithm. For each network and each combination of parameters, we averaged the outputs over 250 initial sets of 10 individuals infected uniformly at random (primary cases). Moreover, we take the reconnection probability α = 1 in all simulations because it is when rewiring has the biggest effect. The stochastic time evolution of the infection spread was simulated by means of the Gillespie algorithm [9].
As mentioned in the introduction, since primary cases are selected at random regardless of their degree, a correct empirical computation of R 0 relies on counting the mean number of infections produced by the secondary cases (individuals infected by the primary cases). So, for each experiment (that is, for each initial set of 10 random primary cases) we let the epidemic evolve until all primary and secondary cases have recovered. In Figs. 1 and 2, corresponding respectively to SIR-ω and SEIR-ω models, we compare the value of R 0 predicted by Eqs. (1) and (5) with that obtained from Eqs. (15) and (18) respectively, and with the outputs of stochastic simulations carried out on a Poisson and a scale-free network. Since the variance of the theoretical SF degree distribution is quite high (it equals 3k 2 m /4 = 18.75), there is a high variability among generated SF networks. Therefore, in order to compare the results for both types of networks in the same figure, we have chosen a random SF network whose degree sequence leads to a value of E(D) very close to the expected one (µ = 7.5262, σ 2 = 18.6399, and hence E(D) = 10.0029).
We have also tested the accuracy of the analytical predictions for E(D I ). Recall that, for the SIR-ω model, both approaches lead to the same value of E(D I ) (cf. Eq. (4) and (16) is computed as the total number of links containing an infected individual (the edges joining two infected are counted twice) over I(t). The right panels of these figures show that the curve I(t) fits to an exponential function (initial phase) on an interval [0, t e ] with t e less than the time I(t) attains its maximum. It is precisely on this interval that the mean degree D I (t) on Poisson networks keeps almost stationary around a value close to the predicted one (see left panels of Fig. 4 and 6). Such a plateau in the profile of D I (t) is not so nicely observed when simulations are carried out on scale-free networks.

Discussion
It is known that pairwise models for the spread of SIR-type diseases through static homogeneous networks predict the same epidemic threshold as the one obtained from the probabilistic computation of R 0 when infectious periods are exponentially distributed [14,15]. By using a pairwise model with a triple closure introduced in [13,20], and a branching process approximation of a stochastic network epidemic, we have seen that the same epidemic threshold is also predicted for dynamic networks whose topology evolves according to the preventive rewiring of susceptible individuals. As expected from a preventive rewiring, the higher the rewiring rate ω, the lower R 0 is for both predictions, and this is true regardless of the value of the reconnection probability α. However, for any ω, the pair approximation overestimates R 0 when it is larger than 1 as compared to stochastic simulations and to the value R BA 0 obtained from the branching process approximation. The reason is that the value R P A 0 predicted by the pairwise model is a linear function of the infection rate β and, hence, an unbounded number of new cases is predicted as β increases (cf. Eq. (15)). Such a linear dependence on the infection rate is a common feature of deterministic epidemic models [1]. In contrast, the hyperbolic dependence of R BA 0 on β (cf. Eq. (1)) reflects the saturation in the production of new infections for high infection rates, and leads to values of R 0 that are closer to those obtained from the simulations.
The same relationships between estimates of R 0 , and between epidemic thresholds, also hold for SEIR-ω models when susceptible (but not exposed/latent) individuals break off connections with their infectious/exposed neighbours, and reconnect to randomly chosen susceptible or recovered individuals with a given probability α (ω EI = 0). However, if exposed individuals also disconnect from infectious neighbours and reconnect to randomly chosen non-infectious individuals (α ω EI > 0), then the epidemic thresholds from the two approaches differ from each other, with R BA 0 > 1 when R P A 0 = 1. Interestingly, as long as α > 0, this rewiring of exposeds is not preventive but harmful since it does not help to contain the disease: sooner or later exposed individuals will become infectious and, when an exposed replaces its infector with a susceptible one, the number of infections he/she can produce increases. This is why R 0 increases with αω EI , in contrast to what happens with the other two rewiring rates, ω SI and ω SE .
Note that, because we are concerned with the initial stage of an epidemic, in large networks rewired links will, with a very high probability, point to susceptible individuals. Therefore, as long as only susceptible individuals rewire, the initial propagation of the disease will not be particularly affected by the type and intensity (α) of the reconnection process. In fact, this is what follows from the computation of R 0 under both approaches. For the SIR-ω model, for instance, this can be easily seen from the derivation itself of R 0 under the branching process approximation since the former does not depend on how new connections (if any) are made. Similarly, from direct inspection of the limit system governing the dynamics of the local densities around infectious individuals (cf. Eq. (14)), one sees that there is no term corresponding to reconnection of links (i.e., terms with αω as a prefactor).
Both estimates of R 0 have been checked by obtaining, from stochastic simulations carried out on random networks, the mean number of infections produced not by the first infectious individuals landing in the population (primary cases), but by the second generation of infectives (secondary cases). It has been recognized elsewhere ( [7,14,25]) that this "redefinition" of R 0 for epidemics on networks is the suitable one because it takes into account the local correlations of disease status developed around infectives during the epidemic exponential growth (initial phase). Simulation results clearly indicate that the estimation of R 0 obtained from the branching process approximation is much better than the one derived from pairwise models, and gives the correct epidemic threshold when ω EI > 0. In particular, for the SEIR-ω model there is an excellent agreement for all the shown values of β (Fig. 2), whereas for the SIR-ω model the agreement is not as good when β is not close to its critical value (Fig. 1).
On the other hand, for the SIR-ω model we have also seen that both approaches predict the same expected degree E(D I ) of infectives at the early stage of an epidemic. In particular, it follows that E(D I ) is a linear decreasing function of the rewiring rate ω. Its computation from stochastic simulations clearly shows that, for moderately large values of ω and β, the mean degree of the infectious nodes D I (t) remains quite constant during the exponential phase of the disease. Moreover, the agreement between theoretical predictions and observations using both ω and β as tunable parameters is very good in Poisson networks for low values of the rewiring rates and moderate values of β. For high values of β, the exponential phase is so fast that the time window where D I (t) is roughly constant is hardly noticeable. Similarly, when rewiring is high, D I (t) decreases monotonously without any plateau during this initial phase. For scalefree networks and moderate values of β and ω, however, the predicted E(D I ) overestimates the observed D I (t) (cf. Fig. 4 and Fig. 5).
As for the SEIR-ω model, the values of E(D I ) computed from both approaches are very close to each other (see Fig. 3) and show a very good agreement with the simulations on Poisson networks (see Fig. 6). However, the corresponding expressions are not easily manageable (both depend on the solution of a cubic equation when α ω EI > 0) and, therefore, they have been evaluated numerically. From these evaluations, it follows that, when α > 0 and ω EI = 0 or, alternatively, when α = 0 (dropping of edges), both approaches lead to the same values of E(D I ). For α ω EI > 0, predictions are almost graphically indistinguishable from each other (for α = 1 and ω SI = ω EI , the maximum differences occur at second decimal place of the expected degree). As with the SIR-ω model, when the simulations take place on scale-free networks, the predicted E(D I ) overestimates the observed D I (t) (see Fig. 7).
Finally, it is important to note that, for dynamic heterogeneous networks whose degree distribution evolves in time, the value of R 0 does not determine the final epidemic size. While the computation of R 0 is based on the initial degree distribution, the final epidemic size depends on the whole evolution of the degree distribution. In particular, since reconnection is assumed to be uniform with respect to the degree of nodes, the variance of the degree distribution decreases over time whenever the initial network is highly heterogeneous (see [13]). Determining an expression for the final epidemic size, using any approximation method, and studying how it   [I] when individuals drop connections to infectious neighbours (α = 0). In particular, this reflects the (expected) fact that whether exposed individuals break off with infectious neighbors (ω EI > 0) or not (ω EI = 0) does not affect the early dynamics of [SI]/ [I] as long as they do not replace these links with new connections.
Note that this condition is fulfilled when ω SE = 0 which was, indeed, what we assumed in the model if ω EI > 0.