Contributor Guide#
We’d love your help! If you’d like to make an addition or improvement, please submit a pull request consisting of an atomic commit and a brief message describing your contribution.
Adding New Source Inference Algorithms#
Your algorithm should occupy its own file
your_algorithm_name.pywithin eithersource_inference/single_sourceorsource_inference/multiple_source, as appropriate.Import your algorithm
from .your_algorithm_name import *in eithersource_inference/single_source/__init__.pyorsource_inference/multiple_source/__init__.py, as appropriate.Add an entry for your new algorithm to
utils/algorithm_details.json. Minimally, this should include details forepidemic modelandinformation type. If possible, inclusion of a manuscript/pre-print/ArXiv link is desirable so that users may freely review the resource.The entry for
rumor_centralityis illustrated below:"rumor centrality": { "epidemic model": ["si", "ic"], "information type": "single snapshot", "reference": { "publication link": "https://devavrat.mit.edu/wp-content/uploads/2017/10/Rumors-in-a-network-whos-the-culprit.pdf", "manuscript link": "https://core.ac.uk/download/pdf/4434717.pdf" }, "status": "complete", "namespace": "cosasi.single_source.rumor_centrality" }
Naming Conventions#
When writing source inference algorithms, we follow a few naming conventions for the arguments. Here is a non-exhaustive list:
Param |
Meaning |
|---|---|
G |
The original graph on which the infection process was run |
I |
The infection subgraph observed at a particular time step |
t |
the timestep corresponding to I |
number_sources |
the hypothesized number of infection sources |
Testing#
All code should be tested. We use pytest.
To run the test suite, run pytest via coverage:
coverage run -m pytest
To read the .coverage file:
coverage report
The output should look something like this:
Guidelines#
We defer to the contributor guidelines outlined by NetworkX.
Bugs#
If you find something wrong, please submit a bug report to the issue tracker.