Most real-life networks, from the technological (the Internet [14, 42] , train routes [63] , electronic circuits [37] ) to the biological (neural networks [73, 74] , protein interaction networks [38] ) exhibit a powerlaw structure. Human networks are no exception (the film actors network [7, 73] , the telephonecall graph [3, 4] , the sexual contact graph [45, 46] ). Recent tracking studies have confirmed that the network of proximity contact follows the same distribution [61, 39] .
When it comes to epidemics, this has terrible consequences. In particular, this means that the epidemic threshold is vanishing [57] , which implies that measures to reduce the probability of infection (hand-washing, social distancing, etc.) can slow the spread of the disease, but not stop the outbreak. It also implies that an outbreak is likely to start anew even from a single infected individual (e.g. a traveler). Only measures that break the structure of the graph (such as quarantine, closing restaurants and parks, prohibiting groups of more than 10 etc.) can stop the spread. Moreover, powerlaw graphs are incredibly resistant to random failures [6] , which means that removing individuals at random (for instance if they received a vaccine, or if they caught the disease and developed immunity) will not change these properties. As most countries affected by COVID-19 are relaxing quarantine while many infected individuals remain infected, one might think that the second wave will be identical to the first wave.
However, if powerlaw graphs are resistant to random failure, they are very susceptible to targeted immunization [6] . As shown in the previously mentioned paper, vaccinating only a small percentage of the nodes of the graph (the nodes of highest degree) is enough to achieve herd immunity, while it is never achievable with random immunization. The key observation here is that epidemic spread is not equivalent to random immunization. In particular, nodes of high degree get infected much faster than nodes of low degree [57] . If we let the epidemic run its course, this superspreader phenomenon would just help the epidemic spread rapidly to all the nodes in the network. However, if the epidemic is temporarily halted, say because of a mandatory quarantine, in the SIR model this implies that nodes of high degree will become immunized without having had the possibility of spreading the infection. Multiple quarantines can then become an ersatz to achieving herd immunity (or at least slow its spread and "flatten the curve") before a vaccine is developed.
The study of epidemics on graphs is an active field of research. An important body of work assumes the underlying graph is known, and focuses on modeling epidemics [19, 75, 32, 16, 78, 47] , detecting whether there is an epidemic [8, 9, 54, 53, 51, 44, 40] , finding communities [60, 76] , localizing the source of the spread [65, 66, 64, 69, 72, 70, 20] or instead obfuscating it [26, 28, 27] , or controlling their spread [43, 21, 22, 34, 29, 71, 77, 58] . The inverse problem, recovering the network from epidemic data, has also been extensively studied [56, 1, 18, 59, 41, 35, 33] .
This paper is interested in immunization strategies. [6] already showed that immunizing about 3% of the nodes of highest degree is enough to reach herd immunity for any powerlaw graph, no matter the exponent. [17] proposed a local strategy in case the global structure of the graph is unknown: we pick a fraction ρ of the population; each of those individuals then names someone they personally know. It turns out that the person selected has a higher chance of being well-connected than the person who nominated them, following the well-known principle stating that "your friends have more friends than you." This paper relies on a similar idea: someone infecting someone else is similar to someone nominating someone else, which explains why nodes of highest degree get infected faster. Other immunization strategies have been proposed [36, 15, 62, 12] .
Many scientists have joined the fight against COVID-19, and work has been done to predict the evolution of the epidemic [31, 23, 11, 67] , predict diagnostics [2, 68] , analyze the spread of misinformation about the pandemic online [5, 55] , design tracking algorithms and technologies [49, 10, 13] , analyze testing and interventions policies [48, 24, 25, 50] , and more. One other work [30] has analyzed quarantine strategies, albeit without taking into consideration the impact on the graph, which is our main contribution. This work aims to analyze quarantines and emphasize their impact as a targeted immunization strategy, which would be robust to future reinfections (contrary to contact tracing strategies, for instance).
The contributions of this paper are as follows:
• While quarantines have been introduced to slow the spread of COVID-19, we show that they transform the structure of the human contact graph, and negatively impact the diffusion of the disease during the subsequent waves.
• We characterize when to declare the quarantine in order to achieve herd immunity. For powerlaw graph of exponent 3 in the configuration model, this corresponds to when about 8% of the graph is infected.
• We experimentally show that it is possible to minimize the expected number of removed individuals at the end of the process. While about 100% of the nodes contract the disease with commonly accepted COVID-19 parameters, about 65% of the population will have contracted the disease with a well-timed quarantine.
• While the number above is higher than what we would hope, it is important to note that after this single quarantine, outbreaks cannot start again from a constant number of individuals. As such, this is the first long-term immunization solution which is robust to reinfections but does not require a vaccine.
• If we have some limitations on the maximum number of infected individuals (e.g. a limited number of hospital beds), we experimentally show that we can declare multiple quarantines and recover the result from a single quarantine.
The epidemic spreads on a (possibly infinite) directed graph G = (V, E), where V is the set of nodes and E the set of edges. If |V | < ∞, we write |V | = N . When considering a random graph drawn from a specific distribution D, we denote by P k the random variable representing the number of nodes of degree k in the graph, p k the fraction of nodes of degree k, and q k the fraction of nodes of excess degree k, defined by q k = (k+1)p k <k> . As a shorthand, we write
and E[k 2 ] represent the average degree and degree squared of the graph.
SIR model on graphs: We consider the spread of a Susceptible → Infected → Removed (SIR) epidemic on a directed graph G = (V, E), possibly infinite. Each node belongs to one of these three states. Infected nodes can infect the susceptible nodes with which they share an edge, also called their neighbors in the graph. Each infection along an edge is independent of other infections. Infected nodes spontaneously transition to the Removed state after a non-deterministic time. Once in the Removed state, nodes do not interact with the epidemic anymore.
Spreading model: The results presented in this paper are spreading-mechanism agnostic. Our theoretical results do not rely on restrictions on the spreading process. While our experiments are shown on classical continuous-time SIR spread, we do not believe the spreading process would change the outcome.
Configuration model: Our theoretical results are established in the configuration model [57] . In this model, we specify the number of nodes P k of degree k. We assume the sum of all P k is even. We then assign stubs to nodes, such that the number of nodes with k stubs is exactly P k . Following this, we pick two stubs at random, and connect them. We repeat the process until no stubs are left. We say the resulting graph was drawn from the configuration model with degrees sequence {P k } ∞ k=0 .
Powerlaw graphs: We emphasize the results on powerlaw graphs. A powerlaw gaph of exponent α is a random graph with degree distribution following the law P k ∼ C k α .
We recall known results in the configuration model, which we use in the rest of the paper.
Claim 1 (Exponential growth, proved in [57] ). In the configuration model, c2 c1 , the number of 2 nd neighbors divided by the number of 1 st neighbors, can be computed from the sequence of degrees {P k } N k=0 . Its value is:
.
Claim 2 (Herd immunity, proved in [57] ). In the configuration model, an outbreak is possible if and only if c2 c1 > 1, or equivalently:
Equivalently, if the above equation is not satisfied, we have achieved herd immunity.
Lemma 1 (Disparity in infection rate by degree, proved in [57] ). In the configuration model, let u(t) be the expected fraction of nodes of degree 1 in the susceptible state after time t. Then the expected fraction of nodes of degree k in the susceptible state is u(t) k .
We first start by defining what the epidemic threshold is:
Definition 1 (Epidemic threshold, proved in [57] ). For SIR epidemics on graph, there exists a phase transition. If the parameters of the epidemic are above the epidemic threshold, outbreaks occur; otherwise, the epidemic dies out quickly. The closer we are to the epidemic threshold (from above), the smaller the outbreak is.
The epidemic threshold for powerlaw graphs is 0.
Lemma 2 (Vanishing threshold, Proved in [57] ). Infinite powerlaw graphs with exponents between 2 and 3.4788 have a vanishing epidemic threshold.
In particular, this means that changing the parameters of the spread (for instance by enforcing hand-washing or masks-wearing) can slow the spread of the disease but not interrupt an outbreak. In practice, real graphs are finite, which implies the epidemic threshold is bounded away from 0. However, the larger the graph, the lower the epidemic threshold.
In this section, we study the effect of one quarantine on the structure of the graph. We are particularly interested in whether it is possible to achieve herd immunity, and how to minimize the total number of people who have been touched by the epidemic. For the remainder of the paper, we study perfect quarantines, as defined below:
Definition 2 (Quarantine). We call quarantine the complete halt of the spread of the epidemic. During a quarantine, all infected nodes transition to the removed state, and no new nodes become infected.
Lemma 3. Let u(t) be the fraction of nodes of degree 1 that are susceptible after letting the epidemic spread for time t. Suppose we declare a quarantine when u(t) reaches the value u. Let T Q : N N → R N be the operator representing the transformation of the expected number of susceptible nodes after one iteration of letting the epidemic grow, then declaring a quarantine. Then:
Proof. This is a direct implication of Lemma 1 from the Preliminaries.
As it turns out, the number of nodes in the removed state can be computed easily from the above result.
Claim 3. Let g 0 (z) be the generative function of the distribution of degrees. The expected fraction of nodes in the removed state after one quarantine R Q is:
Proof. Let p k be the fraction of nodes of degrees k in the graph, so that P k = N · p k . Notice that for k ≥ N , there exist no nodes of that degree, so p k = 0. The generative function of the distribution of degrees is g 0 (z) = ∞ j=0 p j z j .
We first establish results for general graphs:
Claim 4. Let u be the remaining fraction of susceptible nodes of degree 1 when we start the quarantine. We achieve herd immunity for u such that:
Proof. Following Claim 2, we want to find u such that E T Q [k 2 ] − 2E T Q [k] ≤ 0. This translates to:
We give some numerical results for powerlaw graphs:
Claim 5. Let u be the remaining fraction of susceptible nodes of degree 1 when we start the quarantine. For an infinite powerlaw graph of exponent 3, we achieve herd immunity for u ≤ 0.940599.
Proof. We want to find u such that:
Where Li 2 (u) is the polylog-2 function. Solving this equation numerically yields u ≤ 0.940599.
We now look at the total number of nodes in the removed state in this case:
Claim 6. If we declare a quarantine when a fraction u = 0.940599 of nodes of degree 1 are still in the susceptible state, then by the end of quarantine, at least R Q = 92.2912% of the nodes are still in the susceptible state.
Proof.
1 k x , the number of susceptible nodes is:
Combining Claims 5 and 6, the network can therefore achieve herd immunity while infecting a bit less than 8% of the nodes: Theorem 1. For powerlaw graphs of exponent 3, min-degree 1, it is possible to achieve herd immunity by declaring a single quarantine when a bit less than 6% of the nodes of degree 1 are infected. In this case, less than 8% of the nodes will be removed at the end of the quarantine.
• Quarantines can have extremely positive side effects, including achieving herd immunity.
• When herd immunity is achieved, there exists an epidemic threshold, and measures to slow the spread (e.g. washing hands) become impactful.
• The result above is both positive (only 8% of removed nodes) and disappointing: this is the best achievable, in the sense that nothing else we can do in this optimistic quarantine model can reduce the fraction of removed nodes at the end. In most cases, 8% of the population being infected represents millions of people, and is not desirable.
• Having reached herd immunity does not mean that the disease dies out, but rather that only a fraction of the graph will be infected. What we might desire instead is to minimize the total number of removed nodes at the end, if the epidemic started again after the quarantine.
We study this last point experimentally in section 4.
In this section, we validate the theoretical results described above by simulating the course of an SIR epidemic with perfect quarantines on randomly generated and real networks. Simulations were run using a continuous-time event-driven algorithm [52] . An infection is initialized by uniformly randomly selecting ρ nodes to be infected. We simulate perfect quarantines by moving all nodes in the I compartment to the R compartment and uniformly randomly selecting ρ susceptible nodes to become infected after quarantine. All simulations are run until there are no more infected nodes.
The first series of experiments focuses on the well-studied Barabási-Albert (BA) class of random graphs. BA graphs are scale-free, with a degree distribution that falls off according to the cubic powerlaw: P (k) ∼ k −3 . For this first set of experiments, we consider a BA graph with 10K nodes, with parameter m = 5. We will initially consider an infection with spreading and recovery rates equal, both set to 0.1, and we set the number of infected nodes post-quarantine, ρ, to be 10. We find that the results we will present are fairly insensitive to the choice of graph parameters or infection parameters.
We consider the effect of performing a single quarantine, which is triggered once a fixed proportion of the population is either infected or recovered, a quantity which we denote the quarantine threshold. We consider quarantine thresholds ranging from 0 to 1, with increments of 0.01, and run 100 trials for each fixed threshold. Figure 1 : Simulations run on a BA graph with 100K nodes. The blue curve indicates no quarantine, the red curve demonstrates the single-quarantine strategy that minimizes the final number of recovered nodes, and the green curve demonstrates the single-quarantine strategy that minimizes the maximum number of infected nodes.
The two criteria we will examine are the final number of recovered nodes and the maximum number of infected nodes. The final number of recovered nodes indicates how many nodes will have become infected throughout the course of the epidemic. The maximum number of infected nodes was shown to be an important quantity of interest during the COVID-19 pandemic, as hospitals operating above their capacity were forced to make tragic choices between patients in need of treatment. Figure 1 demonstrates the single-quarantine strategies that minimize either of these two criteria. Qualitatively, the minimum of the maximum number of infected nodes will be attained by enacting a quarantine that roughly balances the number of infected nodes at quarantine-time with the peak that is attained after quarantine. However, to minimize the final number of recovered nodes, a quarantine should be enacted just before the epidemic peaks, to effectively neutralize the second wave of the infection. Here we notice that the optimal single-quarantine strategy differs depending on which criterion we seek to minimize. We examine this further in figure 2(a) where we plot these two quantities versus the quarantine threshold. We observe that each of these quantities exhibits a V-like curve, however their minima are attained at different quarantine thresholds.
(a) Maximum number of infected individuals and final number of recovered individuals plotted versus quarantine threshold. Notice that the y-axes differ. There is a clear optimal quarantine threshold depending on the objective, however these optima do not align.
(b) Final number of recovered nodes when quarantines are enacted near the optimal quarantine threshold. Observe that as the quarantine threshold approaches the optimum, the number of outbreaks decreases, as does the extent of each outbreak. Figure 2 : Examining single-quarantine strategies As alluded to by our theory, a perfect quarantine serves as an organic form of targeted immunization and favors the removal of high-degree nodes, yielding a graph in the configuration model with a lightertailed degree distribution. We conjecture that this has a twofold effect in reducing the final number of infected nodes. Primarily, the graph structure is broken up enough to reduce the number of nodes that become infected in the event that an outbreak does occur; and secondarily, the probability of an outbreak occurring decreases after a reinitialization of the infection post-quarantine. This effect is demonstrated in figure 2 (b) where we plot a histogram of the final number of recovered nodes on multiple simulations for multiple runs with a fixed quarantine threshold. The bimodal distribution indicates that many reinitializations peter out quickly and outbreaks do not occur. However, some outbreaks do occur, but yield smaller numbers of final-recovered nodes than a no-quarantine scenario.
When the quarantine is declared at the optimal moment, there is no significant new outbreak after the quarantine is over, as can be seen by the flat red curve in Figure 1 (b). This is despite infecting a fraction ρ of the population: with this simple quarantine, the new network is now robust to future outbreaks. Quarantining therefore constitutes a valid immunization strategy. Now we consider the effect of running two quarantines on a BA graph. The graph settings as well as the epidemic parameters and reinitialization model are kept the same from the single-quarantine section. We enact two perfect quarantines at thresholds Q 1 , Q 2 , where the first quarantine is enacted when Q 1 fraction of the population is either infected or recovered, and the second quarantine is enacted when Q 2 proportion of the total population has entered either the infected or recovered compartments after the first quarantine. We perform a grid search over values of Q 1 , Q 2 and report the maximum number of infected nodes as well as the final number of recovered nodes in Figure 4 . The number of infected and recovered nodes for the quarantine settings that attain optimal criteria are plotted against the no-quarantine scenario in Figure 3 . Observe that two quarantines cannot achieve a noticeably lower number of final recovered nodes, and the optimum is attained when the sum of Q1 and Q2 is equivalent to the optimal quarantine threshold in the single-quarantine setting. The maximum number of infected nodes is displayed on the right: notice that the optimal two-quarantine strategy here has both quarantines occur earlier than the optimal strategy for minimizing R.
Examining the heatmap in Figure 4 (a) that displays the final number of recovered nodes in a two-quarantine setting, we observe the following qualitative trends. The dark-colored bands indicate quarantine strategies that have low numbers of final recovered nodes, which are most prevalent along a horizontal line and a diagonal line, i.e. the set of gridpoints such that Q 1 + Q 2 is fixed at 0.64, which is the optimal value for the single quarantine setting. This indicates that there is not much benefit to enacting a second quarantine, if the first quarantine was enacted at the correct time.
The heatmap in Figure 4 (b) displays the maximum number of infected nodes. The lighter patches indicate lower maximum numbers of infected nodes, and can qualitatively be characterized as a triangular patch bordered on the bottom by a horizontal band. The horizontal banding is indicative of the first peak dominating, whereas the light triangular patch represents the regime where the quarantines are enacted to roughly balance the height of all three peaks. One should also observe that both the minimal horizontal band and the minimal triangular patch in the right heatmap are higher and shifted to the left from the minimal bands in the left heatmap. This supports the trend observed in the single quarantine setting that quarantines should be enacted earlier to minimize maximal number of individuals infected at any one point, whereas quarantines should be enacted later to minimize the total number of infected individuals.
As discussed before, minimizing the maximum number of infected nodes or the total number of removed nodes happens for different quarantine thresholds. In this section, we want to achieve the best of both worlds: minimizing the total number of removed nodes while never letting the maximum number of infected nodes rise above a certain threshold. This is achieved in a slightly different setting than before. Instead of declaring a quarantine when a certain threshold is reached, we declare it when a certain value of infected nodes is reached. The results are below: Figure 5 : Final fraction of recovered nodes with as many quarantines as needed, as a function of the number of infected nodes when we declare the quarantine.
Our first observation is that there exist some quarantine strategies which allow for about 65% of removed nodes, which is the optimal final number of removed nodes in the case of a single quarantine. We also notice that many of these strategies exist, which would allow for an adapted strategy depending on the size of the city in which it's deployed. Finally, although some strategies perform much worse than others, they all are an improvement compared to never deploying a quarantine.