Incorporating Disease and Population Structure into Models of SIR Disease in Contact Networks

We consider the recently introduced edge-based compartmental models (EBCM) for the spread of susceptible-infected-recovered (SIR) diseases in networks. These models differ from standard infectious disease models by focusing on the status of a random partner in the population, rather than a random individual. This change in focus leads to simple analytic models for the spread of SIR diseases in random networks with heterogeneous degree. In this paper we extend this approach to handle deviations of the disease or population from the simplistic assumptions of earlier work. We allow the population to have structure due to effects such as demographic features or multiple types of risk behavior. We allow the disease to have more complicated natural history. Although we introduce these modifications in the static network context, it is straightforward to incorporate them into dynamic network models. We also consider serosorting, which requires using dynamic network models. The basic methods we use to derive these generalizations are widely applicable, and so it is straightforward to introduce many other generalizations not considered here. Our goal is twofold: to provide a number of examples generalizing the EBCM method for various different population or disease structures and to provide insight into how to derive such a model under new sets of assumptions.


Introduction
In [5], we introduced the edge-based compartmental modeling approach for infectious disease spread. We showed how to create models that account for social heterogeneity and contact duration simultaneously. However, there are many other important effects that govern the spread of disease through a population which were not considered. For example it is well-established that for diseases such as influenza, heterogeneities in infectiousness/susceptibility and biases in mixing among age groups plays an important role [12]. Further, it is widely believed that for some diseases there are different stages of infection that have population scale impacts such as a highly infectious early phase followed by a chronic less infectious phase as in HIV [10] or a latent uninfectious early phase followed by an infection active phase as in Tuberculosis. If there is structure within a population or within the progression of disease is important for our models to incorporate the details.
Many of these effects have been studied under mass action mixing assumptions. In this paper we show that a range of assumptions can be reliably and simply captured by edge-based compartmental models. We begin by rederiving the simplest such model for Configuration Model networks. We then look at a number of different population or disease structures, summarized in Table 1, and show how to develop an edge-based compartmental model incorporating these effects. The effects in the list are chosen to demonstrate the flexibility of the approach. It is by no means exhaustive, and it is not difficult to combine different effects. These model populations are mostly static, and we describe them in the Configuration Model case, but it is straightforward to adapt these effects to other static or dynamic networks. Because of its epidemiological importance, we end the paper by showing a model incorporating serosorting where the population structure changes in response to the disease. This is inherently a dynamic network process, so we must use a dynamic network model to study it.

The basic model
The static models we present here are all generalizations of the basic Configuration Model (CM) static network epidemic model. To set the stage, we first define a CM network [6,7,8,1]. Because we will use the same underlying approach, we also briefly describe the method of [5].
In a CM network, each individual is represented by a node which is connected to other nodes by edges which can transmit disease. To construct the network, each node is assigned a number of edges (it's degree) k with probability P (k). The edges connect randomly to other neighbors using proportional mixing, so that the probability of selecting a neighbor of degree k is kP (k)/ K where K denotes the average of k. It is convenient to define ψ(x) = k P (k)x k Note that ψ (x) = k kP (k)x k−1 and ψ (1) = K . When we considered the spread of epidemics in CM networks in our original paper [5], we used the flow diagram of figure 1. Here S(t) is the proportion of the population still susceptible, I(t) is the proportion infected, and R(t) the proportion recovered. Assuming we know S(t), the probability a random individual is susceptible, we are able to determine I and R by I = 1 − S − R,Ṙ = γI.
To calculate the probability a random individual is susceptible, we choose a random test node u uniformly from the population. We alter u so that if infected, u does not transmit to its neighbors. This helps us assume the status of its neighbors are independent, but does not affect the probability u is susceptible. We use θ to be the probability that a random neighbor v of u has not transmitted infection to u, and we break θ into three parts: φ S , φ I , and φ R , which are the probability v is still susceptible, the probability v is infected but has not transmitted to u, and the probability v is recovered and did not transmit to u. Because the infection rate is β and the recovery rate is γ it is relatively straightforward to see that the fluxes from φ I to 1 − θ and φ R are βφ I and γφ I respectively. The calculation of the flux from φ S to φ I is less obvious. We have two options. We can calculate the flux directly or we can calculate φ S explicitly as was done in [5]. The first option is more general, but the second is simpler.
The flow diagram of figure 1 givesθ = −βφ I The remainder of our derivation focuses on finding φ I . Because Thus we simply need to calculate φ S and φ R in terms of θ to find φ I in terms of θ. To calculate φ S , we use the fact that the probability a neighbor v has degree k is kP (k)/ K . Since u is prevented from Figure 1: Flow diagram for Configuration Model networks. To find θ, we must find φ I . We do this by calculating φ S explicitly which is ψ (θ)/ψ (1). Because the flux into φ R and 1 − θ are proportional, we can find φ R in terms of θ. We then use φ I = θ − φ S − φ R , and we are able to find a differential equation for θ in terms of θ.
infecting v, the probability v is susceptible given its k is θ k−1 . Thus φ S is a weighted average of this, To calculate φ R , we look at figure 1. The fluxes into φ R and into 1−θ are proportional to one another, with the proportionality coefficient γ/β. Since they both begin at 0, this means φ R = γ(1 − θ)/β. Consequently This leads toθ Thus we have the system of equationṡ which has just two ordinary differential equations (ODEs). In fact (2) does not depend on (3), so the system is governed by the single ODE (2).

Generalizing the model
In the following, we generalize the model for many static network situations. The basic approach is to consider a random test node which is prevented from causing infection. Then consider the edges which could transmit infection to it. We determine the probability the edges have not transmitted, which may depend on the test node, the neighbor, or details of the contact. Our approach to determining this probability is the same as above. Once we know the probability any given edge has not transmitted to the test node, we can calculate the probability that the test node is susceptible, from which we can calculate the proportion of the population that is susceptible, infected, or recovered.  Figure 2: Directed CM model. Flow diagram for a network with directed and nondirected edges. We consider the two edge types separately. The evolution of edges is similar to figure 1. We can assign different infection rates for each edge type.
they come into contact only because of the patient's infection. The probability and final size of epidemics for this scenario have been studied previously [3], but not the dynamics. We can investigate the dynamics in almost the same manner as before. Assume that the network consists of both directed and nondirected edges. The disease can transmit along a directed edge only following the edge direction, while nondirected edges may be followed in either direction. Let β d and β n denote the rate of transmission along directed and nondirected edges respectively. Recovery occurs at rate γ regardless of how infection is transmitted.
We refer to edges pointing to a node of interest as in-directed, and those pointing away as out-directed edges. The probability of having k i in-, k o out-, and k n nondirected edges is given by P (k i , k o , k n ). We define ψ(x, y, z) = ki,ko,kn We again consider a random test node u which is prevented from causing infection. We define θ d (t) and θ n (t) to be the probability an in-directed edge or nondirected edge to u respectively has not transmitted infection to u. The probability that u is still susceptible is ψ(θ d , 1, θ n ). We use the variables φ S,d , φ I,d , and φ R,d to be the equivalent of φ S , φ I , and φ R seen before for in-directed edges. Following the same approach as before we arrive at the flow diagrams in figure 2. Consider a neighbor v with a directed edge to u. Because of how v is chosen, the probability it has k i in-, k o out-, and k n nondirected edges is in terms of θ d and θ n . This gives usθ d in terms of θ d and θ n . A similar expression holds forθ n . We havė To this we addṘ = γI S = ψ(θ d , 1, θ n ) to give us the proportion of susceptible, infected, and recovered individuals.
If the system only has directed edges, then we can drop θ n from the analysis and ψ(x, y, z) reduces to ψ(x, y). Such a model could be used to study the impact of superspreaders where the probability of receiving infection from an infected node is similar for all nodes (in-degrees are similar), but some nodes have many more neighbors to infect than others (high variance in out-degree).

Example
Consider a population for which the average in-degree, out-degree, and nondirected degrees are eachk as follows: Each node has in-degreek. The out-degree k o is uniformly chosen from 0 up to 2k inclusive, and the nondirected degree is 2k − k o . For this population,

Heterogeneous infectiousness and susceptibility
Assume now that there is a parameter α which measures a node's ability to become infected and cause infection, but does not influence the contact structure of the population. We refer to the value of α for a node as its type, and the probability a node has a given type α is Q(α). The recovery rate γ α of a type-α node and the transmission rate β α,α from a type-α node to a type-α node are type dependent. The final size for a special case of this model where a node's infectiousness and susceptibility are uncorrelated is given in [4]. Consider a random test node u of type α. Let θ α,α denote the probability that an edge from a type-α neighbor v to u has not transmitted infection from v to u, and similarly φ S:α,α the probability v is still susceptible, φ I:α,α the probability v is infected but the edge has not transmitted, and φ R:α,α the probability that v has recovered without transmitting. We define θ α = α θ α,α Q(α ) as the probability that a random edge to u has not transmitted infection to u. We use the original definition of ψ(x) = k P (k)x k .
We find that v is susceptible with probability φ S:α,α = k kP (k)θ k−1 α / K = ψ (θ α )/ψ (1). We also find that φ R:α,α = γ α (1 − θ α,α )/β α,α . Then the flow diagram in figure 4 shows thaṫ Figure 4: Heterogeneous infectiousness/susceptibility model. We separate nodes by type α, but assume that α has no effect on connectivity. Both infectiousness and susceptibility may depend on α. We must consider edges between each pair of types α and α separately. The evolution of edges is similar to before. The probabilities a type-α node is still susceptible, infected, or recovered satisfẏ The total population in each state is given by

Example
One application of this model is to the impact of a partially effective vaccination. Vaccination generally reduces the susceptibility of a node, but could either increase or decrease the infectiousness of a node by reducing the severity of symptoms (less sick individuals may shed less virus but also maintain stronger contact intensity while symptomatic). If only part of the population is vaccinated, then the population can be divided into those who have or have not received vaccination. Consider a population with a negative binomial degree distribution NB(3/2, 8/9) with size r = 3/2 and probability p = 8/9, giving an average degree of pr/(1 − p) = 12 and variance of pr/(1 − p) 2 = 108. For a Ij Rj γjIj Figure 6: Assortative mixing by type model. We separate nodes by type. We assume that type may influence infectiousness and susceptibility as well as connections. For simplicity, we assume a finite number of groups. The resulting system is similar to our result for correlated infectiousness and susceptibility, except in the impact on contacts.
Assume that half of the population has received a leaky vaccine such that vaccinated nodes have reduced susceptibility, and -if infected -reduced infectiousness and infection duration. Let γ be the rate of recovery for unvaccinated nodes and β the rate of infection between unvaccinated nodes. Vaccinated nodes recover at rate 2γ, and the rate of infection between a vaccinated and unvaccinated node (in either direction) is β/2 while the rate of infection between two vaccinated nodes is β/4. The vaccine is distributed uniformly. Results for β = 0.3, γ = 0.5 are shown in figure 5.

Populations with assortative mixing by type
In many instances there is biased mixing between or within demographic groups, and the transmission/recovery parameters for the different groups may differ. For example, the spread of influenza is strongly affected by the increased level of mixing and increased infection rates between children. Many sexually transmitted diseases are strongly affected by differences in mixing rates and risk behavior among MSM and heterosexual groups. For this reason it is useful to have a model accommodating different levels of mixing within and between groups. The model we derive in this section is equivalent (though simpler) to that of [11]. Assume that the population is made up of M groups, and let P j (k 1 , k 2 , . . . , k M ) denote the probability a node of group j has k l contacts with nodes of group l for l = 1, . . . , M . To simplify notation, we denote this by P j (k) where k = (k 1 , k 2 , . . . , k M ). We similarly set x = (x 1 , x 2 , . . . , x M ) and use x k to denote and let β j,l be the rate of transmission across an edge from group l to group j. We similarly define γ j to be the recovery rate of a group j node. Define θ j,l to be the probability an edge to a group j node coming from a group l node has not transmitted infection. If our test node u is of type j, then the probability that a neighbor v of type l is still susceptible is φ S:j,l = k k j P l (k)θ k1 l,1 θ k2 l,2 · · · θ kj −1 l,j · · · θ k M l,M / k k j P l (k) = ∂ ∂xj ψ l (θ l )/ ∂ ∂xj ψ l (1) where θ l denotes the vector (θ l,1 , θ l,2 , . . . , θ l,M ) and 1 denotes the vector (1, 1, . . . , 1). We can also show that v has recovered without transmitting to u with probability φ R:j,l = γ l (1 − θ j,l )/β j,l . Figure 6 givesθ j,l = −β j,l θ j,l + β j,l ∂ ∂xj ψ l (θ l ) ∂ ∂xj ψ l (1) The denominator ∂ ∂xj ψ l (1) is simply the average of k j for nodes of group l. We finḋ As a special case, we can consider a population where the number of contacts a node has with one group is assigned independently of the number that node has with any other group. We set P j,n (k) to be the probability a node of group j has k edges to a node of group n and define ψ j,n (x) = k P j,n (k)x k . Then ψ j (θ j ) factors and may be written as ψ j,1 (θ j,1 )ψ j,2 (θ j,2 ) · · · ψ j,M (θ j,M ). In this special case we geṫ

Example
To demonstrate the ability to capture demographic information, we consider a population made up of two groups, which we arbitrarily label children and adults. The between-group degrees are binomially distributed with Bi(4, 1/2), so that the average between-group degree is 2. An adult's within-group degree equals its between-group degree. In contrast, a child's within-group degree is given by 5 times its between-group degree. Thus people with higher between-group degree have higher within-group degree. We get We set the disease parameters to be The results are shown in the top of figure 7.
We repeat with the same parameters, but this time with the correlations in degree switched so that higher between-group degrees implies lower within-group degrees. An adult's within-group degree is 4 −k wherek is its between-group degree. A child's within-group degree is 5 (4 −k) wherek is its between-group degree. We have The results are shown in the bottom of figure 7. The distribution of within and between-group contacts in the two populations are the same. The only distinction is that the correlations of within and between-group contacts are different. This results in differences in the course of the epidemics. A mass action model could not distinguish between the populations.
In both cases the disease spreads quickly through the child population. Early on the spread in adults is driven largely by the explosive growth in children. Because of the correlations of adults' within and between-group degrees, those adults who are infected by children in the first scenario tend to have more adult contacts and infect high-degree adults who in turn infect more high-degree children. In the second scenario however, infected children tend to infect fewer adults who tend to have fewer adult contacts. The disease does not grow as quickly, but it also decays less quickly because more high degree nodes remain.

Multiple modes of transmission
Rather than having different types of nodes, there may be multiple modes of transmission with different mixing and infection rates for each mode. For example, HIV may spread through sexual contact and needlesharing. The sexual contact network may have little to no relation to the needle-sharing network. Assume there are M types of contacts and that the rate of transmission along contacts of mode j is given by β j . Let the joint distribution of the number of each mode of contacts be given by P (k) where k = (k 1 , k 2 , . . . , k M ). Assume recovery rates are independent of how infection was acquired. We set x = (x 1 , . . . , x M ) and denote x k1 We can apply the same method to each edge type as shown in figure 8. We set φ S,j to be the probability that an edge of type j connects the test node to a susceptible neighbor. If θ j is the probability a contact of type j has not yet transmitted infection, we set θ = (θ 1 , θ 2 , . . . , θ M ). We find φ S,j = ∂ ∂xj ψ(θ)/ ∂ ∂xj ψ(1) and similarly the probability an edge of type j connects to a recovered neighbor which did not transmit is φ R,j = γ(1 − θ j )/β j . As before we find S(t) = ψ(θ). We havė In the case where the degree with respect to one contact type is independent of that with respect to another, we can simplify equation (13) to be similar to equation (12).

Example
We consider a population with three different types of contacts. We take k 1 , k 2 , and k 3 to denote the number of each type of contact a node has. We assume that contact type 1 is binomially distributed with Bi(2, 0.5) (giving a mean of 1). Contact type 2 is geometrically distributed, with mean 2. Contact type 3 has a negative binomial distribution NB(1, 1/4) with mean 1/3 and variance 4/9. The numbers of contacts an individual has of each type are assigned independently. We find We take γ = 1 and set β 1 = 1, β 2 = 0.5, and β 3 = 3 for each contact type. We compare simulation and theory in figure 9.  Figure 10: Multiple infectious stages model. Flow diagram for a disease with several infected stages. When a disease progresses through several states (or has an infectious period that is not exponentially distributed) it is convenient to use a stage-progression model to represent the state of an edge.

Multiple infectious stages
There are a number of diseases with multiple infectious stages such as Tuberculosis and HIV. Some diseases begin with a non-infectious latent phase, some begin with a highly infectious acute stage before settling into a long-term chronic stage, and others oscillate between phases of high and low infectiousness. To model such situations we adapt a standard chain progression model, for which there are M infectious phases shown in figure 10. We are not able to explicitly solve for all variables in terms of θ, so we must find the fluxes between the compartments. We can still find φ S = ψ (θ)/ψ (1), so we are able to find φ I,1 in terms of the other variables using φ S + φ R + j φ I,j = θ. We obtaiṅ Where I j is the proportion of the population in the j-th infectious class.

Example
Consider now the spread of a disease for which there are three infectious stages. The first stage is moderately infectious but not long, with β 1 = 0.2, γ 1 = 1. The second stage is much longer, but has a substantially lower infectiousness, with β 2 = 0.01 and γ 2 = 0.08. The final stage has an intermediate duration but substantially higher infectiousness, with β 3 = 2 and γ 3 = 0.4. We assume that the disease spreads in a population with The results are shown in figure 11.

Dynamic Networks and Serosorting
For some diseases, it is not uncommon for individuals to actively seek out contacts of similar disease status (as in HIV [9] or Leprosy [2]) or even discordant status (as in "chicken pox parties" or "swine flu parties"). This is commonly known as serosorting. To study these populations, we must use dynamic network models, which we developed in [5].
We study serosorting in two models. In the first, we use an "actual degree" model where an individual has a given number of potential contacts, of which only a proportion are active at any given time. In the second, we use an "expected degree" model in which individuals break any existing contacts at a fixed rate, but different individuals may create contacts at differing rates leading to a variation in the expected number of contacts across the population.
For simplicity, we will assume that there is no recovered class, and once infected an individual remains infected. This restriction is easily removed, but by using it, we are able to simplify the model and reduce the number of parameters needed. We again consider a test node, and as before we assume that if infected the test node does not cause any infections. We make an additional assumption that if infected the test node continues to behave as if it were susceptible, and that its potential neighbors treat it as if it were susceptible. We can think of the test node as an individual who is immune, but is unaware of that immunity, and we track the probability that the test node has not yet received a sufficient dose to infect a non-immune individual.

Actual Degree Serosorting model
In the actual degree formulation, we think of an individual as having k stubs or half-edges. These stubs may be active (and connected to another node's stub) or dormant (and available to form new edges).
When an edge breaks, the corresponding stubs enter a dormant phase. We assume that the rate a dormant edge belonging to a susceptible individual finds a new susceptible neighbor is η 1,SS , and the rate it finds a new infected neighbor is η 1,SI . These may depend on the density of susceptible and infected individuals in the population. Similarly, active edges break at rates depending on the status of the nodes. Edges between susceptible nodes break at rate η 2,SS , edges between a susceptible and infected node breaks at rate η 2,SI , and edges between infected nodes break at rate η 2,II .
We define φ S , φ I , φ R , and φ D to be the probability that a stub belonging to the test node u has never been part of an edge that transmitted infection to u, and that the stub is currently connected to a susceptible, infected, or recovered node or is dormant respectively. The fluxes between these states are shoen in figure 12. Unlike in previous cases, we are unable to explicitly calculate φ S , so we must track the flux into and out of φ S . The fluxes between φ S and φ D are straightforward. However, the flux from φ S to φ I requires more attention. We repeat our derivation from [5]. Consider a neighbor v of the test node u having the following properties: the stub belonging to u never transmitted to u prior to joining with the stub belonging to v, and similarly the stub belonging to v never transmitted to v prior to joining with the stub belonging to u. Given this, the probability v is susceptible is q = k kP (k)θ k−1 / K = ψ (θ)/ψ (1). Thus, given that v is susceptible, the rate v becomes infected is Thus the flux from φ S to φ I is βφ S φ I ψ (θ)/ψ (θ), the product of φ S , the probability that a stub has not transmitted infection to the test node and connects to a susceptible node, with βφ I ψ (θ)/ψ (θ), the rate that the neighbor becomes infected given that the stub has not transmitted and connects to a susceptible node. We need to account for the number of stubs that are in edges between different classes of nodes or are dormant. We use M SS to be the proportion of all stubs that are in edges between susceptible nodes. Equivalently this is the probability that a stub is active, connects to a susceptible node, and belongs to a susceptible node: M SS = φ S ψ (θ)/ψ (1). We similarly define M SI to be the proportion of all stubs that are in edges between a susceptible and infected node. We calculate this by finding the probability a stub is active, connects to an infected node, but belongs to a susceptible node but we must multiply by 2 because this only counts one stub in each edge. We get M SI = 2φ I ψ (θ)/ψ (1) . We also define M II to be the proportion of all stubs in edges between infected nodes. We will calculate its value later. We set π S to be the proportion of stubs that are dormant and belong to susceptible nodes and π I to be the proportion of stubs that are dormant and belong to infected nodes. The value of π S can be calculated as for the dormant contact case to be π S = φ D ψ (θ)/ψ (1). The value of π I is calculated by finding the fluxes out of the other states. Once we have all of these variables, we have M II = 1 − M SS − M SI − π S − π I .
Following figure 12 we finḋ π I = η 2,SI (π S , π I ) 2 M SI − π S η 1,SI (π S , π I ) + η 2,II (π S , π I )M II − π I η 1, Figure 12: Fixed-degree serosorting model. Flow diagram showing the interplay involved in serosorting with fixed-degree. We do not consider a recovered class, which simplifies the equations. The framework can be adapted to include a recovered class. The M variables represent the total proportion of stubs involved in edges between the two types and the π variables are the proportion of dormant stubs belonging to nodes of each type. The φ variables are as before. For the right hand side, we are able to determine most of the variables analytically, so we only need the fluxes into and out of π I . We expect that the edge breaking and rejoining rates η will depend on values of π S and π I .
where η 1,SS , η 1,SI , η 1,II , η 2,SS , η 2,SI , and η 2,II are likely to depend on π I and π S and may depend on the other quantities. What form that dependence takes is determined by the behavior of the population. This completes the derivation of the equations for the actual degree formulation of serosorting.

Variable Degree Serosorting model
In many populations, it is reasonable to assume that individuals create and break contacts without regard to whether contacts already exist. Consequently, the concept of having a fixed number of stubs is inappropriate. For these populations, we assume that in the absence of disease all contacts will have the same expected duration but different individuals will create new contacts at different rates, resulting in some having higher or lower average degrees. In [5], we used κ to be the expected degree of a node. However, when behavior changes based on infection status, the expected degree of individuals can change. Instead, we refer to κ as the desired degree because depending on how sorting happens, it may not be possible for a node to have expected degree κ. However, κ will represent the expected degree of an individual if there were no infection present. We again use S and I to be proportions of the population. Π S and Π I measure the proportion of desired contacts which belong to susceptible or infected individuals: Π S = s κ κρ(κ) dκ, Π I = i κ κρ(κ) dκ where s κ and i κ denote the proportion of individuals with desired degree κ who are susceptible and infected respectively. We assume that the population behavior proceeds as before, but an uninfected node will end and form contacts with different rates for infected or susceptible neighbors. There are many ways in which this could be modeled. We will assume that a susceptible individual with desired degree κ acquires new susceptible contacts at rate κη 1,S Π S and new infected contacts at rate κη 1,I Π I , where both η parameters may depend on Π S and Π I . Similarly, a susceptible individual will end an existing contact with another susceptible and with an infected individual at rates η 2,S and η 2,I respectively (where again both η parameters may depend on Π S and Π I ). We assume that η 1,S and η 2,S are equal if Π I = 0 so that in a disease-free population an individual's expected and desired degrees coincide. Figure 13: Variable-degree serosorting model. Flow diagram showing the interplay involved in serosorting. We do not consider a recovered class, which simplifies the equations significantly. The framework can be adapted to include a recovered class. The Π variables give the proportion of contacts that would be formed with susceptible or infected individuals assuming that their behavior is not altered by disease. The Φ variables are the probability that a current contact of the test node is with an individual of given type, under the assumption that the test node always behaves as if susceptible, and does not transmit to its neighbors. We expect that the edge breaking and rejoining rates η will depend on values of Π S and Π I .
We need to add variables in order to track the probability of having existing edges connecting to susceptible or infected nodes. Consider a test node u 1 with desired degree κ, and another u 2 with desired degree κ + ∆κ. We define Φ S ∆κ to be the expected additional number of edges to susceptible neighbors that u 2 would have and Φ I ∆κ to be the expected additional number of edges to infected neighbors which have not transmitted that u 2 would have. We take the values of Φ S and Φ I in the ∆κ → 0 limit. In the cases considered in [5], the value of Φ S and Π S were the same. However, because there is active selection of neighbor based on disease status, in this case Φ S = Π S . The resulting flow diagram is shown in figure 13. We must find the flux from Φ S to Φ I . Consider a random test node u and look at a randomly chosen susceptible neighbor v. Given the desired degree κ v of v, the rate that v becomes infected is βΦ I κ v . We need to determine the expected value of κ v given that v is a susceptible neighbor of u. We first note that the probability density function for the neighbor to be susceptible and have degree κ is proportional to q(κ) = e −κ(1−Θ) κρ(κ)/ K with some proportionality constant a. So in order to calculate the expected value of the desired degree we take aκq(κ)dκ/ aq(κ)dκ. This simplifies to Ψ (Θ)/Ψ (Θ). So the flux from Φ S to Φ I due to infection of the neighbor is βΦ S Φ I Ψ (Θ)/Ψ (Θ) We findΘ = −βΦ I So an SI epidemic in a population with serosorting can be captured by a system with just three ODEs.

Discussion
We have applied the edge-based compartmental model approach introduced in [5] to diseases and populations with different structures. With the exception of serosorting we focused our attention on static CM networks.
We have considered each variation in isolation. However it is possible to adapt the approach to a disease for which several of these issues are considered simultaneously in any of the network classes discussed in [5].
In general, we can adapt most existing mean-field/mass-action style SIR models in a closed population to the spread of infectious disease through a network. When we do this, we get a φ variable corresponding to each of the S, I, or R variables in the usual model. We take the usual flow diagram for S, I, and R and adapt it to give the fluxes between the φ variables. We add one more compartment 1 − θ, and flux goes from each of the potentially infectious φ variables to 1 − θ. This approach produces an accurate model for disease spread through the modeled population.