Welcome! This project provides Python code for generating and solving systems of equations describing a specified compartmental model on a specified graph (network).
This project is used in a publication1 that assesses more broadly this approach to compartmental modelling on graphs. There is documentation throughout the Python code, but to get started you should read the next section.
- Go to
equation.__init__.pyto see an example of how equations can be generated (and printed), initial conditions can be specified and equations solved for these conditions.- Models can be specified with a graph (we use
networkx) and a compartmental model (we use a simplified version ofCModel). - Compartmental models can be as simple as SIR (
model_params.CModelcontains a getter method for the usual form of this) - Graphs can be generated using
networkxmethods for simple graph classes or user-specified - Initial conditions can be generated using helper methods - see example usage in the
__init__file
- Models can be specified with a graph (we use
- If you'd like to compare to a Monte Carlo simulation, go to
monte_carlo.equation_MC_comparison.pyfor examples used in the associated publication
- Use
PYTHONPATH=src python -m experiments.run_experiments --helpto discover the CLI for running larger runtimes, including 100-vertex graphs, multiple graph families, and long timeouts. Experiments can be described ad-hoc via flags or via a JSON file (seeexperiments/config.py). - If
--configis omitted the runner automatically consumessrc/experiments/default_config.json, which spans Erdős–Rényi, Barabási–Albert, Watts–Strogatz, random regular, and random geometric graphs at 100 vertices with extended timeouts. - Results are appended to
data/experiment_results.csvby default; override with--output.
- Prepare a JSON configuration with the experiments to run (e.g.
experiments.json). - Stage and launch the code on the remote machines with
python -m deployment.remote_launcher --gateway <gateway-host> --local-config experiments.json. - The launcher syncs the repository to
~/DynamicalGraphModelon the head node, uploads the JSON config, and starts partitioned runs across the compute nodes vianohup, writing logs to~/DynamicalGraphModel/logsand results to~/DynamicalGraphModel/data/remote_results.csv. - Pass
--dry-runto inspect the exact SSH/rsync commands without executing them, and adjust--pythonor--compute-nodesif a custom environment is required.
Footnotes
-
Ethan Hunter, Jessica Enright, Alice Miller, Feasibility assessments of a dynamical approach to compartmental modelling on graphs: Scaling limits and performance analysis, Theoretical Computer Science, Volume 980 (2023), doi.org/10.1016/j.tcs.2023.114247 ↩