{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# TP11 (Student version): Epidemic spreading on networks\n",
"\n",
"We can use the following libraries."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.8.5 (default, Jul 28 2020, 12:59:40) \n",
"[GCC 9.3.0]\n"
]
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import math\n",
"import sys\n",
"import random\n",
"import time\n",
"print(sys.version)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The purpose of this practical work is to simulate a basic compartmental model on a contact network, observe a few features of the spreading model and see the influence of some structural properties. \n",
"\n",
"Disclaimer: this model is very simplified and is not supposed to be a realistic representation of an epidemic spreading in a population."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise 1: basic spreading simulation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Before starting, download the (undirected) graph http://lioneltabourier.fr/documents/contact_network.txt and load it as usual in the table of adjacency lists. We will use it as the contact network which supports the spreading phenomenon.\n",
"\n",
"FYI, it contains 16264 nodes and 95188 edges."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Question 1\n",
"\n",
"We implement a SIS model, meaning that an agent (a node) can be either susceptible ($S$) or infected ($I$). The model is set in this way:\n",
"\n",
"- initially, 1% of the nodes are infected i.e. 162 nodes, randomly chosen,\n",
"\n",
"- at each time step $t$ an $I$ node can infect a $S$ neighbor with a probability $ p_{inf} $,\n",
"\n",
"- at each time step $t$ an $I$ node can also go back to status $S$ with a probability $ p_{rec} $.\n",
"\n",
"Simulate about 1000 time steps of the model and plot the population of $I$ nodes as a function of $t$, with parameters $ p_{inf} = 0.005 $ and $ p_{rec} = 0.1 $ (I advise you to start with less time steps to check if your code scales up to 1000 time steps.)\n",
"\n",
"Do the same thing with 3 to 5 different groups of initial infected nodes (the seed group) and plot the curves preferably on the same figure. What property raised in the course do these curves illustrate?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Question 2\n",
"\n",
"Now, choose a specific seed group and run the model keeping $ p_{rec} = 0.1 $, but changing the value of $ p_{inf}$.\n",
"\n",
"What different behaviors do you observe? Plot the number of $I$ nodes as a function of $t$ for the different cases that you have observed."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise 2: immunization of the population\n",
"\n",
"Now, we model vaccination strategies in the population. We consider that a vaccinated agent cannot be infected (nor transmit the infection)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Question 3\n",
"\n",
"Suppose that $k$ nodes are randomly vaccinated at step $t=0$, and simulate the spreading with the parameters of Q1.\n",
"\n",
"Try several values for the number of agents vaccinated. How many agents need to be vaccinated in order to reduce by approximately half the maximum number of people infected simultaneously? "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Question 4\n",
"\n",
"Now we implement a targeted vaccination process which has been proposed in the literature: as it is hard to find the top degree nodes of the whole graph, we select random nodes and then look for their highest degree neighbor, this neighbor is vaccinated.\n",
"\n",
"Answer the same questions as in Q3 with this targeted vaccination process. "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}