TU-Graz: 706.716 Web Science

Network Analytics and Epidemics

This example demonstrates (i) how to generate and analyse networks with specific structure and (ii) how to implement an epidemic model on these networks.

Read carefully what you need to accomplish for this exercise. You need to submit your source code and your plots. For plotting, use the provided functions in the Python template.


You will implement two networks using graph generator functions from NetworkX. You need to initialize both networks with your student number (matriculation number) as seed:

  1. Implement a power law network with N=100 nodes and 950 edges using the graph generator function powerlaw_cluster_graph from NetworkX.
  2. Implement a small world network with N=100 nodes and 5 cliques with 20 edges using the graph generator function connected_caveman_graph from NetworkX.

This functionality is already provided by HelperClass.generateGraph.

Part A

In Part A, you compute and plot interesting network quantities on the networks you generate. You can use all functions from NetworkX for your implementation. You will compute and plot the following network quantities:

  1. Degree distribution
  2. Clustering coefficient distribution.
  3. Shortest path distribution.
  4. Plot all three distributions in a separate plot with the function provided in the python template.

Part B

In Part B, you will use both networks that you generated in Part A to implement two SIR models: one on each network. The SIR model divides the population of the N=100 nodes in your networks into three groups: susceptible (S), infected (I), and resistant (R) nodes. Implement the SIR models as follows:

  1. Initialize the models with a single infected node.I_0, chosen at random. All other nodes are in state S, i.e. susceptible. No single node is recovered, i.e. in state R
  2. Set the infection rate beta: 0.1
  3. Set the recovery rate gamma: 0.05
  4. All other nodes are initially susceptible S_0 = N - I_0 - R_0.
  5. Iterate the models 10 000 times
  6. At each iteration, update the status S, I, R for one node
  7. Every 100th time step the number of infected, susceptible and recovered should be measured and the values should be saved in the corresponding lists (susceptibles, infected, recovered)
  8. Plot S, I, R using the function provided in the python template.