tjhladish edited this page Jul 9, 2012 · 12 revisions

Welcome to the EpiFire wiki!

EpiFire is a C++ applications programming interface (API) that does two things:

  • Model the spread of an infectious disease in a population
  • Generate and manipulate networks of nodes and edges

While the network code can be used independently from the epidemiological code and vice versa—they are conceptually and functionally distinct—from the beginning, the libraries were developed to be compatible with each other. What EpiFire excels at is simulating the stochastic spread of disease on contact networks. An open-access manuscript describing EpiFire is available.

EpiFire’s finite, stochastic epidemic simulators:

Mass-action (Gillespie)

  • Continuous time
  • Very fast—simulations of 1 million individuals in < 1 second on a modern desktop computer
  • Closely match traditional compartmental (diff eq) models
  • Infectious period and time between transmission events are exponential random variables


  • No real time. Who gets infected is predicted, but not when or in what order.
  • Network-based
  • Still quite fast (500,000 individuals in < 1 second); usually generating the network takes longer than running the simulation
  • Important parameters include the network’s degree distribution and transmissibility (probability of transmission)


  • Discrete time, and specific chains of transmission are predicted
  • Network-based
  • Parameters include number of time steps in infectious period, the per-time step transmissibility, and the degree distribution
  • Slower: with an infectious period of 10 and a mean degree around 4, simulations with 50,000 people take about 1 second

Support for ordinary differential equation models:

  • Very fast deterministic models that assume an infinite number of individuals
  • SIR_Sim.h provides a traditional SIR differential equation model
  • Deterministic_Network_SIR_Sim.h, based on the work of Volz and Meyers, provides a deterministic epidemic model for infinitely large networks with a specified degree distribution

Additional details about network functionality:

The Network, Node, and Edge classes provide several dozen methods for constructing, manipulating, and describing networks.

Network input/output is done using edgelist files, where each line corresponds to one edge. For example, a file containing the line “1,2” means that Node 1 will be connected to Node 2. Node names can be just about anything, as long as they don’t contain the delimiter you specify. Nodes that are not connected to any others can be specified in the edgelist file by entering each node on a line by itself.

Network generators include the Erdos-Renyi algorithm (which generates Poisson random networks); the more generic configuration model, which an be used to generate random networks with Poisson, exponential, scale-free, or arbitrary degree distributions; the Watts-Strogatz small-world algorithm; and generators for square and ring lattices.

Visualizing large, randomly connected graphs is difficult, and graph visualization is not what EpiFire is designed to do. That said, it is possible to output a graph as a Graphviz input file. Graphviz is a highly customizable graph drawing program, but may not be useful for networks with thousands (or more) nodes.

Citing EpiFire

Hladish TJ, Melamud E, Barrera LA, Galvani A, Meyers LA. EpiFire: An open source C++ library and application for contact network epidemiology. BMC Bioinformatics. 2012 May 4;13(1):76.
PMID: 22559915

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.