Introduction

Contagion dynamics are ubiquitous in biological and social systems. They can encompass the spread of disease1,2, rumors3,4,5, behaviors6,7, or information8,9. These different types of phenomena are often modeled using generic descriptions that were developed to represent infection spreading and epidemic outbreaks, in which individuals can be in a susceptible, infectious, or recovered state. In these models, the contagion typically propagates through an interaction network that plays a decisive role in the spreading dynamics. In more realistic scenarios, the interactions are time-dependent and determined by a proximity network that changes as a function of the positions of the individuals. In cases where these agents follow complex collective dynamics, the changing topology can depend in turn on their self-organized motion. To improve our modeling of real-world systems, it is therefore important to understand the relationship between the emergence of large-scale contagion processes and the evolving interaction networks that develop between agents that display collective behavior10.

In spatially explicit models of mobile agents, in contrast to the idealized mean-field or network models, the potential contagion interactions are determined by a switching proximity network that changes in time as the individuals follow a specific set of spatial dynamical rules11. The core parameters of a typical mean-field SIR-contagion process, such as the contact rate and contact duration, then become emergent features of the self-organized spatial dynamics, as it has been shown for gas-like systems of self-propelled active Brownian particles12,13,14,15. The properties of the spatial dynamics, such as the speed of the individual agents, can thus affect in nontrivial ways the global contagion process14. These previously studied examples, however, only considered the cases where the agents or particles do not form spatial structures, displaying instead homogeneous density and isotropic orientations, in contrast to what is known to occur in many models of self-propelled agents and in real-world systems. In particular, in models where spatial interactions such as velocity alignment forces between neighboring agents are introduced, we expect the formation of states that display long-range order leading to coordinated collective movement at the scale of the system and a variety of slowly-evolving, long-lived spatial structures, such as large-scale, high density bands or clusters16,17,18,19, which results in dynamical irreversibility of the system’s behavior20. To properly describe the contagion process, we must therefore consider the various degrees of mixing and density distributions exhibited by different self-organized collective movement states.

In this work, we implement a susceptible–infectious–recovered (SIR) infection process2,21 in a system of self-propelled agents with alignment and repulsion interactions to explore the impact of self-organized spatio-temporal structures on the contagion dynamics. Our results show that the epidemic outcome depends strongly on the specific emergent properties of each collective state. We observe that the outbreak thresholds are significantly lower in ordered states with large-scale clusters or band-like structures, and higher in ordered or disordered states with homogeneous density distributions. By comparing the contagion dynamics of different states, we find that the timescales of the emerging spatial structures and of the infection processes play an essential role in the epidemic outcome.

Results

We consider contagion dynamics in a system of self-propelled particles (agents). Individual particles are performing active Brownian motion, advancing with a constant self-propulsion speed \(v_0\) while the heading angle \(\theta _i\) is subject to noise of intensity \(\sigma\). Neighboring particles interact through short-ranged alignment forces, that facilitate the emergence of collective movement, and through distance-dependent repulsive forces. The strength of the alignment force is set by the inverse alignment relaxation time \(\tau ^{-1}\). For simplicity, we assume that both interactions have the same range \(\mathrm {r_{int}}\), so that two particles i and j interact (are in “contact”) when their distance \(|{\vec{r}}_{ij}|=|{\vec{r}}_i-{\vec{r}}_j|\) is smaller than \(\text {r}_{int}\).

In addition to the spatial dynamics, we implement a simple contagion process that does not affect the agent motion, which corresponds to the standard SIR model in epidemiology. Each agent i can be in one of three states: susceptible (\(s_i(t)=S\)), infected (\(s_i(t)=I\)), or recovered (\(s_i(t)=R\)). A susceptible agent i can only become infected, with a base transmission rate \(\beta _b\), while it is in contact with at least one infected agent j. An infected agent recovers spontaneously with a recovery rate \(\gamma\). Recovered agents cannot be reinfected. A detailed description of the full model is given in the “Methods” section.

The active Brownian particle model with interactions exhibits a rich phase diagram of different collective movement states as a function of two dimensionless parameters18,20,22: the Peclet number Pe, quantifying the persistence of individual movement, and the dimensionless interaction strength g, quantifying the relative strength of alignment versus noise. The different collective states can be quantified by the degree of orientational order \(\Phi\), typically referred to as polarization, and by the degree of clustering \(\Lambda\). Detailed definitions of all these variables are provided in “Methods” section, whereas a detailed analysis of the different self-organized collective movement states has been recently presented by the authors22.

Figure 1
figure 1

Spatial collective states of systems of self-propelled agents with alignment and repulsion. Top: Phase diagram as a function of Peclet number Pe and alignment strength g, showing the fraction of agents in the largest cluster \(\Lambda\) (a) and the polarization \(\Phi\) (b). Bottom: Representative snapshots of the states labeled in panel (a). Disordered (Pe,g) = (32,1) (c); ordered with bands OB (Pe,g) = (32,2) (d); ordered homogeneous OH-1 (Pe,g) = (512,16) (e); ordered with clusters OC (Pe,g) = (32,128) (f); and a different ordered homogeneous state OH-2 (Pe,g) = (32,1024) (g). Each agent is colored by its heading angle, according to the color disk (top-left inset).

We begin by presenting in Fig. 1 the phase space of the spatial dynamics. Panels (a,b) display the values of the clustering \(\Lambda\) and polarization \(\Phi\) for each parameter combination. Following our previous work22, we identify five different regions with distinct values of \(\Lambda\) and \(\Phi\), represented by the characteristic states labeled from (c–g) in panel (a). A snapshot of each corresponding state is presented in panels (c–g), where each particle is represented by a point that is colored according to its heading directions, as indicated by the color disk in the top-left corner. Panel (c) shows a typical snapshot of the disordered states found in the low \(\Phi\) and low \(\Lambda\) region of the phase diagram, where there is no orientational order and the particles are homogeneously distributed in space. Panels (d,f) display the ordered state with bands (OB) and ordered state with clusters (OC), respectively. Both have high \(\Phi\) and \(\Lambda\) values, but OB states form large density bands that are perpendicular to the heading direction, whereas OC states exhibit clusters that are elongated along the heading direction. Finally, panels (e,g) show two different ordered homogeneous states (OH-1 and OH-2), both of which are characterized by high \(\Phi\) and low \(\Lambda\) values.

Figure 2
figure 2

Effectiveness of the epidemic outbreak as a function of the Peclet number Pe and alignment strength g for different values of the infection-lifetime transmissibility \(\Theta =\beta _b/\gamma\) and the mean agent infection duration \(\mathrm {T_{inf}} =1/\gamma\). The colors represent the fraction of agents \(\rho _R(\infty )\) that recovered from the infected state at the end of each run, averaged over 50 simulations. The red isolines highlight the regions with high relative infection levels. We observe that the contagion tends to be more effective in the inhomogeneous regions of the phase space, shown on Fig. 1, and that it covers a larger fraction of the phase space for higher \(\Theta\) or \(\mathrm {T_{inf}}\) values.

We now examine the effectiveness of the contagion process in different regions of the phase diagram, for various values of the contagion parameters, by computing the fraction of agents that were infected at some point of the epidemic process, which is equal to the final fraction of recovered agents. The infection spreading will depend on the rate and duration of the contacts between infected and susceptible agents that result from the spatial dynamics, and on the SIR model parameters \(\beta _b\) and \(\gamma\). We will express the latter in terms of two quantities that determine the effective contagion rate between susceptible interacting agents: the infection-lifetime transmissibility \(\Theta =\beta _b/\gamma\) (a nondimensional number that describes the average total transmission during the infectious period of an agent) and the mean duration of the infectious period of an agent \(\mathrm {T_{inf}} =1/\gamma\). The interplay between these quantities and the spatial dynamics determines the effective infection spread.

Note that there are two limit cases of the spatial dynamics where the final epidemic outcome will only depend on \(\Theta\), and not on \(\mathrm {T_{inf}}\): The well-mixed (mean-field) case, where agents are continuously exchanging neighbors, and the static interaction network case (if agents are close enough to form a connected graph), where the neighbors remain fixed. In both situations, the newly infected agents are continuously interacting with other agents that are potentially susceptible, so the duration \(\mathrm {T_{inf}}\) of their infectious state will not affect the outcome. Even in these limits, however, the contagion process before reaching this final outcome will also depend on \(\mathrm {T_{inf}}\) and on the spatial dynamics of the system, which will affect its timescale13,14,15. In more realistic cases where the interactions are determined by complex temporal networks23 or spatiotemporal dynamics, as in the model considered here, both the epidemic outcome and the contagion process will generally depend on all parameters.

Contagion effectiveness

Figure 2 presents the effectiveness of the epidemic outbreak in different regions of the phase space for five combinations of the infection parameters. The final fraction of recovered agents \(\rho _R(\infty )\) is displayed as a function of Pe and g, for three \(\Theta\) values with fixed \(\mathrm {T_{inf}}=20\) (top) and for three \(\mathrm {T_{inf}}\) values with fixed \(\Theta =2.0\) (bottom). Note that we repeat the same central panel in the top and bottom rows, for completeness. We find that, in general, the regions with highest degree of contagion tend to match the regions with highest clustering in Fig. 1a, and that they grow as \(\Theta\) or \(\mathrm {T_{inf}}\) are increased.

The central panels shows that, for an intermediate \(\Theta =2.0\) value, the region with high epidemic spreading matches almost exactly the high clustering regions OB and OC in Fig. 1, although some simulations with relatively high level of contagion can also be found in the disordered region. The top right panel shows that, for a very high \(\Theta =100\), almost the whole phase space displays high levels of epidemic spreading, with the homogeneously ordered (OH) regions presenting the lowest levels. The bottom row shows that we obtain equivalent results if we instead vary \(\mathrm {T_{inf}}\), but with larger \(\rho _R(\infty )\) differences between the regions with high and low epidemic spreading.

Figure 3
figure 3

Effectiveness of the epidemic outbreak as a function of the contagion parameters for the five collective states identified in Fig. 1: Disordered (D), ordered with bands (OB), ordered with clusters (OC), and two ordered homogeneous states (OH-1 and OH-2). Each panel presents the fraction of agents that were infected and later recovered during the epidemic outbreak \(\rho _R(\infty )\) as a function of either the infection-lifetime transmissibility \(\Theta =\beta _b/\gamma\) with fixed \(\mathrm {T_{inf}}=20\) (a) or of the mean agent infection duration \(\mathrm {T_{inf}} =1/\gamma\) with fixed \(\Theta =2\) (b). Each point shows the mean \(\rho _R(\infty )\) value for 50 simulations and the error bars, its standard deviation.

Figure 3 provides a more detailed view of the effectiveness of each epidemic outbreak and its onset points, plotting \(\rho _R(\infty )\) as a function of \(\Theta\) and \(\mathrm {T_{inf}}\) for the five collective states identified in Fig. 1. Each point displays the mean value obtained for the 50 simulations performed per parameter combination and the error bar shows the corresponding standard deviation.

Panel (a) confirms that outbreak onsets occur at the lowest \(\Theta \approx 0.5\) values in the inhomogeneous (OB, OC) states and at higher \(\Theta \approx 1\) values in the homogeneous disordered (D) and homogeneous ordered (OH-1, OH-2) states. The value of \(\rho _R(\infty )\) then increases with \(\Theta\) at a different rate for each case. At an intermediate \(\Theta \approx 10\), we find that the OB state has the highest mean \(\rho _R(\infty )\), followed closely by the OC and disordered states. For very large \(\Theta \gtrsim 200\), the disordered and OB states display the highest, very similar \(\rho _R(\infty ) \approx 0.8\) values, whereas the OC case seems to saturate at a slightly lower level. Instead, both OH states display a significantly lower level of epidemic spreading, with a fraction of recovered agents \(\rho _R(\infty ) \approx 0.3\) that is slightly higher for OH-1 than for OH-2.

Panel (b) shows that the outbreak onsets occur at very different \(\mathrm {T_{inf}}\) levels in the disordered, OH-1, and OH-2 states (order \(10^1\), \(10^2\), and \(10^3\), respectively). These three homogeneous states eventually reach high infection levels, but only for very high \(\mathrm {T_{inf}}\) values. This panel also shows that, in the \(\Theta =2\) case considered here, states OC and OB develop high levels of infection for all \(\mathrm {T_{inf}}\) values. Even at a very low \(\mathrm {T_{inf}}=10^{-2}\) we find that, remarkably, they still display significant outbreaks, with \(\rho _R(\infty ) \gtrsim 0.4\). In the opposite limit, for a very high \(\mathrm {T_{inf}}=10^{4}\), both converge to a similar state of full epidemic spreading, with \(\rho _{R}(\infty )\approx 1\).

Analysis of the contagion process in different collective states

The above results show that the infection parameters and the spatial dynamics both play an essential role in the contagion spread. In particular, we observe that complex self-organized states tend to result in higher levels of infection than the typically studied states with either well-mixed or static interactions. Furthermore, the specific nature of the spatial dynamics appears to play an essential role that cannot be captured by standard averaged network-based descriptions. In the following, we will analyze in detail the spreading process in the different identified collective regimes.

Disordered states

We begin with the simplest case, the homogeneous disordered state, in which all agents are continuously mixing with similar contact dynamics that do not change over time. The contagion process is the closest here to a mean-field SIR system, where the final epidemic spreading can be predicted if \(\mathrm {T_{inf}}\) is sufficiently large14. In this regime, agents remain infectious for long periods, while they mix with the whole system. This implies that initially localized infections will quickly produce outbreaks throughout the simulation arena, as shown in Fig. 4, We can thus estimate the fraction of infected agents at the end of the run by using semi-analytical mean-field calculation. We present these results in the Supplementary Information, obtained by extending the analyses performed in13,14,15 for a similar case that considered the SIS model and active Brownian particles. For a smaller values of \(\mathrm {T_{inf}}\), however, the mixing timescale can be comparatively too long for new susceptible agents to continue to be exposed to infected agents before they recover, since the front advances slower over time, and the infection will eventually die out. This can be overcome by increasing the spatial density of initially infected agents, as we also discuss in the Supplementary Information. In a scenario with a spatially homogeneous distribution of initial infections (or infection clusters), for example, we may observe a percolation-like merging of the different locally expanding fronts, which can result in almost the entire system being infected even for short \(\mathrm {T_{inf}}\) values.

Ordered homogeneous state

In the ordered homogeneous states, OH-1 and OH-2, the high level of polarization results in slow mixing and thus in a low mean contact rate between new neighbors. Therefore, sufficiently high \(\Theta\) and \(\mathrm {T_{inf}}\) values are both crucial for the contagion process to develop. For low \(\mathrm {T_{inf}}\), the interaction network will not experience significant changes before the infected individuals recover, and can thus be approximated by a static network. In this case, the epidemic spreading can be viewed as a percolation process on this network. For a low mean density, the sparse connectivity can therefore place the system below the percolation threshold, stopping contagion even for extremely high \(\Theta\) values, as shown in Fig. 3a. For higher \(\mathrm {T_{inf}}\), local velocity fluctuations will lead to the accumulation of contacts with different neighbors during this period, increasing the effective connectivity, given here by the time-averaged interaction network. This can result in higher epidemic spreading than in the disordered homogeneous state, as we can see in Fig. 3b. Note, however, that these fluctuations can also produce more mixing between susceptible and recovered agents at the infection propagation front, which would reduce the fraction of agents that are available for contagion at this interface and thus limit the epidemic growth. This effect has been observed in the literature24 for a system of particles moving in straight lines with random directions, where an optimal mixing speed that minimizes spreading was identified in a regime between quasi-static network percolation and high mixing. Although we did not detect this type of effect in our simulations, it could be present for other parameter combinations.

A more detailed inspection of the contagion process in the ordered homogeneous states shows that it develops spatial dynamics that cannot be described by simple percolation or mixing approximations. In particular, in this regime the agents are known to display superdiffusive displacements perpendicular to the mean heading25,26, which will result in a faster propagation of the infection along this direction. Starting from a localized outbreak, we thus observe the rapid initial formation of a band-like infected region perpendicular to the mean agent orientation, which is then advected by the mean flow, as shown in Fig. 5. This type of contagion process was identified in all our simulations of states OH-1 and OH-2; we expect it to also be present in any ordered homogeneous state of self-propelled particles with similar dynamics.

Figure 4
figure 4

Infection dynamics in a disordered homogeneous state. The greyscale lattice displays the smoothed local mean density of all agents within each square bin. Overlaid dots, colored from white to red, show the density of agents in state I (i.e., of infectious agents) only on bins where \(I>0\). The spatial dynamics corresponds to the disordered homogeneous state D presented in Fig. 1, with (Pe,g) = (32,1). The panels display the temporal evolution of a single infection process (with \(\mathrm {T_{inf}}=10^3\) and \(\Theta =2\)) started by 10 agents at the center of the arena. We observe that the initial localized outbreak can quickly infect agents anywhere in the system.

Figure 5
figure 5

Infection dynamics in an ordered homogeneous state, visualized as in Fig. 4. The spatial dynamics corresponds to the ordered homogeneous state OH-1 presented in Fig. 1, with (Pe,g) = (512,16), here advancing to the right as indicated by the white arrow. The panels display the temporal evolution of a single infection process (with \(\mathrm {T_{inf}}=10^3\) and \(\Theta =2\)) started by 10 agents at the center of the arena. We observe that the infection initially propagates forming a band perpendicular to the heading direction.

Although the two ordered homogeneous states seem to display a similar contagion process, the level of epidemic spreading is strongly conditioned by their specific spatial dynamics. Indeed, since OH-2 has a higher alignment strength g than OH-1, it will present a lower mean contact rate and longer typical contact duration22, which will result in a much smaller effective contagion rate. This explains its higher onset value (\(\mathrm {T_{inf}} \gtrsim 10^3\)) and the fact that, even for \(\mathrm {T_{inf}} = 10^4\), the effectiveness of the epidemic outbreak only reaches \(\rho _R(\infty ) \approx 0.5\) in Fig. 3b.

The details of the infection dynamics of the two ordered homogeneous states also appear to be different, as shown in the simulation videos in the Supplementary Material (OH-1.mp4, OH-2.mp4). The outbreaks in state OH-1 typically develop approximately homogeneously throughout the simulation arena. By contrast, the outbreaks in state OH-2 appear to develop mainly inside large clusters that emerge sporadically during the simulations and survive for relatively short periods of time, spreading less effectively outside of them. We note, however, that we only studied the OH-2 outbreaks for \(\mathrm {T_{inf}}=10^4\), where they become more prevalent. We did not explore the asymptotic behavior in this state for larger \(\mathrm {T_{inf}} \gg 10^4\) because this would require extremely long simulations that go beyond the scope of this work, given that the time needed to reach a final infection state grows with \(\mathrm {T_{inf}}\) and that the dynamics for high coupling strengths can only be resolved with very small timesteps. Finally, we point out that the differences in the contagion processes of OH-1 and OH-2 are expected to disappear for large \(\mathrm {T_{inf}}\rightarrow \infty\), since the infection timescales will become so long that the spatial dynamics will effectively result in well-mixed systems over comparatively short timescales, and can thus be averaged over time.

Ordered band state

In the ordered states with bands, or OB states, the system can be divided into two regions: the high density, high polarization regions within the bands, and the low density, low polarization, gas-like regions outside of the bands. The infections that develop outside the bands will thus take place in regions that are similar to the disordered states and have lower density than the system average. Therefore, for the contagion to spread in this region, \(\Theta\) and \(\mathrm {T_{inf}}\) must be higher than the corresponding epidemic thresholds in the disordered state, since lower density implies less interactions between infected and susceptible agents. Otherwise, we find in simulations that the infection will die out quickly, unless it is transmitted to a band. Instead, the infections that develop within the bands take place in regions with higher local density and polarization. Agents will have more interactions that last longer while the combination of high density and repulsion will inhibit mixing, so the contagion process will be predominantly driven by percolation. Our simulations show that the successful propagation of infection within the bands requires a significantly lower \(\Theta\) and \(\mathrm {T_{inf}}\), as we can see in the left side of the OB curve in Fig. 3b.

Figure 6
figure 6

Infection dynamics in an ordered band state, visualized as in Fig. 4. The spatial dynamics corresponds to the ordered band state OB presented in Fig. 1, with (Pe,g) = (32,2), here advancing to the right as indicated by the white arrow. The panels display the temporal evolution of a single infection process (with \(\mathrm {T_{inf}}=10^3\) and \(\Theta =2\)) started by 10 agents within the band. We observe that the infection spreads first within the band, and then outside of the band.

Figure 7
figure 7

Infection dynamics in an ordered clustered state, visualized as in Fig. 4. The spatial dynamics corresponds to the ordered clustered state OC presented in Fig. 1, with (Pe,g) = (32,128), here advancing to the right as indicated by the white arrow. The panels display the temporal evolution of a single infection process (with \(\mathrm {T_{inf}}=10^3\) and \(\Theta =2\)) started by 10 agents within a cluster. We observe that the infection initially spreads within the cluster, slowly but robustly, and then reaches other clusters through their fission-fusion dynamics.

In this context, in the OB states a contagion spreading process that starts within a band will typically develop as visualized in Fig. 6 and can be described as follows. The initial infections within the bands will propagate more efficiently, due to their higher local densities. Once a significant fraction of a band is infected, given that bands advance faster than the mean agent velocity between bands due to their higher polarization, it will develop a contagion process that can span the system by sweeping through the arena, reaching the susceptible agents in the gas-like state outside the band. Therefore, the epidemic spreading is initially controlled by \(\Theta\), which needs to be high enough to grow the infection within a band, and later by \(\mathrm {T_{inf}}\), which will determine the level of contagion outside the band when compared to the time required for the band to swipe the system.

Ordered clustered state

The ordered clustered states, or OC states, typically contain one or more large polarized clusters that are elongated along their heading direction, surrounded by lower density regions. An example of an infection process observed in one of these states is displayed in Fig. 7. As in the OB states, the contagion develops differently inside and outside of these clusters. In contrast to the OB states, however, the low density regions outside of the clusters have relatively high levels of polarization, albeit smaller than within clusters. The contagion dynamics outside the clusters is thus similar to the percolation process in the homogeneous ordered states, but will require higher \(\Theta\) and \(\mathrm {T_{inf}}\) values to propagate successfully, due to the lower density. Otherwise, our simulations show that any infection that starts outside the clusters will die out quickly, unless it spreads into a cluster. We also observe that, in cases where contagion does develop outside of the clusters, the infection spreads faster perpendicular to the heading direction, as in the OH states. Inside the clusters, the contagion spreads primarily through percolation on a quasistatic network, because of the weak local mixing. The densities are higher within these regions than in the homogeneous ordered states or inside the bands in the OB states, so the infection process is very effective and requires the lowest \(\Theta\) and \(\mathrm {T_{inf}}\) values to spread. This explains the low \(\Theta\) and \(\mathrm {T_{inf}}\) behavior of the OC state in Fig. 3. However, the epidemic spread inside the clusters is significantly slower than within bands, as we can see by comparing the temporal dynamics of Figs. 6 and 7. This can be explained by the fact that particles exhibit much stronger diffusion within bands than inside clusters, especially perpendicular to the movement direction.

After a cluster gets infected in an OC state, the contagion process to other regions can be quite complex, as it involves two mechanisms. On the one hand, clusters do not frequently interact with new off-cluster agents or with other clusters, since all the particles in the system are approximately aligned. This implies that, for low or intermediate \(\mathrm {T_{inf}}\), the infection inside a cluster may never spread outside. On the other hand, clusters exhibit rich fission-fusion dynamics at long timescales, through which an infected cluster that disaggregates can infect other clusters, if its resulting fragments aggregate into them, as shown in a simulation video in the Supplementary Material (OC-2.mp4). As a result, although the infection within a cluster can be very effective even for low \(\Theta\) and \(\mathrm {T_{inf}}\), its spreading to the rest of the system depends on the balance between these two processes that develops in each realization of the spatial dynamics. It is this lack of a reliable mechanism for spreading the infection throughout the system that makes the OC states reach a slightly lower \(\rho _R(\infty )\) level than the disordered and OB states for intermediate and high \(\Theta\) and \(\mathrm {T_{inf}}\) values in Figs. 2 and 3.

Discussion and conclusions

In this work, we investigated a simple SIR epidemic process in a system of self-propelled agents with alignment interactions. We showed that the contagion dynamics and the overall outbreak magnitude depend strongly on the spatiotemporal collective states. In particular, we found that effective infection spreading can be favored by self-organization. Our analyses followed a minimal modeling approach to show potential generic connections between emergent spatiotemporal dynamics and the spreading of epidemics that could have strong impact on a variety of real-world scenarios. Although our results were mainly expressed in terms of epidemic spreading, we note that they can also describe other processes, such as the propagation of different types of information within groups of agents. We note that self-organized spatial structures may appear due to different mechanisms. A prominent example is the emergence of dense stationary clusters for active Brownian particles with repulsion but without alignment interactions due to motility induced phase separation (MIPS)20,27. However, the temporal dynamics of such disordered, non-moving MIPS clusters is fundamentally different to the dynamical, moving structures formed by self-propelled particles with alignment interactions studied here.

The analyses carried out above can be summarized in terms of general contagion processes that develop on evolving networks. From this perspective, the emerging spatial structures (bands, clusters, and homogeneous fluid or gas states) correspond to different evolving contact networks. The resulting contagion spread is determined by the dynamics within these structures and by the interactions between them. On the one hand, the infection process is affected by the self-organized rewiring dynamics inside the corresponding sub-networks, which is driven by underlying processes such as (active) diffusion, convection, and density fluctuations. It may therefore exhibit very different \(\Theta\) and \(\mathrm {T_{inf}}\) dependencies, as well as rich phenomena, such as asymmetric spread in the form of a “contagion band” in ordered homogeneous states. On the other hand, the self-organized contact dynamics between different spatial structures or sub-networks, such as fission–fusion processes that develop between clusters, plays a decisive role in determining large-scale contagion, thus introducing additional (long) time-scales that can lead to highly non-trivial spreading processes. This situation changes only in the limit of very long infection duration \(\mathrm {T_{inf}}\), where all the timescales of the spatial dynamics become negligible, which results in an effective contagion process that is equivalent to the well-mixed case.

Revealing the impact of self-organized collective behavior22,28 on contagion processes is essential for understanding the functional aspects of a variety of behaviors exhibited by biological collectives (such as the risk-related behavior observed in fish7). In bacterial swarms, for example, the spreading of genetic information (through direct contacts or via bacteriophages29) is conditioned by the self-organized coordinated motion and cluster formation that emerges from simple physical interactions30,31,32. These genetic propagation dynamics are believed to play an important role in key processes such as the spread of antibiotic resistance in bacterial populations33,34. A better understanding of this type of phenomena will thus require further studies of the interplay between infection spreading and collective spatiotemporal dynamics that could be built on the results presented in this paper.

At the macroscopic agent scale, the relationship that we analyzed here between spatiotemporal self-organization and contagion dynamics is expected to be highly relevant for a variety of systems, ranging from animal groups to human crowds, which are known to often form dense gatherings with complex fission–fusion dynamics35,36,37. This could affect processes that require containment, such as disease spreading, or that are typically beneficial, such as the diffusion of information.

Despite using highly idealized models, our work could have relevant implications in the development of strategies for the control of epidemics. For example, our results show that, for a broad range of parameters, outbreaks are significantly reduced in the homogeneous ordered states when compared to other states with the same, relatively low, mean density. In the context of the current COVID-19 pandemic, this suggests the development of crowd control strategies that favor the homogeneous spreading of individuals to help minimize contagion during large gatherings. On a more general note, our minimal agent-based descriptions show that the contagion dynamics is often not adequately captured by the averaged network approaches commonly used to predict epidemic spreading. This is especially true in the presence of self-organized spatiotemporal features, which could help explain the very limited success that has been achieved in predicting outbreaks during this pandemic.

Future studies could improve the level of description considered in this paper by including other potential couplings between the spatial dynamics and the contagion process. In a recent study38, for example, flocking agents alter their motion when they get infected, which can strongly affect the contagion spreading. This type of additional considerations could help complete the characterization of simple systems that combine spatial and epidemic models, and will be left for future work.

Methods

Individual-based model

We consider a system of N self-propelled agents moving continuously in a two-dimensional arena of size \(L\times L\), with periodic boundary conditions. At time t, agent i is located at position \(\vec{r}_{i} (t)\) and tends to advance in its heading direction \({\hat{n}}_i=\left[ \cos \theta _i(t),\sin \theta _i(t) \right] ^T\) with constant self-propulsion speed \(v_0\), while also being displaced by local soft-core repulsion forces \(\vec{F}_{i}\) between neighbors. The corresponding equation for a system with overdamped dynamics is given by

$$\frac{{d\vec{r}_{i} (t)}}{{dt}} = v_{0} \hat{n}_{i} (t) + \vec{F}_{i} (t).$$
(1)

We define the interaction set \(S_{i} = \left\{ {j{\mkern 1mu} |{\mkern 1mu} |\vec{r}_{{ji}} | \le \vec{r}_{{{\text{int}}}} } \right\}\), with \(\vec{r}_{ji}= \vec{r}_i-\vec{r}_j\), as containing all neighbors within a range \(\mathrm {r_{int}}\) of the focal particle i. In order to reduce the parameter space, the alignment and repulsive interactions are defined as having the same range. These interactions are given by

$$\begin{aligned} \frac{d\theta _i(t)}{dt}= & {} \frac{1}{\tau }\left\langle \mathrm {mod}^{*}(\theta _j -\theta _i) \right\rangle _{j\in S_i} + \sigma \xi _{\theta }, \end{aligned}$$
(2)
$$\vec{F}_{i} (t) = {\text{ }}\sum\limits_{{j \in S_{i} }} {\frac{{{\text{r}}_{{{\text{int}}}} - |\vec{r}_{{ji}} |}}{{{\text{r}}_{{{\text{int}}}} }}} \frac{{\vec{r}_{{ji}} }}{{|\vec{r}_{{ji}} |}}.$$
(3)

Here, \(\tau\) is a relaxation time that controls the strength of the alignment, \(\mathrm {mod}^{*}(x)=\mathrm {mod}(x+\pi ,2\pi )-\pi\) is a modified modulo function that produces values between \(-\,\pi\) and \(\pi\), and \(\sigma\) is the strength of a \(\delta\)-correlated Gaussian white noise introduced through a random variable \(\xi _{\theta }\) that satisfies \(\langle \xi _\theta \rangle =0\) and \(\langle \xi _{\theta }(t_1)\xi _{\theta }(t_2) \rangle = \delta (t_2 - t_1)\). Each particle thus tends to align its heading angle \(\theta _i(t)\) to its neighbors, while subjected to noise, and is displaced by repulsive forces \(\mathbf {F}_i(t)\) that do not affect its heading direction.

We combine the above movement model with a standard SIR-model. Each agent i is assigned an internal ternary variable \(s_i(t) \in \{S,I,R\}\), representing its current contagion state: susceptible (\(s_i(t)=S\)), infected (\(s_i(t)=I\)), or recovered (\(s_i(t)=R\)). A susceptible agent i can only become infected, with a base transmission rate \(\beta _b\), while it is in contact with at least one infected agent j (i.e., at a distance smaller than the interaction range \(|\mathbf {r}_{ij}|\le \mathrm {r_{int}}\)).

Its infection probability when in contact with a single infected neighbor for a short time period \(\Delta t\) will thus be given by \(p_{\mathrm {inf}}=\beta _b\Delta t\). If a susceptible agent is in contact with multiple infected agents simultaneously, all pairwise interactions are assumed to be statistically independent and its infection probability is therefore given by the sum of the individual probabilities. Note that, for a sufficiently small numerical time step \(\Delta t\) and a finite number of neighbors, the infection probability per numerical integration step is typically well below 1. On the other hand, an infected agent spontaneously recovers at a rate \(\gamma\), that is, with probability equal to \(\gamma \Delta t\) for a small enough \(\Delta t\). We consider here the recovered state to be an absorbing state of the contagion dynamics, so no infections can reoccur in recovered agents.

It is important to point out that the base transmission rate \(\beta _b\), as defined above, is different from the transmission rate parameter in standard epidemiological compartment models, typically denoted as \(\beta\). For a short contact duration \(\Delta t\) the following relations holds \(\beta =\beta _b \nu \Delta t\), with \(\nu\) being the contact rate.

Following the SIR dynamics defined above, an initial number of infected agents can result in a contagion process that spreads to other agents, all of which will eventually recover spontaneously until no infected agents remain in the system, ending the outbreak. If we define \(\rho _I(t)\), \(\rho _S(t)\) and \(\rho _R(t)\) as the fraction of the total population that is infected, susceptible, or recovered at time t, respectively, this corresponds to reaching a state with \(\rho _I(\infty )=0\) and \(\rho _S(\infty )+\rho _R(\infty )=1\), where \(t=\infty\) denotes any time t after the SIR dynamics has reached its final absorbing state. The effectiveness of the epidemic outbreak can then be measured by the value of \(\rho _R(\infty )\).

Dimensionless parameters

We investigate the contagion process for a system of self-propelled agents in different types of collective states22. These correspond to distinct regions of the phase space that is spanned by two nondimensional control parameters, the Peclet number Pe and the effective coupling strength g, defined as

$$\begin{aligned} \mathrm {Pe}= & {} \frac{v_0}{\mathrm {r_{int}}\sigma ^2}, \end{aligned}$$
(4)
$$\begin{aligned} \mathrm {g}= & {} \frac{1}{\tau \sigma ^2}. \end{aligned}$$
(5)

The Peclet number quantifies the level of persistence in individual movement, with \(\mathrm {Pe}\rightarrow 0\) corresponding to noise dominated Brownian motion and \(\mathrm {Pe}\rightarrow \infty\) describing ballistic motion for vanishing angular noise. The effective coupling \(\mathrm {g}\), quantifies the strength of the alignment interaction relative to the angular noise.

Macroscopic state variables

Each region in the (Pe,g) parameter space is characterized by different degrees of alignment and clustering, which is measured by two order parameter, \(\Psi\) and \(\Lambda\), respectively. More specifically, the degree of alignment is given by the polarization

$$\begin{aligned} \Phi =\frac{1}{N} \left| \sum _{i = 1}^{N} \hat{n}_i\right| , \end{aligned}$$
(6)

where \(\Phi =1\) if all particles are heading in exactly the same direction and \(\Phi \approx 0\) if they are moving in random directions.

The clustering \(\Lambda\) is defined as the fraction of the total number of particles that conform the largest cluster in the system, where the members of a cluster are determined to be all particles within a distance \(\mathrm {r_{int}}\) of any other particle also in the cluster. Therefore, for the relatively low mean density value considered in this paper, \(\Lambda =1/N \ll 1\) describes a homogeneous state in which the distance between all neighbors is larger than the interaction range, whereas \(\Lambda =1\) corresponds to a highly inhomogeneous state where all agents belong to a single cluster.

Numerical simulations

We considered different collective states in the (Pe,g) phase space by varying the noise \(\sigma\) and alignment relaxation time \(\tau\), while keeping a fixed preferred agent speed \(v_0=0.2\) and interaction range \(\mathrm {r_{int}}=1\), in order to limit the parameter exploration. We also fixed the mean density to a packing fraction of \(\mathrm {N} \pi \, {\mathrm {r}}_{\mathrm {int}}^2 / (4 \mathrm {L}^2) = 0.3\), by simulating \(\mathrm {N}=10,000\) agents in an arena of size \(\mathrm {L}\approx 161\). A detailed analysis of the different spatial dynamics and collective states obtained in this system was recently presented in22. Starting from statistically stationary states of the spatial dynamics, we implemented the SIR process by infecting 100 agents, which corresponds to 1 percent of all particles. For each parameter combination, we considered 5 independently converged stationary states and initialized 10 contagion processes, each starting from a different set of randomly selected infected agents. Hence, a set of 50 simulations was used to characterize the epidemic spreading for each case.