# EoN Examples¶

We have collected a number of examples using **EoN** to generate figures. We
start with examples from the book
Mathematics of Epidemics on Networks: from Exact to Approximate Models. Then
we give a few other examples. If none of these examples helps with the particular
problem you are facing, Submit an issue or go to stackoverflow and use the ‘eon’ tag.

If you have an example you think would be useful here, please submit an issue or email me.

## Reproducing figures from “Mathematics of Epidemics on Networks”¶

Here are examples to generate (close approximations to) many of the figures in Mathematics of Epidemics on Networks: from Exact to Approximate Models. Other examples are farther down.

### Chapter 4¶

Homogeneous meanfield

### Chapter 5¶

Heterogeneous meanfield

For Chapter 5 figures, these examples use larger populations than the figures in the text.

Figures 5.3, 5.4, and 5.5 demonstrate the ease of the X_from_graph versions of the analytic equations

### Chapter 6¶

Percolation and EBCM

The remainder of these simulations use reduced sizes or numbers of iterations compared to the published figure. This is to save time.

### Chapter 9¶

Non-Markovian processes

For Chapter 9 (nonMarkovian) figures, we have not implemented code that solves the dynamic equations but we do have code that will do the simulations. These are given here.

## Additional Examples¶

### Visualizing or animating disease spread¶

We can visualize snapshots or animations of disease spread in a network. For these examples, we’ll take a 100x100 grid of nodes [each node is (i,j)] connected to their 4 nearest neighbors (except the nodes on the edges). This isn’t the most realistic network, but it is a good example for showing the automatic plotting tools.

The last example shows how we might plot things like `'I'+'R'`

or other combinations of
the data.

### Non-uniform infectiousness¶

Perhaps the population is made up of different types of individuals with different infectiousness. This example considers a heterosexual population where one group is more infectious than the other. This example includes a user-defined transmission function and uses the simulation investigation tools to look at the dynamics in each population.

### Weighted networks¶

You may have edges (or nodes) with weights affecting transmission or recovery rates. (for this be aware that the syntax of edge/node attributes is different for networkx 2.x and 1.x).

### Non-SIS/SIR processes with Gillespie_simple_contagion¶

The default Gillespie and Event-driven algorithms assume SIS or SIR dynamics. However, you may want something else, such as SEIR or SIRS or maybe more exotic things. If you are willing to assume that events all happen as Poisson processes (that is, an event happens at a rate), then it’s possible to do this with a Gillespie approach.

Note that right now if a node has an edge to itself, this can cause the code to crash. I will try to fix this soon.

### Other¶

Are you trying to do something but can’t figure it out and would like an example?

Submit an issue or go to stackoverflow and use the ‘eon’ tag. I’ll try to help.

If you have developed something that you think would make a good example and you’d like to share it, please let me know.