SlideShare a Scribd company logo
Petter


Holme




Temporal


network


epidemiology:


Subtleties


and


algorithms
Temporal network epidemiology: Subtleties and algorithms
Temporal networks
i j t
1 2 0
1 2 5
2 3 7
1 2 8
3 4 9
⋮ ⋮ ⋮
0
2
3
4
Time
10
1
5
SIR on static graphs
‣Infection rate β → Infection across an SI link* is a Poisson process for its
duration.


‣ . . . *Edge in a static graph.


‣Constant recovery rate ν → Exponentially distributed durations of infection.


‣One seed chosen at random among all vertices.
‣Gillespie


‣Event-driven algorithm (Kiss, Miller, Simon, 2017), a.k.a. Next-reaction


‣Composition / rejection (St-Onge, Comp. Phys. Comm. 2019)
Algorithms
SIR on temporal graphs
‣Realism | After all, the goal is to simulate reality


‣Continuity | It should be possible to reduce the time dimension and get static
network epidemiology.


‣Simplicity | Keep the same level of abstraction throughout the modeling.


‣Generalizability | It should be easy to extend the model.


‣Speed | As a tiebreaker among design principles.
Design principles:
P Holme, 2021. Fast and principled simulations of the SIR model on temporal
networks. PLoS ONE 16(2): e0246961.
Algorithmic model formulation
‣Initialization | Initialize all individuals to susceptible.


‣Seeding | Pick a random individual i and a random time ti in the interval [0,T). At
time ti, infect i.


‣Recovery | Whenever a node becomes infected, let it stay infected for an
exponentially distributed time δ before it recovers.


‣Contagion | If i got infected at time ti and is still infected at time t > ti, and j is
susceptible at time t, then a contact (i,j,t) will infect j with probability β.
Straightforward algorithm
1. Initialize all nodes as susceptible.


2. Run through the contacts in increasing order of time.


3. If a there is a contact between a susceptible and infectious node, then infect the
susceptible node with probability β.


4. Whenever a node gets infected (including the source), then draw its time to recovery
from an exponential distribution, and change its state to I.


5. Stop the simulation when there are no infectious nodes.
0
2
3
4
Time
10
1
5
1. Bisection search to
fi
nd the
fi
rst contact that can spread the disease. 


2. Stop the simulations when all infected nodes are no longer active.
Could be sped up with several tricks:
0
A
B
5 10 15 20
a
b
c
d
Time
a:
b
c
d
19
2 15
0 4 6
10
b: a 0 4 6 c: a
d
19
2 15
13 16
d: c 13 16
a 10
Internal representation of the temporal network
Contact lists ordered in decreasing order of the last element.
Event-based algorithm
Event-based algorithm
1. Use bisection search to
fi
nd the smallest index k of tij such that ti < tij(k).
Where tij(k) denotes the k’th contact of tij.


2. Add a random number K generated by log(1–X) / log(1–β) to k and
denote the sum by k′. (The probability of the k’th event of a Bernoulli process
occurring.) X is a uniform random number in [0,1).


3. If k′ is larger than tij’s number of elements, then return some out-of-bounds
value (to signal that no contact will spread the disease). Otherwise, return k′
—the contact between i and j that could be contagious.
Contagious contact


Finding what contact between two nodes i and j that would spread the disease, if
any.
a:
b
c
d
19
2 15
0 4 6
10
b: a 0 4 6 c: a
d
19
2 15
13 16
d: c 13 16
a 10
Event-based algorithm
1. Pop the individual i with the earliest infection time from the heap.


2. Iterate through the neighbors j of i.


a. If j is susceptible, get the time tj when it would be infected by i (by calling
contagious-contact).


b. If it simultaneously holds that


i. There is no earlier infection event of j on the heap.


ii. i’s recovery time is not earlier than tj.


then put the contagion (i infects j at time tj) on the heap.
Infect


Handling the infection of one node i.
Event-based algorithm
Taken together:
1. Read the network and initialize everything.


2. Infect the source node.


3. While there are any nodes left on the heap, call infect.


4. Reset the simulation.


5. Go to 2 until you have enough averages.


6. Evaluate the output.
Transmission probability
10
0.1
1
0.01 0.1 1
Recovery
rate
Outbreak
size
2
4
6
8
10
12
14
16
18
Example output: SocioPatterns Gallery day 1
1
2
3
4
5
6
7
0.1 1 10
Outbreak
size
Infection rate
Analytical
Straightforward algorithm
Event-based algorithm
A B
Validation of the program
A graph with complex behavior w.r.t SIR
7
1 6 7
5
1 6 7
5
1 6
1
2
3
4
5
0.1 1 10
1
2
3
4
5
6
7
0.1 1 10
0
0.2
0.4
0.6
0.8
1
1.2
1.4
0.1 1 10
3
2
6
3 2 5
3
2
7
5
Sentinel
surveillance
Vaccination
Influence
maximization
Ω Ω
τ
2
1
4 5
6 7
3
β β
β
P
Holme,
Phys.
Rev.
E
96,
062305
(2017).
Complexity
N = number of nodes


M = number of edges (node pairs with at least one contact)


C = number of contacts


Straightforward algorithms: O(N + C)


Event-driven algorithm: O(L log N log C)
5
10
15
1 10 100 1000
5
10
15
10 100
5
10
15
Relative
speed-up
1000
1 10
Relative
speed-up
Relative
speed-up
Average degree, z Number of nodes, n
Avg. no. contacts per edge, c
B
A C
z = 2
n = 100
c = 100
n = 100
c = 100
z = 2
0 0 0
Speed-up relative to the straightforward algorithm of
arti
fi
cial networks
Speed-up relative to the straightforward algorithm
Transmission probability
Recovery
rate
0
10
20
30
40
Speed-up
1000
100
10
1
0.1
0.1 1
0.01
0.001
1
10
100
1000
10000
1000 10000 100000 1×106
1×107
Number of contacts
Relative
speed-up
Speed-up relative to the straightforward algorithm
SIR with
fi
xed infection-duration
Everything like before, except the disease lasts a
fi
xed duration T.


Could we then compute the infection probability of a node for all β at once?
Work
in
progress
SIR with
fi
xed infection-duration
Everything like before, except the disease lasts a
fi
xed duration T.


This makes the problem more structured and should be much faster. For
example, we then compute the infection probability of a node for all β at once?


Naïve algorithm idea:


1. For every node i, let a variable xi representing the minimum value of T
needed to reach i.


2. Go through every contact (i,j,t) in increasing t. Update xi to max(xi,tj+xj) where
tj is the time since j was infected, and similarly for xj.
The catch
1
2
3
4
5
6
7
1
2
3
4
5
6
7
time
time
S I R
T
petterhol.me


Code: github.com/pholme/tsir/
Thank you!

More Related Content

PPTX
Cyber security
PDF
09 Inference for Networks – Exponential Random Graph Models (2017)
PPTX
Social Engineering
PPTX
Infocyte - Digital Forensics and Incident Response (DFIR) Training Session
PPT
DDoS Attacks
PDF
Lattice-Based Cryptography: CRYPTANALYSIS OF COMPACT-LWE
PDF
Open source intelligence information gathering (OSINT)
PDF
The fundamentals of Android and iOS app security
Cyber security
09 Inference for Networks – Exponential Random Graph Models (2017)
Social Engineering
Infocyte - Digital Forensics and Incident Response (DFIR) Training Session
DDoS Attacks
Lattice-Based Cryptography: CRYPTANALYSIS OF COMPACT-LWE
Open source intelligence information gathering (OSINT)
The fundamentals of Android and iOS app security

What's hot (20)

PDF
Petit potam slides-rtfm-ossir
PPTX
PPTX
Information security awareness - 101
PPTX
PPTX
自己対照研究デザインの概要
PDF
ポジティヴ心理学に基づくPERMA-V Scale in HDBの開発 日本心理学会第83回学術大会 pp.1519
PDF
データ解析6 重回帰分析
PDF
多重代入法(Multiple Imputation)の発表資料
PDF
Brute Force Attack
PDF
Gestion de la privacidad e identidad digital
PPTX
Honeypots (Ravindra Singh Rathore)
PPTX
Facenet - Paper Review
PPTX
What is zero trust model (ztm)
PDF
階層ベイズとWAIC
PDF
[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...
PPT
Botnet Detection Techniques
PPTX
Penetration testing overview
PPTX
Wireless Penetration Testing
PPTX
Intrusion detection system
PPTX
Advanced cryptography and implementation
Petit potam slides-rtfm-ossir
Information security awareness - 101
自己対照研究デザインの概要
ポジティヴ心理学に基づくPERMA-V Scale in HDBの開発 日本心理学会第83回学術大会 pp.1519
データ解析6 重回帰分析
多重代入法(Multiple Imputation)の発表資料
Brute Force Attack
Gestion de la privacidad e identidad digital
Honeypots (Ravindra Singh Rathore)
Facenet - Paper Review
What is zero trust model (ztm)
階層ベイズとWAIC
[cb22] CloudDragon’s Credential Factory is Powering Up Its Espionage Activiti...
Botnet Detection Techniques
Penetration testing overview
Wireless Penetration Testing
Intrusion detection system
Advanced cryptography and implementation
Ad

Similar to Temporal network epidemiology: Subtleties and algorithms (20)

PDF
A unified prediction of computer virus spread in connected networks
PDF
Generalized SEIR Model on Large Networks
PDF
How the information content of your contact pattern representation affects pr...
PDF
Computational Epidemiology (Review) : Notes
PDF
The Susceptible-Infectious Model of Disease Expansion Analyzed Under the Scop...
PDF
THE SUSCEPTIBLE-INFECTIOUS MODEL OF DISEASE EXPANSION ANALYZED UNDER THE SCOP...
PDF
ICPSR - Complex Systems Models in the Social Sciences - Bonus Content - Profe...
PDF
A COMPUTER VIRUS PROPAGATION MODEL USING DELAY DIFFERENTIAL EQUATIONS WITH PR...
PDF
I017134347
PDF
Modeling and Threshold Sensitivity Analysis of Computer Virus Epidemic
PDF
Temporal dynamics of human behavior in social networks (ii)
PPT
Biosurveillance: Machine Learning And Disease Surveillance by Kass-Hout Di Tada
PDF
Epidemic processes on switching networks
PPTX
Presentation nipun puri
PDF
Gossip-based algorithms
PDF
This project will investigate the SIR model and use numeric methods t.pdf
PDF
Survival Factorization on Diffusion Networks
PDF
ICPSR 2011 - Bonus Content - Modeling with Data
PDF
Modelisation of Ebola Hemoragic Fever propagation in a modern city
PDF
A general stochastic information diffusion model in social networks based on ...
A unified prediction of computer virus spread in connected networks
Generalized SEIR Model on Large Networks
How the information content of your contact pattern representation affects pr...
Computational Epidemiology (Review) : Notes
The Susceptible-Infectious Model of Disease Expansion Analyzed Under the Scop...
THE SUSCEPTIBLE-INFECTIOUS MODEL OF DISEASE EXPANSION ANALYZED UNDER THE SCOP...
ICPSR - Complex Systems Models in the Social Sciences - Bonus Content - Profe...
A COMPUTER VIRUS PROPAGATION MODEL USING DELAY DIFFERENTIAL EQUATIONS WITH PR...
I017134347
Modeling and Threshold Sensitivity Analysis of Computer Virus Epidemic
Temporal dynamics of human behavior in social networks (ii)
Biosurveillance: Machine Learning And Disease Surveillance by Kass-Hout Di Tada
Epidemic processes on switching networks
Presentation nipun puri
Gossip-based algorithms
This project will investigate the SIR model and use numeric methods t.pdf
Survival Factorization on Diffusion Networks
ICPSR 2011 - Bonus Content - Modeling with Data
Modelisation of Ebola Hemoragic Fever propagation in a modern city
A general stochastic information diffusion model in social networks based on ...
Ad

More from Petter Holme (19)

PDF
The big science of small networks
PDF
Spin models on networks revisited
PDF
History of social simulations
PDF
Optimizing
 sentinel
 surveillance 
in
 static
 and 
temporal 
networks
PDF
Important spreaders in networks: Exact results for small graphs
PDF
Important spreaders in networks: exact results on small graphs
PDF
Netsci 2017
PDF
Spreading processes on temporal networks
PDF
Dynamics of Internet-mediated partnership formation
PDF
Disease spreading & control in temporal networks
PDF
Modeling the evolution of the AS-level Internet: Integrating aspects of traff...
PDF
Emergence of collective memories
PDF
A paradox of importance in network epidemiology
PDF
From land use to human mobility
PDF
Why do metabolic networks look like they do?
PDF
Temporal Networks of Human Interaction
PDF
Modeling the fat tails of size fluctuations in organizations
PDF
From temporal to static networks, and back
PDF
Exploring spatial networks with greedy navigators
The big science of small networks
Spin models on networks revisited
History of social simulations
Optimizing
 sentinel
 surveillance 
in
 static
 and 
temporal 
networks
Important spreaders in networks: Exact results for small graphs
Important spreaders in networks: exact results on small graphs
Netsci 2017
Spreading processes on temporal networks
Dynamics of Internet-mediated partnership formation
Disease spreading & control in temporal networks
Modeling the evolution of the AS-level Internet: Integrating aspects of traff...
Emergence of collective memories
A paradox of importance in network epidemiology
From land use to human mobility
Why do metabolic networks look like they do?
Temporal Networks of Human Interaction
Modeling the fat tails of size fluctuations in organizations
From temporal to static networks, and back
Exploring spatial networks with greedy navigators

Recently uploaded (20)

PPTX
ECG_Course_Presentation د.محمد صقران ppt
PPTX
Introduction to Cardiovascular system_structure and functions-1
PPTX
2. Earth - The Living Planet Module 2ELS
PDF
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
PDF
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
PDF
Cosmic Outliers: Low-spin Halos Explain the Abundance, Compactness, and Redsh...
PPTX
Derivatives of integument scales, beaks, horns,.pptx
PPTX
Taita Taveta Laboratory Technician Workshop Presentation.pptx
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PPTX
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
PPT
protein biochemistry.ppt for university classes
PPTX
Cell Membrane: Structure, Composition & Functions
PDF
lecture 2026 of Sjogren's syndrome l .pdf
PDF
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
PDF
. Radiology Case Scenariosssssssssssssss
PDF
ELS_Q1_Module-11_Formation-of-Rock-Layers_v2.pdf
PPTX
Introduction to Fisheries Biotechnology_Lesson 1.pptx
PPTX
famous lake in india and its disturibution and importance
DOCX
Q1_LE_Mathematics 8_Lesson 5_Week 5.docx
PDF
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
ECG_Course_Presentation د.محمد صقران ppt
Introduction to Cardiovascular system_structure and functions-1
2. Earth - The Living Planet Module 2ELS
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
Cosmic Outliers: Low-spin Halos Explain the Abundance, Compactness, and Redsh...
Derivatives of integument scales, beaks, horns,.pptx
Taita Taveta Laboratory Technician Workshop Presentation.pptx
Phytochemical Investigation of Miliusa longipes.pdf
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
protein biochemistry.ppt for university classes
Cell Membrane: Structure, Composition & Functions
lecture 2026 of Sjogren's syndrome l .pdf
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
. Radiology Case Scenariosssssssssssssss
ELS_Q1_Module-11_Formation-of-Rock-Layers_v2.pdf
Introduction to Fisheries Biotechnology_Lesson 1.pptx
famous lake in india and its disturibution and importance
Q1_LE_Mathematics 8_Lesson 5_Week 5.docx
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...

Temporal network epidemiology: Subtleties and algorithms

  • 3. Temporal networks i j t 1 2 0 1 2 5 2 3 7 1 2 8 3 4 9 ⋮ ⋮ ⋮ 0 2 3 4 Time 10 1 5
  • 4. SIR on static graphs ‣Infection rate β → Infection across an SI link* is a Poisson process for its duration. ‣ . . . *Edge in a static graph. ‣Constant recovery rate ν → Exponentially distributed durations of infection. ‣One seed chosen at random among all vertices. ‣Gillespie ‣Event-driven algorithm (Kiss, Miller, Simon, 2017), a.k.a. Next-reaction ‣Composition / rejection (St-Onge, Comp. Phys. Comm. 2019) Algorithms
  • 5. SIR on temporal graphs ‣Realism | After all, the goal is to simulate reality ‣Continuity | It should be possible to reduce the time dimension and get static network epidemiology. ‣Simplicity | Keep the same level of abstraction throughout the modeling. ‣Generalizability | It should be easy to extend the model. ‣Speed | As a tiebreaker among design principles. Design principles: P Holme, 2021. Fast and principled simulations of the SIR model on temporal networks. PLoS ONE 16(2): e0246961.
  • 6. Algorithmic model formulation ‣Initialization | Initialize all individuals to susceptible. ‣Seeding | Pick a random individual i and a random time ti in the interval [0,T). At time ti, infect i. ‣Recovery | Whenever a node becomes infected, let it stay infected for an exponentially distributed time δ before it recovers. ‣Contagion | If i got infected at time ti and is still infected at time t > ti, and j is susceptible at time t, then a contact (i,j,t) will infect j with probability β.
  • 7. Straightforward algorithm 1. Initialize all nodes as susceptible. 2. Run through the contacts in increasing order of time. 3. If a there is a contact between a susceptible and infectious node, then infect the susceptible node with probability β. 4. Whenever a node gets infected (including the source), then draw its time to recovery from an exponential distribution, and change its state to I. 5. Stop the simulation when there are no infectious nodes. 0 2 3 4 Time 10 1 5 1. Bisection search to fi nd the fi rst contact that can spread the disease.  2. Stop the simulations when all infected nodes are no longer active. Could be sped up with several tricks:
  • 8. 0 A B 5 10 15 20 a b c d Time a: b c d 19 2 15 0 4 6 10 b: a 0 4 6 c: a d 19 2 15 13 16 d: c 13 16 a 10 Internal representation of the temporal network Contact lists ordered in decreasing order of the last element. Event-based algorithm
  • 9. Event-based algorithm 1. Use bisection search to fi nd the smallest index k of tij such that ti < tij(k). Where tij(k) denotes the k’th contact of tij. 2. Add a random number K generated by log(1–X) / log(1–β) to k and denote the sum by k′. (The probability of the k’th event of a Bernoulli process occurring.) X is a uniform random number in [0,1). 3. If k′ is larger than tij’s number of elements, then return some out-of-bounds value (to signal that no contact will spread the disease). Otherwise, return k′ —the contact between i and j that could be contagious. Contagious contact Finding what contact between two nodes i and j that would spread the disease, if any. a: b c d 19 2 15 0 4 6 10 b: a 0 4 6 c: a d 19 2 15 13 16 d: c 13 16 a 10
  • 10. Event-based algorithm 1. Pop the individual i with the earliest infection time from the heap. 2. Iterate through the neighbors j of i. a. If j is susceptible, get the time tj when it would be infected by i (by calling contagious-contact). b. If it simultaneously holds that i. There is no earlier infection event of j on the heap. ii. i’s recovery time is not earlier than tj. then put the contagion (i infects j at time tj) on the heap. Infect Handling the infection of one node i.
  • 11. Event-based algorithm Taken together: 1. Read the network and initialize everything. 2. Infect the source node. 3. While there are any nodes left on the heap, call infect. 4. Reset the simulation. 5. Go to 2 until you have enough averages. 6. Evaluate the output.
  • 12. Transmission probability 10 0.1 1 0.01 0.1 1 Recovery rate Outbreak size 2 4 6 8 10 12 14 16 18 Example output: SocioPatterns Gallery day 1
  • 13. 1 2 3 4 5 6 7 0.1 1 10 Outbreak size Infection rate Analytical Straightforward algorithm Event-based algorithm A B Validation of the program
  • 14. A graph with complex behavior w.r.t SIR 7 1 6 7 5 1 6 7 5 1 6 1 2 3 4 5 0.1 1 10 1 2 3 4 5 6 7 0.1 1 10 0 0.2 0.4 0.6 0.8 1 1.2 1.4 0.1 1 10 3 2 6 3 2 5 3 2 7 5 Sentinel surveillance Vaccination Influence maximization Ω Ω τ 2 1 4 5 6 7 3 β β β P Holme, Phys. Rev. E 96, 062305 (2017).
  • 15. Complexity N = number of nodes M = number of edges (node pairs with at least one contact) C = number of contacts Straightforward algorithms: O(N + C) Event-driven algorithm: O(L log N log C)
  • 16. 5 10 15 1 10 100 1000 5 10 15 10 100 5 10 15 Relative speed-up 1000 1 10 Relative speed-up Relative speed-up Average degree, z Number of nodes, n Avg. no. contacts per edge, c B A C z = 2 n = 100 c = 100 n = 100 c = 100 z = 2 0 0 0 Speed-up relative to the straightforward algorithm of arti fi cial networks
  • 17. Speed-up relative to the straightforward algorithm Transmission probability Recovery rate 0 10 20 30 40 Speed-up 1000 100 10 1 0.1 0.1 1 0.01 0.001
  • 18. 1 10 100 1000 10000 1000 10000 100000 1×106 1×107 Number of contacts Relative speed-up Speed-up relative to the straightforward algorithm
  • 19. SIR with fi xed infection-duration Everything like before, except the disease lasts a fi xed duration T. Could we then compute the infection probability of a node for all β at once? Work in progress
  • 20. SIR with fi xed infection-duration Everything like before, except the disease lasts a fi xed duration T. This makes the problem more structured and should be much faster. For example, we then compute the infection probability of a node for all β at once? Naïve algorithm idea: 1. For every node i, let a variable xi representing the minimum value of T needed to reach i. 2. Go through every contact (i,j,t) in increasing t. Update xi to max(xi,tj+xj) where tj is the time since j was infected, and similarly for xj.