5. Simulation pseudo-code
infect a random person
for neighbor in neighbours:
rand = randBetween(0,1):#uniform
if (rand <= .30):
infect the person
elseif(rand > .30):
do not infect the person
6. Number of people with the disease
Frequency
Probability of contacting the
disease
.30
Number of simulations 1000
Average # sick patients 42/350
Simulating the spread of a disease in a network
9. Simulation pseudo-code
remove n random people from the network
infect a random person
for neighbor in neighbours:
rand = randBetween(0,1):#uniform
if (rand <= .30):
infect the person
elseif(rand > .30):
do not infect the person
10. Number of people with the disease
Frequency
Probability of contacting the
disease
.30
Number of simulations 1000
Average # sick patients 33/350
# of vaccinations 50
Simulating the spread of a disease in a network
– random vaccination
This was 300
in the
previous
histogram.
Nothing in
the range
90-100
11. VACCINATE THE MORE CENTRAL
NODES
How to stop the disease from spreading?
12. Measures of centrality of a node
1. Closeness Centrality
2. Clustering coefficient
3. Degree
13. Closeness Centrality
• Closeness centrality of the node = Sum of the
lengths of the shortest path from one node to
all the other nodes
14. How to find the shortest path?
• In an undirected graph where all the nodes
are equidistant (all distances = 1)
• Breadth first search
19. 4. Distance between their immediate neighbor
and Beth is three
Closeness centrality is the sum
of all these numbers
Beth’s closeness
centrality is 24
20. Simulation pseudo-code
remove n closest people from network
infect a random person
for neighbor in neighbours:
rand = randBetween(0,1):#uniform
if (rand <= .30):
infect the person
elseif(rand > .30):
do not infect the person
21. Number of people with the disease
Frequency
Random vaccination Closeness centrality
Probability of contacting the
disease
.30 .30
Number of simulations 1000 1000
Average # sick patients 33 13
# of vaccinations 50 50
Simulating the spread of a disease in a network
– closeness centrality
This was 350
in the
random
vaccination
case
Nothing in
the range
70-100!
22. Measures of centrality in a network
1. Closeness Centrality
2. Clustering coefficient
3. Degree
24. .192/3 = .67
Local clustering
coefficient of a node
number of links between its neighbors
total number of possible links
Remove nodes with a
low clustering coefficient
=
n*(n-1)/2
25. Bigger size corresponds to a larger
clustering coefficient
I want to vaccinate nodes with a
small clustering coefficient
These hold the network together
26. Number of people with the disease
Frequency
Random vaccination Closeness centrality Clustering coefficient
Probability of
contacting the disease
.30 .30 .30
Number of simulations 1000 1000 1000
Average # sick patients 33 13 41
# of vaccinations 50 50 50
Simulating the spread of a disease in a network
– clustering coefficient
This was 350
in the
random
vaccination
case
Even worse
than random
vaccination!
27. Measures of centrality in a network
1. Closeness Centrality
2. Clustering coefficient
3. Degree
30. Simulation pseudo-code
remove n people with the highest degree
infect a random person
for neighbor in neighbours:
rand = randBetween(0,1):#uniform
if (rand <= .30):
infect the person
elseif(rand > .30):
do not infect the person
31. Number of people with the disease
Frequency
Random Closeness centrality Clustering coefficient Degree
Probability .30 .30 .30 .30
Number of
simulations
1000 1000 1000 1000
Average # sick
patients
33 13 41 11
# of vaccinations 50 50 50 50
Simulating the spread of a disease in a network
– degree
Looks like a
negative
exponential
distribution
Simplest
method with
best results
32. Summary
• Studying social networks which have a special
property that the all the distances are one
• BFS : Shortest Path Problem
• Clustering Co-efficient of a node
• Degree of a node. Best results!
This graph has on an average a high clustering co-efficient. Which means that there are concentrated clusters. But, there are a few, like node #5, with a low clustering co-efficient which is helping the whole network stay in touch.