Abbas

The Spatial Puzzle of Herd Immunity in Complex Networks

We’ve all heard the idea that if you reach a certain percentage of immunity in a population, you achieve herd immunity. But what if it’s not just about the percentage? What if how people are connected plays a huge role too? That’s what this post is all about—how herd immunity, whether from natural infection or vaccination, interacts with our social networks.

Every epidemic intervention, such as vaccination, mask mandate, school closure, contact tracing, etc., that we apply to a population usually influences some local properties of our social network by altering the connections or interactions between people. These local effects then propagate through the whole network, and depending on the structure of the population, they either get amplified or eventually fade away, leaving the intervention almost useless. We model social networks with random graphs. In this picture, every person is represented by a node (a point in space and maybe in time), and a link (a line segment) between two nodes represents a contact or connection between two people. A collection of nodes with some specific connection pattern represents an ideal who-contacts-whom map of the population. An epidemic intervention changes the contact pattern of such random graphs.

Fig. 1: A social network with epidemic interventions

Herd Immunity Thanks to Vaccination

Take vaccination as an example. In the simplest scenario, with a perfect vaccine, we immune the vaccinated individuals and block the transmission routes to their neighbors, which means removing some number of batches — nodes with their connecting links — from the original network. Sometimes, these batches form larger batches and eventually together dismantle the network. This phenomenon is known as percolation in scientific jargon. We say immunity has percolated through the target population if with enough vaccination every local infection dies out as it gets imprisoned in its neighborhood. The benefit of vaccination is twofold. First, some people gain immunity as the direct effect of vaccination (removed nodes), and second, the remaining unvaccinated people, despite not directly being immunized, gain protection by getting disconnected from the infection routes. In practice, the challenge remains to find out how many people and in what order and pattern we need to vaccinate to get to the population-level immunity or in epidemiological terms, herd immunity?

Fig. 2: How Different Immunization Strategies Protect the Network. In both (a) and (b), the same number of nodes are immunized, but their placement makes a big difference. In (a), immune nodes (in red) form a close batch, blocking only a few virus pathways (dotted red lines) and providing limited extra protection. In (b), vaccinated nodes (in blue) are scattered across the network, removing a more spread-out batch of nodes and links. This scattered setup disrupts many more transmission routes, giving the entire network stronger, broader immunity.

A simple way to find the herd immunity threshold is to consider exponential growth for the early stage of an epidemic, where each infected individual, on average, infects $R_0$ more people. Now, if we randomly vaccinate a fraction $v$ of the population, the number of secondary infections, $R_{e},$ becomes $R_{e}=(1-v)R_0$, meaning each person now infects $vR_0$ fewer people. If $R_{e}$ falls below one, instead of exponential growth, we see a decline, and the disease quickly dies out. So, the herd immunity threshold is the fraction $v_c$ that satisfies this equation $1=R_0(1-v_c)%$. Solving this gives the threshold: $$v_c = 1 – \frac{1}{R_0}.$$

If we set $R_0=3$, as some studies did early in the COVID-19 pandemic, the equation above gives $v_c = 1 -1/3 \approx 0.7$. This might ring a bell, as you may have heard about the 70% vaccination target for reaching herd immunity in the media. In mathematical epidemiology, $R_0$ is known as the basic reproduction number, and respectively, $R_e$ is called the effective reproduction number. This reasoning has been widely used to estimate the herd immunity threshold.

Fig. 3: By randomly vaccinating $v$ fraction of people, we reduce the number of secondary infections, and if we manage to reduce it enough, the diseases die out immediately.

However, we now understand that this approach needs to be revised in many instances because it oversimplifies the complexities of real-world scenarios. This model assumes that everyone has an equal chance of interacting with anyone else, regardless of their location, occupation, age, or interests. In reality, we do not live in a giant cocktail shaker where we constantly bump into one another. We interact with people around us with different patterns and at other times. Our social and health behavior highly affects the outcome of epidemic spread and can hinder the effectiveness of interventions. To consider these complexities, we need to put the networked structure of the human population in our modeling assumptions. Let’s follow a yet simple but more realistic approach.

Imagine a population where people have different numbers of connections, and vaccinated individuals are more likely to interact with other vaccinated people, while unvaccinated folks also tend to stick to their own group. This is a familiar scenario: in most populations, vaccine uptake doesn’t result in a perfectly even distribution. There are often vaccine-hesitant individuals who primarily engage with others who share their views. This social tendency—where similarity drives connections—is called homophily in sociology. Birds of a Feather…” and all that.

Fig. 4: A more realistic transmission network where each person interacts with a different number of individuals, and interactions are more likely to occur between people with the same vaccination status. This network has a positive Coleman homophily index based on the vaccination.

We can measure the degree of vaccine homophily, $h$, based on the fraction of vaccinated people and the likelihood that a vaccinated person connects with either vaccinated or unvaccinated individuals. The homophily value, also known as the Coleman homophily index, ranges from -1 to 1. When $h=0$, people interact without regard to vaccination status. A positive $h$ indicates a preference for same-status connections, with larger values reflecting a stronger bias. Now, the question arises: given this specific pattern of connections controlled by $h$, how does our previous equation for the herd immunity threshold change? Researchers at Aalto University in Finland have shown that incorporating these nuances into the model modifies the herd immunity threshold equation to  $$v_c = \frac{1}{1 – h}\left(1 – \frac{1}{R_0}\right).$$ To understand this equation, let’s first set  $h = 0$, representing a fully mixed population with no preference in interactions. This returns the original equation, assuming vaccines are evenly distributed. It implies that, as long as $R_0$ is known, we can calculate the epidemic threshold regardless of each person’s connections. However, when  $h \neq 0$ , things change significantly. Fig. 5 shows how the herd immunity threshold varies with different $R_0$  values as a function of vaccination homophily. For example, in a population with $h = 0.5$  when  $R_0 = 2$, the herd immunity threshold reaches 1, meaning every single individual must be vaccinated to achieve herd immunity. When vaccination homophily exceeds  $1/R_0$, herd immunity becomes unachievable as indirect protection diminishes entirely.

Fig. 5: As vaccination homophily increases, the herd immunity threshold rises, eventually reaching a ceiling. This indicates that there is no indirect benefit from vaccination beyond a certain point, when  $h \geq 1/R_0$, meaning herd immunity becomes unattainable.

This approach, while more realistic than the previous one, still doesn’t fully capture real-life complexities. However, it provides a foundation for understanding herd immunity and helps generate more refined research questions. Models that assume uniformly random connections between individuals—ignoring how people are actually connected—are called mean-field models. By averaging out individual differences, they treat everyone as equally likely to interact with anyone else. While this simplification is useful for deriving general insights, it overlooks the finer details of network structures, where social dynamics, proximity, and individual connectivity significantly influence the spread of immunity and disease. We’ll revisit these concepts later.

Herd Immunity Thanks to Natural Infection

Fig. 6: Herd immunity is larger than the sum of individual immunities. The horizontal axis ($\pi_0$) shows the fraction of people who are immune, while the vertical axis ($\pi_1$) represents the size of the largest connected group still at risk of infection—think of $\pi_0$ and $\pi_1$ as the potential number of people infected in the first and second waves of the epidemic, respectively. At a certain immunity level, $\pi_c$, the disease can no longer easily spread, creating a ‘herd immunity’ effect where even non-immune individuals are protected.

Networks are all about connections—some people, like social butterflies, have many connections, while others have fewer, closer bonds. This variation, known as degree heterogeneity, means that certain individuals, called superspreaders, can infect many others if they catch a disease. Connections are also not entirely random; they’re influenced by physical proximity. People who live or work near each other are more likely to be connected, a concept called spatiality. As Tobler’s First Law of Geography says:

Fig. 7: Different types of network models, positioned according to their degree heterogeneity (vertical axis) and spatiality (horizontal axis). Degree heterogeneity captures the range of connections individuals have—from highly connected hubs to those with few links—while spatiality represents how much connections are influenced by physical proximity.

We can transition between these network types using mathematical techniques that adjust their heterogeneity and spatiality. For instance, edge rewiring increases randomness in connections while preserving the network’s degree structure, while other methods introduce spatial constraints without altering degree variations. These models allow us to explore how network structure impacts the spread of immunity and disease.

On the left side of Fig. 7, we see a range of network models where connections aren’t constrained by proximity, but instead vary in terms of degree heterogeneity. The top-left model, known as the configuration model, is particularly useful for representing superspreaders—individuals with an exceptionally high number of connections, known as infection hubs. This framework allows us to simulate populations with a wide variation in connections, where a few superspreaders are highly connected and play a key role in disease transmission. In network models that allow for such degree heterogeneity, hubs are more likely to get infected early due to their numerous connections, and once recovered, they no longer fuel the epidemic, which can slow disease spread significantly. This suggests that, assuming infection is not overly harmful, disease-induced immunity can be more effective than random vaccination in such networks. Random vaccination is less likely to target superspreaders, leaving them susceptible and enabling them to continue spreading the disease. Therefore, there are mathematical and data-driven studies suggesting that disease-induced immunity offer an advantage over vaccination by targeting superspreaders who drive transmission.

Early in the COVID-19 pandemic, Sweden adopted a strategy that minimized interventions, aiming to allow natural immunity to develop through superspreaders and enhance overall population immunity. However, this approach faced significant challenges, leading Sweden to reassess and adjust its policies. One reason for its shortcomings was that degree heterogeneity—variation in the number of connections—is just one of many factors that influence the spread of epidemics. It turns out that disease-induced immunity is driven not only by the concentration of immunity among socially active individuals—as already identified in mean-field models—but also by another counteracting mechanism inherent to network models.

The Spatial Blueprint of Immunity in Networks

According to network scientists at Aalto University, while superspreaders do give disease-induced immunity a clear edge, that’s only part of the story. Their deeper mathematical investigation into herd immunity has revealed two competing mechanisms: preferential immunity and localization. Preferential immunity occurs when highly connected individuals—superspreaders—are more likely to get infected early, which can actually strengthen herd immunity. Once immune, these individuals act as a firewall, limiting the disease’s ability to spread widely. Localization, however, refers to outbreaks clustering in specific areas, causing immune individuals to group together. This clustering reduces the overall protective effect of immunity on the broader population. When people are physically close, they’re more likely to catch the disease from each other, making disease-induced immunity less effective in these networks.

When we look at the way people are wired together, many connections are shaped by physical proximity—such as in households, workplaces, or neighborhoods—which amplifies the localization effect and limits the protective reach of immunity across the broader population. The right side of Fig. 7 illustrates spatial network models where connections are more likely to form between people who are physically close. In homogeneous networks, where individuals have roughly the same number of connections, localization tends to outweigh the benefits of preferential immunity. In such cases, random vaccination often proves more effective than natural infection for achieving herd immunity, as it distributes immunity more evenly across the network. However, in more heterogeneous networks—where some individuals have significantly more connections than others—disease-induced immunity gains an advantage. When highly connected individuals become infected and then immune, they can help slow transmission. Still, localization remains a factor, as outbreaks can cluster within certain areas, limiting the network’s overall protective effect.

Fig. 8: Comparison between the distributions of the same number of immune individuals (nodes) induced by an epidemic and by vaccination (random immunization) in a random geometric graph.

Random geometric graphs bridge the gap between purely random graph models and real-world networks with spatial constraints, providing a useful framework in various fields, from communication networks to biology and epidemiology.

This shows how disease-induced immunity spreads through a network, with red dots representing immune individuals—those who have recovered from infection and can no longer spread the disease. The blue dots are still susceptible and make up the largest connected group at risk of an outbreak. Gray dots represent smaller groups of people who are more isolated from the main network.

Researchers at Aalto University, part of the NordicMath COVID Project—a Nordic collaboration focused on creating data and modeling tools to support pandemic preparedness—tested this spatial approach using real-world data from Finland. They built a realistic social network that mirrored life in Finland, incorporating age structure and interactions between age groups. Simulating an epidemic on this network, they found that even after reaching what traditional models would consider the herd immunity threshold, the disease could still resurge, particularly in networks with strong spatial organization.

Fig. 9: How Epidemics Spread in Different Network Models, Using Data from Finland.

Panel A of Fig.9 shows a traditional model that treats the population as if everyone mixes evenly, with cumulative cases tracked by age group. The black dashed line shows total infections over time, and the red dotted line marks when herd immunity is theoretically reached. The inset displays how often different age groups interact in Finland. In Panel B, we see a more realistic network model based on Finnish social network, where people are more likely to connect with those nearby. The left plot shows the initial outbreak, while the right captures what happens if the disease is reintroduced after reaching herd immunity. The colors represent different levels of ‘spatiality’ in the network: light colors show more random mixing, while darker colors represent networks where people stick closer to home. The inset on the right shows that even with herd immunity, localized outbreaks can still happen, especially in more spatially organized networks. The spatial structure is represented by varying $\tau^{-1}$ values, from random (light colors) to highly spatial (dark colors), with shaded areas representing the 95% confidence intervals across simulations.

So, what does this mean for the debate between vaccination and natural infection?

The key takeaway is that neither approach is universally better—it all depends on the network structure. In more uniform (homogeneous) networks, random vaccination tends to be more effective for achieving herd immunity, while in highly varied (heterogeneous) networks, disease-induced immunity can offer certain advantages by naturally targeting superspreaders. The reality lies in between. To improve public health models, we need to consider network structures, as traditional models often underestimate the immunity levels required for herd protection. Understanding real-world social connections can make vaccination campaigns more effective by using network analysis to identify high-risk communities or individuals. This allows for more strategic, data-driven interventions, targeting those who are most likely to drive transmission and helping to optimize resource allocation.

Read the supporting material for this post here:

  • Strength and Weakness of Disease-induced Herd Immunity in Networks, arXiv:2307.04700
  • Herd Immunity and Epidemic Size in Networks with Vaccination Homophily, Phys. Rev. E 105, L052301
  • Spreading and Epidemic Interventions: Effects of Network Structure and Dynamics, PDF & More

Unveiling the role of social networks in shaping epidemic spread and interventions

  • Opponent: Nicola Perra, Queen Mary University of London, United Kingdom
  • Custos: Mikko Kivelä, Aalto University School of Science, Department of Computer Science

What is my thesis about?

Spreading and Epidemic Interventions

Effects of Network Structure and Dynamics

Table of Content

Here’s an online version of my thesis

Abbas-DSc-Thesis

Contact-tracing apps help curb the pandemics, but their effectivity depends on the contact networks

An example of a path of infection: the second app-user has received an exposure notification and has isolated her/himself since s/he can be infectious!

Since the beginning of the COVID-19 pandemic, dozens of countries have deployed contact tracing via smartphone apps to employ quarantine for individuals who are at risk of infecting others. The idea behind digital contact tracing is to use smartphone applications to inform people who have been close to infectious people who also use the same application. Data from a handful of nations show mounting evidence that digital contact tracing is useful in keeping the spread of infectious diseases at bay.


Using the toolbox of network science, K. Rizi et al. have investigated the effectiveness of this low-cost intervention method on models that assume more realistic assumptions about human populations. Their model makes it possible to see when and how large an outbreak can happen if a fraction of people adopts the contact tracing apps given several different heterogeneities in the population structure. Importantly, their model includes homophily in the application adoption: the tendency of people who use the application to be more in touch with each other than people who do not use the application. Their results indicate that contact tracing with apps raises the epidemic threshold and reduces the size of the emerging outbreaks. Their results bring this issue to light that digital contact tracing can curb the pandemic even if it is not done perfectly, but its effects are highly nonlinear and strongly dependent on how the connections are structured among application users and others.

K. Rizi, Abbas, et al. “Epidemic spreading and digital contact tracing: Effects of heterogeneous mixing and quarantine failures.”

Balance Theory of Signed Genetic Interactions Reveals Differences in Cancerous and Healthy Cells

Time: Monday 13.01.2020 13.30 – 14.00
Place: Meeting room A142, T-building
Speaker: Abbas K. Rizi
Citation: Rizi AK, Zamani M, Shirazi A, Jafari GR and Kertész J (2021) Stability of Imbalanced Triangles in Gene Regulatory Networks of Cancerous and Normal Cells. Front. Physiol. 11:573732. doi: 10.3389/fphys.2020.573732

Received: 17 June 2020; Accepted: 16 December 2020;
Published: 20 January 2021.

Balance Theory of Signed Genetic Interactions Reveals Differences in Cancerous and Healthy Cells

Abstract:

Genes are not independently functioning in the cell and their expressions are strongly correlated with each other. They communicate with each other through different regulatory effects which lead to the emergence of complex structures in the cells. Such structures are expected to be different for healthy and cancerous cells. To study the differences in the case of breast cancer, we have investigated the Gene Regulatory Network (GRN) of cells as inferred from the RNA-sequencing data using the maximum entropy principle. The GRN is a signed weighted network corresponding to the inductive or inhibitory interactions.
In this presentation, I will focus on a particular set of motifs in the GRN, the triangles, which can be imbalanced if the number of negative interactions in them is odd or balanced otherwise. I will show that the network in cancerous cells has fewer imbalanced triangles than in the healthy case. Moreover, in the healthy cells, imbalanced triangles are isolated from the main part of the network, while such motifs are part of the giant component of the network in cancerous cells.


Fundamental Papers on Balance Theory:


Biological Network Inference – Using the Principle of Max. Entropy


Graphical Lasso


Data

The data of mRNA (expression level) of 20532 genes in the case of Breast Cancer (BRCA: Breast invasive carcinoma) has been downloaded from The Cancer Genome Atlas (TCGA) project. For each gene, there exists 114 normal and 764 cancerous samples and the measurement of the expression levels have done with the technique of RNA sequencing (RNA-Seq). We have used the RPKM (Reads Per Kilobase transcript per Million reads.) normalized data. RPKM puts together the ideas of normalizing by sample and by the gene. When we calculate RPKM, we are normalizing for both the library size (the sum of each column) and the gene length. We had to reduce the number of genes because it is a difficult task to handle a 20532 in 20532 matrix computationally. For each gene, we have calculated the variance of its expression level over its samples and finally, we have store the first 483 genes with the highest variance due to more different activity patterns these genes show among the others. Note that there are so-called housekeeping genes that typically get transcribed continually. These genes are required for the maintenance of basic cellular function and are expressed in all cells of an organism under normal and patho-physiological conditions. Some housekeeping genes are expressed at relatively constant rates in most non-pathological situations.

Slides

Balance-Theory-of-Signed-Genetic-Interactions1

Balance Theory: From Psychology to Cancer Dynamics

Social Balance Theory

Imagine Alice and Bob have just gotten married and have a mutual friend called Chris. In this scenario, they form a triangle of husband-wife-friend relationship, and every edge of this triangle represents a friendship link. Obviously, in this triplet of relationships, people like each other and can spend time together without any conflicts! So this triplet is said to be balanced because everything is fine there, and people enjoy their current state. But If something goes wrong between Alice and Bob and they decide to get divorced, then the link between the husband and wife in the triangle turns into enmity, and from now on, this change makes Chris rethink his relationship with this ex-couple because he cannot simultaneously be friend with these guys who are enemy of each other! Chris has to change his attitude towards Alice or Bob; at last, he must decide to be in a friendship status only with one of them. The triplet of the relationship is now imbalanced, and Chris finally decides to turn his relationship with Alice or Bob into enmity (turning a positive link into a negative one), which leads to another balanced state for this triangle of relationship after experiencing an imbalance. The dynamics of this change are mimicked in the picture below.

Evolution of a married couple plus friend triplet. After a divorce the triangle becomes imbalanced, but balance is restored after another relationship change. Full and dashed lines represent friendly (+) and unfriendly (-) relations respectively. REF: arXiv:physics/0605183

So as you may guess, in a triplet of relationships, if odd numbers of the links are positive (friendship), the triangle is said to be balanced, and otherwise, it is imbalanced. A balanced triangle, therefore, fulfills the adage that: (i) a friend of my friend is my friend, (ii) an enemy of my friend is my enemy, (iii) a friend of my enemy is my enemy, and (iv) an enemy of my enemy is my friend. This notion of balance in social systems was first introduced by Heider (1946), an Austrian psychologist whose work was related to the Gestalt school.

The Energy of Social Networks

The key concept in Heider’s Balance Theory is, “We adjust our relationship based on reducing the psychological stresses.” On the other hand, an imbalanced triangle is analogous to a frustrated plaquette in a random magnet. Physicists know how to assign energy to a system based on the interactions of its constituents. Therefore, inspired by a random magnet, we can assign energy to a triplet of relationships by multiplying each link’s strength in the triangle of relationships. So in the case of the husband-wife-friend triangle, the energy is:

$$E = -R_{hw}R_{wf}R_{fh}$$

which $R_{hw}$ is the strength of the relationship between husband and wife. For a friendly relationship, $R_{hw}$ is a positive number, and $R_{hw}$ is a negative number for an unfriendly relationship. The minus sign is to make the analogy between the concept of social balance and stability in physics. In physical terms, the imbalanced triangles must have higher energy because the dynamics are toward more stable states with lower energy levels. The same reason that an apple falls off a tree and goes from a higher energy level at a higher altitude to lower energy levels toward the ground.

Now with this mechanism, calculating the energy of triangles formed in a social network is handy; we can just simply find the energy of each triangle and, by aggregating them, come to the energy of that network! The higher energy of a network, the more tendency toward attitude change is expected in that network!

The Cancerous Cell Has Less Energy!

When we look at the social life of the genes in the cell, we see that genes make dialogue with each other. It means that genes form a social network in a cell and that the relationships between each pair of genes can be positive or negative, in the sense that genes can alter the state of other genes through the so-called regulatory effects. So, again if the strength of the relationship between each pair of genes is known, we can find the cell’s energy. For the case of Breast Cancer, K. Rizi et al. at Shahid Beheshti University in Tehran have inferred the strength of the relationship between each pair of genes and showed that the energy level of the normal cell is higher than the cancerous one, meaning the normal cell has more tendency to change its attitude. Therefore it can tackle more challenges it experiences through its life cycle.

This is how interdisciplinary research is done nowadays in complex systems. The point is to be open to ideas from different disciplines and creative enough to construct a pathway to solve real-world problems. From a psychological theory from 1946, we have come to a question in 21st-century systems biology with a resolution equipped with the physics toolbox!

To see the detailed study, click here: