Introduction

Human communities are complex social systems in which emergent properties—such as the dynamic nature of a viral infection - result from their members’ local, uncoordinated temporal interactions1,2,3. Viral transmission is mediated through the community’s members’ temporal interactions in the community. The sequence and order of these interactions, termed time-respecting paths, are critical for accurate modeling of the progression of a disease4,5,6.

Here, we use temporal networks with time-respecting paths and continuous-time network histories7,8 as well as a real-world contact network9 to model multiple competing variants in a population. As SARS-CoV-2 continues to mutate, some of its variants become variants of concern. These variants either differ in their transmissibility, infectivity, pathogenicity or their ability to evade immunity10,11,12,13.

We quantify the competition conditions between variants that differ in their transmissibility and under changing levels of cross-immunity, over temporal random networks, with our interaction-driven contagion model8. Previous studies considered two competing pathogens in a population with full cross-immunity. Being infected by one of the pathogens provides subsequent immunity to both. Studies have demonstrated that the faster pathogen is more likely to dominate the network14,15,16,17. When different cross-immunity levels are considered, this is not necessarily the case18. However, these studies did not consider the temporal ordering of events and the time-respecting paths.

There are numerous practical considerations when considering competition conditions between variants in a population. Co-existing variants compete on a shared resource that is the transmission vehicle, i.e., the population19. There is an interplay between the network’s dynamics and the dynamics of the disease that determines the course of the disease20,21. For example, a variant that leads to more severe disease in the population causes more people to become more severely ill and for a longer duration22, thus changing the network’s dynamics as people are removed from the network for longer periods than is the case with other variants. Variants may also differ in their initial conditions. They may arrive at different stages of immunity or differ in their transmission opportunities6,12,23,24.

We consider competing variants under changing conditions of cross-immunity over two types of temporal networks: temporal random networks and real-life contacts, using our interaction-driven SEIR-like model for temporal networks8. The advantages of working with real-life temporal interactions are numerous, as human interactions are bursty, temporal, highly contextual and networked2,4,25,26,27,28. We model the competition between multiple variants on temporal networks while considering various cross-immunity dynamics.

Our surprising results are that slower variants continue to infect in the presence of faster (and even much faster) variants. When there is no cross-immunity, the slower variant creates a second wave and reinfects the population previously infected by the faster variant. We further determine, using a heatmap of total infection ratio between the variants under changing conditions of cross-immunity, the conditions under which a slow variant would be the dominant variant in a second phase and will infect the majority of the population.

We then proceed to model the competition between three variants in random temporal networks and real-world contact networks, with either full cross-immunity or no cross-immunity at all, with our SEIR-like interaction-driven model. We show that both networks provide similar results for the competition under full cross-immunity when considering maximal infection probabilities. When there is no cross-immunity, the dynamics of all three variants are similar over the real-world network, with the faster variants, i.e., with a higher probability of infection, infecting a larger part of the population than the slower ones.

The competition dynamics differ substantially when the duration of the meetings is taken as a factor in the contagious process. When variants differ by the minimal time it takes them to infect, with faster variants taking less time to infect than slower variants, the competing conditions become more complex. The slowest variant dies out, leaving the two faster ones to compete. The fast variant dominates a larger part of the network and for a longer duration, followed by the second fastest variant, which creates a large second wave in which it infects at a faster rate than the rate at which that variant infected during the first wave.

Thus, we show here that when the duration of meetings is considered in the modeling of temporal networks, the spreading process of competing variants is substantially different.

Results

Race conditions between two variants with changing values of cross-immunity

We created a temporal random network with 10,000 time windows of 1000 nodes each using the RandomDynamicGraph (RDG) package8. A time window duration is denoted by \(\tau\), and consists of \(288 \times 5\text {-min}\) intervals. Two variants were determined, a slow variant, and a fast variant, s.t.

$$\begin{aligned} P_{\mathrm{max}}^{\mathrm{fast}} = 1.2 \cdot P_{\mathrm{max}}^{\mathrm{slow}} \end{aligned}$$

where \(P_{\mathrm{max}}^{\mathrm{fast}},P_{\mathrm{max}}^{\mathrm{slow}}\) are the probabilities of being infected in maximum exposure to the fast (or slow) variant, as defined in Eq. (1). The values were chosen to allow for competition conditions. Both variants begin simultaneously with a randomly chosen patient zero in the first time window. Each experiment was repeated 200 times. We use our SEIR-like model. Figure 1 describes the results of our first experiment. Here, we examine the competition under various immunity conditions. In Fig. 1a we can see that when there is full cross-immunity, the faster variant infects the majority of the population, while the slower one obtains much less. Both variants plateau at the same time. This changes when a breakthrough infection is possible with the faster variant, as can be seen in Fig. 1b. Here, the slower variant infects a small portion of the population, who, once recovered, infected again with the faster variant. When the breakthrough probability is from the faster variant to the slower one, i.e., cross-immunity only from the slow variant to the fast one, we can see in Fig. 1c that the fast variant saturates when it infects around 60% of the population. Then the slower variant takes over and infects the vast majority of the population, infecting close to 90% of the population. In Fig. 1d we see that when both variants can reinfect, most of the population would first be infected by the fast variant but then, after recovery, would also be infected with the slower one.

Figure 1
figure 1

The aggregated percentage of infections in the population for each of the variants under (a) full cross-immunity (no reinfection in either), (b) recovery from the slower variant does not provide immunity to the faster variant, (c) recovery from the faster variant does not provide immunity to the slower variant, (d) no immunity to either.

Figure 2
figure 2

A heatmap of the total infection ratio between the fast and the slow variants under changing conditions of cross-immunity. Immunity between the variants changes from no immunity to full immunity, that is \(\{\chi _{\mathrm{fast} \rightarrow \text {slow}}, \chi _{\mathrm{slow} \rightarrow \text {fast}}\} \in [0,0.05, \ldots 1]\). In the heatmap, low values (denoted in red) correspond to the slow variant infecting the majority of the population, high values (blue) to the faster variant infecting the majority.

We continue to evaluate the infection probability of each of the variants, slower and faster, under changing conditions of cross-immunity. Figure 2 depicts the total infection ratio between the fast and the slower variants. Let us term the fast variant as f and the slow variant s. The cross-immunity probability was changed in steps of 0.05 from zero to one for each of the variants (\(\{\chi _{{f} \rightarrow {s}}, \chi _{{s} \rightarrow {f}}\} \in [0,0.05, \ldots 1]\)). Each of these combinations was iterated 30 times, to a total of 12,000 iterations for the heatmap. The results were normalized to the range \([-1,1]\). The heatmap shows that in the majority of the cases, the fast variant is the dominant variant, and the ratio is more on the blue scale. When there is no cross-immunity between the variants, i.e., a person can be reinfected with a variant after recovering from the other, both variants manage to reinfect the entire population. This corresponds to the upper left corner of the heatmap. In Fig. 1d we see the aggregated infection in the population per variant with \(\chi _{{f} \rightarrow {s}} =\chi _{{s} \rightarrow {f}} = 0\). Both variants infect the population at a different rate. When the faster variant saturates, the slower variant reinfects those that recovered from the fast variant in a second wave. Thus, the fast variant infects the population in a first wave, and the slower variant, infecting some of the population initially, infects the rest in a second wave. From Fig. 2 we see that this scenario describes the area in which \(\chi _{{f} \rightarrow {s}} \le 0.4\) and \(\chi _{{s} \rightarrow {f}} \le 0.3\).

However, interestingly, the slow variant dominates the population, and the ratio calculated in the heatmap (the red zone in the upper right corner of the heatmap in Fig. 2) greatly favors the slow strain, when infection with the slower variant results in immunity to the faster one but not vice-versa. In our experiments, the conditions are that \(\chi _{{s} \rightarrow {f}} \ge 0.5\) and \(\chi _{{f} \rightarrow {s}} \le 0.4\).

Conditions that allow competition

It is then left to see under which conditions a slower variant can create a second wave of infection.

Figure 3
figure 3

Determining competition conditions: The aggregated infection rate of each variant over a temporal random network. Left panel: two variants with the same infection probability. Right panel: the blue variant is ten times more infectious.

Figure 3 shows the aggregated percentage of infections in a population for two competing variants. The left panel depicts two similar variants. Both variants advance at the same rate and can reinfect the population recovered from the competing variant. The right panel shows two variants, with the faster one ten times more contagious than the slower one. The fast variant infects all of the population rapidly. Interestingly, the much slower variant does not die out and keeps infecting at a low rate, creating a second wave in which it slowly reinfects the population that has recovered from the fast variant. We find that when reinfection with the competing variant is possible, slower variants can create a second wave of infection.

Figure 4
figure 4

Competition between variants with no cross-immunity. Left panel: similar variants. Middle panel: faster variant is 1.1 times more probable to infect. Right panel: faster variant is 1.2 times more probable to infect.

Figure 4 depicts the competition between variants with no cross-immunity for variants that are either similar (on the left panel) or differ in their probability of infection. In the middle panel, the variant is 1.1 times more likely to infect, and in the right panel, 1.2 times. We then chose the competing conditions such that the faster variant is 1.2 times more probable to infect than the slower one. This allows for a faster and a slower variant.

Three competing variants

We continue to model the spreading of three competing variants in temporal random networks. Our modeling and considerations in Eq. (2) allow for multiple variants. We then examine the competing spreading patterns under our SEIR-like model with either full cross-immunity or no cross-immunity between the variants. In the first case, infecting in any of the variants gives immunity to the other two, and in the latter, getting infected with one of the variants enables reinfection with the others. Figure 5 shows the results of our experiment. In Fig. 5a and c we see the number of daily infections and the aggregated infections in the populations when there is full cross-immunity. The faster variant competes with both slower variants and infects less than 60% of the population. The dynamics in the case of no-cross immunity, depicted in Fig. 5b and d, are very different. In the first wave, the variants infect at rates corresponding to their infection probability. However, once the first wave is done, the fast variant drops to the infection rate of the medium speed variant, which then ramps up and reinfects faster than before. Interestingly, the slowest variant also increases its infection rate during this second wave and maintains similar dynamics to the medium variant. When there is no cross-immunity between variants, competing dynamics are more complex.

Figure 5
figure 5

Three competing variants over temporal random network. Left panels correspond to full cross-immunity conditions, right panels to no cross-immunity.

Real-world networks with three competing variants

Figure 6
figure 6

Three competing variants over real-world contact network. Left panels correspond to full cross-immunity, right panels correspond to no cross-immunity. In panels (a) and (b) we consider different infection probabilities for the variants, but do not consider the duration of the meetings. In panels (c)–(e) we consider the duration of the encounters. (c) and (d) depict the rate of the infection for variants that differ in the minimal time for infection. (e) and (f) Show the rate of infection for variants that differ both in the minimal time for infection and infection probability.

We continue to evaluate the competition conditions of three different variants over the real-world temporal Copenhagen Networks Study (CNS) network9,29, described in the “Methods” Section. We model the competing variants as follows.

A.:

Variants differ by the maximal probability of getting infected, as in the previous experiments. The variants were considered s.t.

$$\begin{aligned} P_{\mathrm{max}}^{\mathrm{fast}} = 1.2 \cdot P_{\mathrm{max}}^{\mathrm{medium}} =1.2 \cdot P_{\mathrm{max}}^{\mathrm{slow}} \end{aligned}$$
B.:

The minimal duration of exposure necessary for infection, \(D_{\mathrm{min}}\), differs between variants, s.t.

$$\begin{aligned} D_{\mathrm{min}}^{\mathrm{fast}} < D_{\mathrm{min}}^{\mathrm{slow}} \end{aligned}$$

Here,

$$\begin{aligned} D_{\mathrm{min}}^{\mathrm{fast}} = 5, D_{\mathrm{min}}^{\mathrm{medium}} = 30, D_{\mathrm{min}}^{\mathrm{slow}} = 55 \end{aligned}$$

As determined in the “Methods” Section there is a normalizing value \(D_{\mathrm{max}}\) such that \(D_{\mathrm{min}}/D_{\mathrm{max}}\) is the relative portion of \(P_{\mathrm{max}}\) to be used. However, in this experiment,

$$\begin{aligned} P_{\mathrm{max}}^{\mathrm{fast}} = P_{\mathrm{max}}^{\mathrm{medium}} =P_{\mathrm{max}}^{\mathrm{slow}} \end{aligned}$$
C.:

Variants differ by both maximal probability of getting infected and minimum duration of encounter needed for infection. That is:

$$\begin{aligned} D_{\mathrm{min}}^{\mathrm{fast}} = 5, D_{\mathrm{min}}^{\mathrm{medium}} = 30, D_{\mathrm{min}}^{\mathrm{slow}} = 55 \end{aligned}$$

and

$$\begin{aligned} P_{\mathrm{max}}^{\mathrm{fast}} = 1.1\cdot P_{\mathrm{max}}^{\mathrm{medium}} = 1.2 \cdot P_{\mathrm{max}}^{\mathrm{slow}} \end{aligned}$$

Also in this experiment there is a normalizing value \(D_{\mathrm{max}}\) such that \(D_{\mathrm{min}}/D_{\mathrm{max}}\) is the relative portion of \(P_{\mathrm{max}}\) to be used.

Each of the experiments A, B, C, was iterated 30 times with the real-world network using the encounter-driven modeling according to the conditions of the experiment described, with an initial patient zero randomly selected.

Figure 6 depicts the results of the above experiments. When the duration of the interactions is ignored, as in Fig. 6a and b, the dynamics resemble, to some extent, those that were observed over temporal random networks. However, the dynamics differ significantly when meetings’ duration is taken into account, considering that variants differ by the minimal amount of time needed for infection, as in Fig. 6c–f. In all these cases, the slowest variant has much fewer opportunities to infect or reinfect, causing it to disappear and leaving the two faster variants to compete. When there is full cross-immunity, the medium variant, with fewer infection opportunities than the faster one, infects at a much lower rate. However, when there is no cross-immunity, the medium-rate pathogen can create a second wave and reinfect at a higher rate than it did on the first wave.

Our results here indicate that when considering airborne diseases, it might be crucial to consider the duration of temporal meetings to consider the spreading of variants in a population.

Discussion

Here, we presented the modeling of variants that compete over the same population with similar initial conditions over temporal networks. Previous works also considered two competing pathogens in a population. Karrer and Newman14 considered competition in similar conditions, but on an aggregated network with full cross-immunity, that is, getting one of the diseases gives a subsequent immunity to both. They found that the fast pathogen is more likely to dominate the network in the majority of the regions of the phase diagram. Recently, Okake and Shudo17 considered these conditions but with a lately arriving fast variant and found that the results depended on how much more infective is the added variant. They found no difference in the competition results when considering random or scale-free (BA) networks. Mann et al.16 showed that in this setting, clustering increases the spread of the second wave. Poletto et al.18 considered, like us, the competition under different levels of cross-immunity, however, in a mix-homogeneous aggregated network. They found that variations in the cross-immunity level induce a transition between the presence and absence of competition. Okabe and Shudo17 found that under cross-immunity conditions, faster variants dominate. We complement this finding by showing the cross-immunity conditions under which the slower variant has a second wave. We find that when temporal paths are considered, competition conditions exist for two and three competing pathogens, and when there is no cross-immunity, there is a second wave.

This result can be considered somewhat similar to the results in30, who considered competition between Colonizers, i.e., fast-spreading virulent strains and less-virulent variants that are more successful within co-infected cells. They observed a two-step dynamics of the population. Early in the infection, the population is dominated by colonizers, which later are outcompeted by competitors. We show that under certain not unlikely conditions, a slow variant might be able to wait until the fast variant has run its course and then infect the majority of the population, given there is no cross-immunity or the cross-immunity is in favor of the slower strain.

However, the competing dynamics become significantly more complex when the duration of the interactions is considered. SARS-CoV-2 variants differ in their time-to-infect6,12,23,24. When we considered the duration of the interactions, the dynamics changed substantially. It is then clear that when considering airborne spreading processes, it is critical to consider the temporal ordering and the duration of the encounters. Interactions shorter than the minimal time of infection are less likely to mediate the disease, changing the progression paths.

In summary, we model and explore competing variants using an interaction-driven model over random and real-world temporal networks. We determine the conditions of partial cross-immunity that create a second wave in which a slower variant dominates the population. Using real-world contact data, we then show that the duration of the encounters is a fundamental modeling construct that has a significant effect on the progress of the disease and the competing dynamics of the variants.

Methods

A temporal interaction-driven contagion model for a single variant over temporal random networks

We explain here our model, as detailed in8. We start by modeling the spread of a single variant on a temporal network. Let G(n,p,\(\tau\)) denote a temporal random network, where \(\tau\) corresponds to any single time window in it. During each time window \(\tau\) we calculate for each node i its probability \(P_i(S \rightarrow E)\) to be exposed and infected during this time window as the complement of probability of not being exposed to the disease in any of its encounters with infectious nodes in that time window.

$$\begin{aligned} P_i^{\tau }(S \rightarrow E)= 1-\prod ^{N_i^\tau }(1- P_{\mathrm{max}}) \end{aligned}$$
(1)

where \(N_i^\tau\) is the subset of infected nodes in time window \(\tau\) that interacted with node i during that time window and thus might potentially expose it to the infection, and \(P_{\mathrm{max}}\) is the probability of being infected during a maximal exposure (For example, even on relatively isolated, dense sites such as the Princess Diamond ship during the first wave of the COVID-19 pandemia, and with an air conditioning system that might well have distributed the virus to multiple cabins, not more than 20% of the passengers and personnel were infected. In other such cases, the maximal infection probability seemed to lie anywhere between 20 and 60%).

Figure 7
figure 7

The state machine for each node in our interaction-driven SEIR-like contagion model for random temporal networks. The transition from state S to state E is determined at the end of each time window \(\tau\).

The SEIR-like interaction-driven model, depicted in Fig. 7 is as follows. All nodes are initially in the Susceptible (S) state. To start the iterative computation, we also assume that a small random number of nodes in the initial time window become infectious (i.e., a small number of “Patients Zero”). Susceptible nodes (state S) that become exposed according to Eq. (1) enter the state Exposed (E) at the end of the time window \(\tau\) during which they were exposed to infectious nodes. Nodes in state Exposed become Infected after a delay that corresponds to \(d_{E \rightarrow I}\), where \(d_{E \rightarrow I} \sim \tau \cdot N(5,1)\). Infected nodes (state I) stay infectious for \(d_{I \rightarrow R}\), where \(d_{I \rightarrow R} \sim \tau \cdot N(10,1)\). After this delay, they enter the state Recovered (R) and are no longer infectious. The chosen numbers represent days and are inspired by some of the COVID-19 variants31.

Temporal random networks follow the algorithm suggested by Zhang et al.7. Their algorithm builds a temporal random network with changing dynamics that follow a Markov process, allowing for continuous-time network histories, \(G_{n,p,\tau }\) such that \(E(G_{n,p,\tau }) \sim G_{n,p}\).

Defining \(\lambda =\) probability per time granule of a new edge to appear and \(\mu =\) probability per time granule of an existing edge to disappear, Zhang et al.7 show that the equilibrium probability of an edge is \(p=\frac{\lambda }{\lambda +\mu }\).

Our implementation, a Python package that we refer to as RandomDynamicGraph (RDG), (https://github.com/ScanLab-ossi/DynamicRandomGraphs) described in8, generates large-scale dynamic random graphs according to a defined density. We chose \(\lambda , \mu\) in a manner that allows for a stationary density for all \(G_{n,p,\tau }\), where \(\tau \in [1..10000]\) and \(n=1000\). To ensure that no anomalies in one graph created an unusual effect, we used a mix of randomly generated graphs. We then conducted a Two-sample Kolmogorov–Smirnov test on each pair of graphs and determined that for each couple, we cannot reject the null hypothesis that both were drawn from the same probability distribution, with 95% significance32.

Modeling multiple concurrent infections

We model the various variants by a per-variant probability, denoting the maximal global probability of being infected by the variant, \(P_{\mathrm{max}}^j\), where j denotes the variant. Hence, a more contagious variant would correspond to a higher \(P_{\mathrm{max}}\). Thus, given variants jk, then, without loss of generality, if variant j is more contagious than variant k, then \(P_{\mathrm{max}}^{j} > P_{\mathrm{max}}^{k}\).

We model here the probability to be infected during a day when m variants exist in the network, as follows. Let \(P^{k}_i(S \rightarrow E)\) be the probability of node i to be exposed during some given time window to variant \(k, k \in [1..m]\). \(P^{k}_i(S \rightarrow E)\) is calculated as is defined in Eq. (1). Then, we calculate the probability of node i to not be exposed to any of the m variants during that time window, \(P_i(S \rightarrow S)\) using the inclusion-exclusion principle. Given that for any k, \(P^{k}_i(S \rightarrow E)\) is independent, i.e., each viral strain is operating independently of other strains, the probability of not getting infected with any variant is as follows. Let \(E^{i}_j\) be the event of node i being exposed by the end of the day to variant j, the probability that node i was not exposed to any variant at the end of the day, is computed as follows:

$$\begin{aligned} P_i(S \rightarrow S) = 1 - \sum _{k=1}^m \left( (-1)^{k+1} \sum _{1 \le \cdots < k \le m} \mid E^i_{1} \cap \cdots \cap E^i_{k} \mid \right) \end{aligned}$$
(2)

For example, for two variants jk, we calculate the probability of node i not being exposed to any of them during that day as follows, thus determining the probability of being infected in any of them.

$$\begin{aligned} P_i(S \rightarrow S) = 1 - (P_{{ exposed}}^{j} + P_{{ exposed}}^{k} - P_{{ exposed}}^{j} \cdot P_{{ exposed}}^{k}) \end{aligned}$$

Given that we determined that node i was exposed, we make a statistical choice of the variant according to the relative probabilities.

Variants cross-immunity probability

Each variant has a cross-immunity probability \(\chi _{j \rightarrow k}\), denoting the probability of a person that is recovering from variant j to be immune to variant k. Hence, \(1-\chi _{j \rightarrow k}\) is the breakthrough probability of people recovering from variant j to get infected by variant k. \(\chi _{j \rightarrow k} \in [0,1]\).

Modeling variants competition over real-life encounters

Real-world encounters data was collected in the Copenhagen Networks Study (CNS)9,29. It contains the proximity information of over 700 students for 28 days. We model the CNS social network of interactions \(\Gamma\) as a sequence of T consecutive undirected weighted temporal graphs \(\{G_\tau \in \Gamma , \tau \in T\}\) where each temporal snapshot graph \(G_\tau =(V_\tau ,E_\tau )\) denotes the subset of interacting nodes \(V_\tau\) during the \(\tau\) temporal window and the weighted edges \(E_\tau\) the interactions during this time. Further, we use the network with half-density, i.e., each real day is split into two days. This is done since the original proximity network is very dense8,33.

The CNS data contains meetings’ duration information, allowing for an additional method of modeling the variants. In this method, a variant takes a minimal amount of time to infect, termed \(D_{\mathrm{min}}\), such that \(D_{\mathrm{min}}^{\mathrm{fast}} < D_{\mathrm{min}}^{\mathrm{slow}}\). There is a normalizing value \(D_{\mathrm{max}}\) such that \(D_{\mathrm{min}}/D_{\mathrm{max}}\) is the relative portion of \(P_{\mathrm{max}}\) to be used. The contagious part of the interaction-driven model is then defined by the complement of the probability of not being infected by any of the encounters that are longer than \(D_{\mathrm{min}}\) of that variant in a day8.