Skip to content

3lectrologos/sna

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simulating disease spread in social networks

Final project of the Introduction to Social Network Analysis course (ETH Zurich, Spring Semester 2012).

Author

Alkis Gkotovos (alkisg@student.ethz.ch)

Dependencies

Required python packages: matplotlib, networkx, numpy, progressbar

For example, using python's easy_install from setuptools on Ubuntu:
pip install matplotlib networkx numpy progressbar

Description and usage example

Python script diffuse.py implements the SIMR model for disease spread. If run as the main script, it generates all plots used in the report. Alternatively, it can be imported and used in other modules, as shown in the example below.

# Import SIMR module and matplotlib for plotting
import diffuse
import matplotlib.pyplot as plt

# Create a new Erdos-Renyi graph with n = 50 and p = 0.1
# with 10% initially infected nodes (randomly chosen)
g = diffuse.Simr(gtype='ER', gparam=[50, 0.1], k=0.1)

# Plot graph state
g.plot()
plt.show()

# Simulate for 20 steps and plot again
for i in range(20):
    g.step()
g.plot()
plt.show()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages