This repository contains code to reproduce figures and data from the manuscript
"Comparing information diffusion mechanisms by matching on cascade size" by Jonas L. Juul and Johan Ugander.
To run these scripts, one should acquire the dataset of the spread of false and true news on Twitter. A link to these data can be found in the acknowledgment section of Vosoughi et al. DOI: 10.1126/science.aap9559.
Due to space constraints, synthetic cascade data files has not been uploaded to this repository. Instead, we have shared scripts to simulate such data.
The directory code
contains the code for the paper.
The jupyter notebook main_clean.py
is the main script. This reproduces all figures and tables from the paper. To run this notebook, you will need to
- Specify the path to the Vosoughi et al. data in the file
definitions_clean.py
. - Place the Goel data file in the folder
data-Goel
or specify another path in the notebookmain_clean.py
. - Download data of simulated SIR and IC processes and save the files to the correct subfolders. Instructions are found in the files
download_data_for_this_folder.txt
found in the directoriesIC_data
,IC_data/Network_simulations
,SIR_data
, andSIR_data/Network_simulations
.- Instead of downloading these data, you can also simulate SIR and IC processes on networks by
- Specifying edge-lists for the empirical networks.
- Running each
go
file in the foldersIC_data
andSIR_data
(and subfoldersNetwork_simulations
) - Running all Python files in the folders
IC_data
andSIR_data
(and subfoldersNetwork_simulations
).
You can also write me an email to obtain the SIR and IC data files.