Network Diffusion Library - (for NetworkX and iGraph)

NDlib provides implementations of several spreading and opinion dynamics models.
The project documentation can be found on ReadTheDocs.
If you use NDlib as support to your research consider citing:
G. Rossetti, L. Milli, S. Rinzivillo, A. Sirbu, D. Pedreschi, F. Giannotti. NDlib: a Python Library to Model and Analyze Diffusion Processes Over Complex Networks. Journal of Data Science and Analytics. 2017. DOI:0.1007/s41060-017-0086-6 (pre-print available on arXiv)
G. Rossetti, L. Milli, S. Rinzivillo, A. Sirbu, D. Pedreschi, F. Giannotti. “NDlib: Studying Network Diffusion Dynamics”, IEEE International Conference on Data Science and Advanced Analytics, DSAA. 2017.
To install the library just download (or clone) the current project and copy the ndlib folder in the root of your application.
Alternatively use pip:
sudo pip install ndlib
NDlib includes a browser-based dashboard service for quick, code-free experimentation with diffusion and opinion models.
The dashboard lets you:
SIR, Algorithmic Bias, Majority Rule, and a coupled starter layoutInfected class when the selected use case does not require oneRun it from the repository root with:
python ndlib/dashboard/server.py
If the package is installed, you can also launch it with the bundled command:
ndlib-dashboard
Once the server starts, open the local URL printed in the terminal.
| Configuration view | Network view |
|---|---|
![]() |
![]() |
NDlib includes an interactive Visual Model Builder that allows designing custom compartmental models by drag-and-drop using a node-graph workflow. Visual models are compiled to standard Python classes and NDQL (Network Diffusion Query Language) scripts, and can be simulated or deleted directly from the dashboard.
The builder now starts from a use-case selector:
Custom opinion starters now initialize their own statuses directly, so they no longer inherit the epidemic-only Infected requirement from the base diffusion model.
Starter templates are provided for the most common layouts, so you can begin from a working example instead of a blank canvas.
Draggable building blocks include:
| Use-case-aware Builder |
|---|
![]() |
The sidebar also includes:
See the full builder guide in docs/visual_model_builder_opinion_epidemic_guide.md.
For examples, tutorials and a complete reference visit the project documentation website on ReadTheDocs.
If you would like to test NDlib functionalities without installing anything on your machine consider using the preconfigured Jupyter Hub instances offered by SoBigData RI.
Interested in an extensive tutorial on NDlib? Check out the official Jupyter Notebooks!
NDlib is an active project, any contribution is welcome!
If you like to include your model in NDlib feel free to fork the project, open an issue and contact us.
Contributing is good, doing it correctly is better! Check out our rules, issue a proper pull request /bug report / feature request.
Do you want to be part of the NDlib community to discuss enhancements, desiderata, bug fix? Join us on Slack!
We are a welcoming community… just follow the Code of Conduct.