Products of Compartmental Models in Epidemiology

We show that many structured epidemic models may be described using a straightforward product structure in this paper. Such products, derived from products of directed graphs, may represent useful refinements including geographic and demographic structure, age structure, gender, risk groups, or immunity status. Extension to multistrain dynamics, that is, pathogen heterogeneity, is also shown to be feasible in this framework. Systematic use of such products may aid in model development and exploration, can yield insight, and could form the basis of a systematic approach to numerical structural sensitivity analysis.


Introduction
Simple epidemic models aim at insight through simplicity; complex models aim at realism through detail [1]. Both simple and complex models are still being developed (e.g., [2][3][4][5][6][7]). Addition of epidemiological refinements, such as age structure, gender, geographic separation, or pathogen strains, in general changes the behavior of simple models, and thus we must systematically compare models with different features.
In this paper, we show that many structured epidemic models may be described using a straightforward product structure. Such products therefore provide a compact representation for a family of related models and could facilitate model comparison and structural sensitivity analysis. Examples include modeling host susceptibility groups, gender, age structure, multiple subtypes, and geographic separation. Our attention will be restricted to compartmental models [8][9][10], focusing on mathematical epidemiology [10][11][12][13][14][15][16][17].
The product we describe is related to standard graph products. The relation between compartmental models and graph theoretic or network concepts has been long appreciated [18,19], and, moreover, Markov processes arising on product spaces have been analyzed by probabilists [20]. The graph structure arises when dynamical variables will be represented as vertices of a graph, representing the number of individuals in a given compartment. Individuals may change state, such changes being represented by an arc from one vertex to another, labeled with the instantaneous rate at which such a transition would occur.   A simple extension to include heterogeneous epidemic dynamics in multiple communities was introduced by Watson et al. [21,22]. In this model, no migration between communities is assumed. However, individuals in one community cause infection in other communities, with the structure seen in Figure where is the number of communities modeled. In the Watson model, in general the transmission coefficients may differ when considering transmission to susceptibles in one community from infectives in any community (whether the same or not). Each community is additionally assumed to have a different rate of removal of infectives due to mortality (or other causes), though these can be assumed to be identical if desired.
This model extends the one-community SI model, by structuring the population into multiple communities. In the following section, we will show that the structured model developed by Watson can be straightforwardly defined as the product of the single-community SI model and a model describing community structure. We will then illustrate other uses of this product, including age structure, gender, heterogeneity of risk, and cotransmission of multiple diseases.

Graph Products
A directed graph is defined as a set of vertices, each identified by a unique label, together with a set of arrows, or arcs, each connecting a source vertex to a target vertex. In this paper, we are concerned only with directed graphs, not undirected ones. A number of different products of directed graphs are defined, two of which are relevant.

Cartesian Product.
Consider finite directed graphs and , with and vertices, respectively. The Cartesian product of these graphs [23] is a graph ◻ whose vertex set is the set of ordered pairs (V, ) for all vertices V of and of (that is, the Cartesian product of the vertex sets of the factor graphs and ). The arcs of ◻ consist of an arc from (V, ) to (V, ) for every V, wherever there is an arc from to in the factor graph and an arc from (V , ) to (V , ) for every wherever there is an arc from V to V in .
We can speak of "levels" in the sense that each vertex of a factor model corresponds to a subset, or level, of vertices of the product model. The product replicates all the arcs of at every level of and all the arcs of at every level of . Suppose we have two vertices ( , ) and ( , ), whose second coordinate is the same, that is, which map to the same level of ; it will be helpful to call these "siblings" and to say they "descend" from a common "factor vertex" , similarly for vertices with the same first coordinate. Figures 3(a), 3(b), and 3(c) illustrate two directed graphs and their Cartesian product, respectively.
More generally, graphs with multiple arcs joining a pair of vertices can be defined, and the Cartesian product definition above can be applied in this case as well.

Strong
Product. The strong product of two directed graphs and includes more arcs than the Cartesian product [23]. This product ⊠ has the same vertex set, the Cartesian product of the factors' vertex sets, but in addition to the arcs of the Cartesian product graphs, it also includes all arcs from (V , ) to (V , ) where there is an arc from V to V and an arc from to . The symbols ◻ and ⊠ for these operations are chosen to evoke the structure of the product graphs, as illustrated in Figures 3(c) and 3(d). These graph products are discussed in more detail in the Appendix.

Linear Compartmental Models.
A compartmental model (whether in population biology, epidemiology, or pharmacology) is often represented by a diagram such as in Figure 1, which has the form of a directed graph (formally, a directed multigraph) with labels on arcs. Multiple arcs may connect a single pair of compartments, representing multiple processes influencing that transition with potentially different rates. As before, the vertices of the graph are compartments and its arcs are transitions, with labels specifying the transition rates. (We consider a compartmental model to be an abstract object isomorphic to its directed multigraph diagram.) As is well known, a compartmental model diagram can be represented by a system of ordinary differential equations or a continuous Markov jump process (among others). (For instance, a compartmental model with a single compartment , with a single inflow with rate Λ and outflow with rate , can be represented by the simple stochastic immigrationdeath process [24] or by the elementary ordinary differential equation model Computational and Mathematical Methods in Medicine The class of linear compartmental models we consider in this section includes the ordinary differential equation models of the form where is a vector of state variables, is a vector of constant inflows, and is an × transition rate matrix. The general compartmental model, with sources and sink terms, can be represented in the same graphical way by considering special source and sink vertices in the graph. A Cartesian product of linear compartmental models will be defined in a way that is similar to the Cartesian product of graphs. Suppose that 1 , 2 , . . . , are the states in model ; let 1 , . . . , be the states of model . The Cartesian product of with will have states ( , ) with = 1, . . . , and = 1, . . . , . Two states ( , ) and ( , ) are siblings in the same level of the product. If we began, for example, with an epidemic model with states susceptible, infective, removed (SIR), and wished to construct a product with a geographic model of multiple regions, we would expect to have susceptibles, infectives, and removed individuals in each region.
The Cartesian product of graphs, as we saw, replicates each arc of each factor graph for each vertex of the other factor graphs. In a compartmental model of a population system, this would correspond to the very common assumption of competing independent exponential risks. For example, consider once again a simple SIR epidemic model, with infection and recovery, and a model of two communities with migration between them. In a Cartesian product of the two, we may wish to allow infection and recovery within each community as well as migration of susceptibles from one community to another, migration of infectives, and migration of recovered individuals. In the product model, infectives in one community, for example, should be able to move to the other community or recover within their own community-a feature exactly reflected in the structure of a Cartesian graph product.
However, note that, in general, we may well wish to assume differences in these parameters. We may wish to assume, for example, that recovery rates are higher in one community or that migration rates of infectives are lower than for susceptibles. Unlike a Cartesian graph product, a Cartesian product of compartmental models must take into account the arc labels, which are the transition rates; in general, new parameters are necessarily introduced.
We propose the following definition for a Cartesian product of linear compartmental models. If a transition in model from to occurs with rate , then for every state in model , a transition in the product model occurs from ( , ) to ( , ) at rate . Similarly, if a transition in model from to occurs with rate , then for every state in model , a transition in the product model occurs from ( , ) to ( , ) at rate .
The presence of sources and sinks does not add any fundamental complications. If a transition in model from to a sink occurs with rate , then for every state in model , a transition from ( , ) to the sink occurs with rate (similarly, mutatis mutandis, for transitions in to a sink). Finally, if a transition from a source to state in model occurs at rate Λ, then in the product model, for every state in model , a transition from a source to ( , ) occurs at rate Λ (and similarly for transitions from the source which appear in model ). These, and only these, transitions constitute the product model.
See the Appendix for more detail on the Cartesian product of linear models.  Figure 4: (a) Factor model representing community structure with no migration; (b) simple Cartesian product formula applied to the and community structure models, giving an incorrect result.

Epidemic Models
How can products like the Cartesian and strong products of graphs be used in formulating epidemic models? As we shall see, the product reviewed above can be extended to this case as well. We must extend the Cartesian product of compartmental models to allow interaction between different populations. (We note that similar considerations apply in the more general ecological modeling setting, including Lotka-Volterra predator-prey and competition equations, but we will not pursue these applications.)

Structured SI Model.
In this section, we return to the classical Watson epidemic model, representing the SI epidemic in multiple regions. We will extend the Cartesian product of linear compartmental models, showing that the Watson model is a product of the simple SI model and a geographic model. In this special case, the geographic model will have no transitions at all. The SI model of the transmission process is the one discussed above, with two states and , and transitions as pictured in Figure 1.
We now define a factor model which distinguishes individuals by community, to be combined with the SI model. If there are communities, let 1 , 2 , . . . , be the number of individuals in each community. If no migration takes place, and we ignore demographic turnover, this model corresponds to the differential equation system / = 0 for all . For simplicity, we will illustrate only the = 2 case (Figure 4(a)).
The state space of the product model will consist of the numbers of susceptibles and infectives in community 1 and community 2, ordered pairs such as ( , 1 ), which can be given names 1 , 1 , 2 , and 2 . Naive application of the Cartesian product for compartmental models would begin with the observation that the SI factor model includes a transition from to at rate . We would then iterate over the levels = 1,2 of the community model. We need a transition from ( , 1 ) ≡ 1 to ( , 1 ) ≡ 1 , but at what rate? Generalizing the Cartesian product formula given above in the most direct way produces a model with transition rates 1 1 1 and 2 2 2 , corresponding to the graph seen in Figure 4(b). This is a technically valid compartmental model, but it does not account for potential transmission between infectives in one community (e.g., 2 ) and susceptibles in the other (e.g., 1 ).
We must therefore extend the Cartesian product of compartmental models. In this example, we must take into account that the rate of transmission between a susceptible and an infective individual depends on the community membership of the infective as well as that of the susceptible. The extended definition is as follows.
As above, let and be models. The state space for the extended Cartesian product is, as before, the Cartesian product of the state spaces of and of . For , the transition rates include functional forms ( , ), that is, functional dependencies on one or more states of .
In the example of the Watson epidemic model, we have the following. The transition rate denoting transmission events in the SI model has rate ( , ) = . We will construct the product model using the rule that, from every compartment ∈ { 1 , 2 }, that is, for every compartment descended from the compartment, there is a transition to its corresponding sibling descended from the compartment, at rate ( , ) = , for every ∈ { 1 , 2 }. Note that the infective compartment in this definition is distinct from the target vertex of the transition-the transition arc points from to , on the level of the source vertex, but the infective compartment ranges over levels of the product model independently of the source-and this distinction is crucial to defining the correct set of transitions.
Where our earlier definition constructs one arc from each compartment to its corresponding compartment, this definition constructs one arc from each compartment to its compartment for each infective compartment that can transmit to those susceptibles. This yields the model shown in Figure 5. This extended Cartesian product yields two arcs for transitions from 1 to 1 , the first reflecting our intent that individuals in community 1 can cause infections in their own community and the second reflecting transmission to community 1 from community 2. This can be canonically represented as a single arc whose rate is the sum of the rates in  Figure 5: Directed multigraph diagram of Watson model [22] defined by applying the extended Cartesian product operation to the and two-community models.
the individual arcs, which, in this example, is ( 11 1 + 12 2 ) 1 , as in the original presentation of this model by Watson [22]. Similarly, two arcs appear for transitions from 2 to 2 . Thus, the extended Cartesian product correctly represents the Watson model as a product of a within-community epidemic process and a geographic model.
Here we provide a formal definition of this product.

Definition 1.
A simple Cartesian product of two compartmental models and is a compartmental model ◻ whose set of compartments is the set of ordered pairs ( , ) for every compartment of and of .
For every arc of model , with per capita transition rate ( , 1 , . . . , ), source compartment , and target compartment , the arcs of the product model include all arcs of the form where , 1 , . . ., and range over all compartments of the product model descending from , 1 , . . ., and , respectively, and is the compartment descending from that is otherwise on the same level as , together with the corresponding arcs derived from the arcs of factor model . The subscripts of ,... distinguish the different arcs by providing the names of the levels to which all of the product compartments , 1 , . . . , belong. The set of arcs of the product model consists of only the above arcs.
The product transition rates ,... ( , 1 , . . . , ) can be defined as needed, to generate an appropriately concise form for the transition rate functions, set unneeded transition rates to zero, or to do other works of specifying the details of the combined epidemic dynamics. Examples below demonstrate several ways of using these functions to construct specific models.
Before introducing a series of examples of product models with epidemiological application, we note that the product compartments, defined as ordered -tuples such as ( , 1 ), can be assigned variable names such as 1 in a number of ways. We will use several different naming conventions in our examples. Likewise the parameters such as and need to be mapped in product transitions to differentiated variables such as 12 and 1 , as appropriate to the application. We consider this to be part of the definition of the function ( , ) and other rate functions.

Community Model Featuring Demographics.
We note that the disease process factor model may be generalized to include demographic turnover ("vital dynamics"). For example, this may feature a constant inflow of new susceptibles and an exponential mortality or removal; the SI model could be expressed in the form Here, Λ is a constant recruitment rate, and is a per capita death rate (see, e.g., [10]). If sources and sinks are considered to be special compartments, the above definition encompasses such inflow and outflow transitions. If we construct the extended Cartesian product model of this SI process with the same community model, we obtain the correct product model, with differential equations This model is illustrated in Figure 6.
Other elaborations of the epidemic model can be combined with regional models in the same way, including the SIS process (used, for instance, to model gonorrhea (e.g., [25]) and more recently to model infectious trachoma [26]), the SIR model, more complex variants (e.g., [27][28][29] out of a vast literature), or even models featuring vectorborne transmission (e.g., [30][31][32][33]). Useful factor models can include regional models with transportation, host genetics [10,34,35], gender, vaccination status, multiple risk groups (e.g., high and low risk of infection), or the presence of a second infectious agent.

Compartmental Aging.
Age-structured models are frequently used in analysis of disease transmission to reflect changes in susceptibility, frequency of complications, or mixing patterns which depend on age. Compartmental model product structure can easily reflect these features, as we illustrate in the following example. Consider the standard SIR model to be the first factor model: where and are transmission and recovery rates as above.  We then use the following compartmental aging process as the second factor model: Here, is simply the rate of aging (one year per year), Λ is a constant recruitment rate, and constants are age-classspecific per capita mortality rates. The number of age compartments could be chosen to be any positive integer, in principle. Numerically, the use of compartmental aging can yield large stiff systems of equations, but compartmental aging approximates the use of McKendrick-von Foerster equations for aging.
These two models and their Cartesian product model are shown in Figures 7(a), 7(b), and 7(c). In the product model, inflow term Λ represents vertical transmission, while Λ would represent individuals immune at birth. Either of these rates can be set to zero for specific applications.
We note that, in this example, we have built recruitment and mortality into the aging model, while in the previous section we included them in the transmission model. There is flexibility in where to include these demographic processes, depending on what subscripts one wishes to have attached to their rates in the product model. If needed they can even be included in multiple factor models and assigned to constant values including zero as appropriate in the product.

Risk-Stratified STI Model.
Sexual behavior is highly heterogeneous, with some individuals having far more partners per unit time than others. Moreover, such individuals may preferentially mix with similar individuals. The epidemiological role of a relatively small group of highly active people in transmission of a sexually transmitted infection (STI) was explored in a mathematical model of gonorrhea [36], and similar approaches were used in HIV modeling [37]. Consider the following simple example. Suppose that we begin with the factor model representing disease transmission in a population of MSM (men who have sex with men) [10]. Here represents the transmission probability per partnership, equals a susceptible individual's rate of acquiring new sexual partners, and is the probability that a susceptible individual's partner is chosen from a specific population of infectives (in the basic factor model, there is only one population of infectives, and in that model this probability is taken to have a constant value of 1, but these probabilities will be nontrivial in the product model, in which there are multiple infective populations). Here is disease-specific per capita mortality, Λ is a constant inflow rate of susceptibles, and is the diseaseindependent mortality rate. We will multiply this model by a second factor model in which the population is divided into a high risk group and a low risk group , with transition rates and between them: The product model is shown in Figure 8. This model can then represent the presence of a high risk core group with a higher rate of acquiring partners than the other, as well as nonrandom mixing between the groups, expressed by the probabilities , , and so forth. Because the mixing probabilities and for a susceptible individual in group must sum to one, and likewise and , we could replace and by 1 − and 1 − , but it is not necessary to do so. As formulated, this system keeps the biologically distinct roles of and separate, although in some circumstances it may be desirable to combine them, while respecting the constraint that ( + ) = ( + ) [38]. However, one may desire to have the quantities as functions of the state variables, reflecting that partner choice probabilities may depend on the dynamically varying group sizes [37,39], in which case it is advantageous to retain them as separate parameters so that they can be replaced by more complex expressions straightforwardly.

Gender in STI Models.
Modeling heterosexual transmission of an STI may proceed by dividing the population into males and females. Such a model can be developed along lines very similar to the risk model in the previous section. We may begin with a similar transmission factor model, here shown as an SIS process:  The second factor model will be simply where we assume no transitions from male to female or vice versa. In constructing the product model, we incorporate the assumption of heterosexual-only transmission by defining the partner choice probabilities to be one for oppositegender combinations ( , ) and zero for the samegender combinations. The product model is then as seen in Figure 9.

Interacting Transmission of Leprosy and Tuberculosis.
The extended Cartesian product of compartmental models can be applied to problems involving two separate infectious disease processes. In the joint leprosy-tuberculosis model appearing in [40], the epidemiological effects of cross-immunity between two mycobacterial species were analyzed using a compartmental model. This model may be represented as a product of two-factor models, the first being a simple where Λ is a recruitment rate, is an overall mortality rate, ] is a rate of progression of latent tuberculosis to active disease, is a transmission coefficient (hazard rate per infective) ( in the paper), and is the probability a newly infected individual will develop active tuberculosis rapidly instead of becoming latently infected with tuberculosis ( Figure 10). The second factor model represents the progression of leprosy from susceptible , to latent infection with leprosy ( ), and to multibacillary disease ( ) or paucibacillary disease ( ). The leprosy factor model is then (Figure 11 where here is the transmission coefficient for paucibacillary leprosy ( in the paper), is the transmission coefficient for lepromatous leprosy ( in the paper), is the rate at which latently infected individuals develop paucibacillary disease (] in the paper), and is the rate at which latently infected individuals develop multibacillary disease (] in the paper).
The product model ( Figure 12) represents the epidemiological interference of the two closely related mycobacterial infections. Individuals latently infected with one may have partial immunity against the other. This product structure could be applied to other settings such as HIV-TB interactions (e.g., [41]).

Strong Products
The extended Cartesian product is too restrictive when constructing models of multiple diseases. For instance, one may be infected by two pathogens during a single encounter with a dually infected person. Thus, it may be necessary to allow individuals to proceed to dual infection directly from the susceptible class without passing through the singly infected states. The extended Cartesian product defined earlier does not permit this possibility.
Just as the Cartesian product of graphs can be extended to a strong product of graphs, an analogous strong product is possible for products of compartmental models. As we will show below, a strong product of compartmental models will permit derivation of multistrain or multidisease models featuring simultaneous transmission.  Figure 13: Strong product of two strains' dynamics.
As an example, consider the following simple SIS epidemic model, which we might apply to transmission of Chlamydia trachomatis, the etiologic agent of trachoma (a blinding disease) [42,43]. In principle, multiple strains of the trachoma agent can circulate [44]. Consider a model of a single strain, in which is the number of susceptibles and is the number of infectives: where is a transmission coefficient, is a recovery rate, and = + is the total population. We can construct a multistrain model with partial crossimmunity [45,46] using a suitably defined strong product, defined as follows. Let and be models, with states labeled and , respectively. The vertices of the strong product model ⊠ are, as in the previously defined products, the Cartesian product of the vertex sets of the factor models. Every arc of each factor model gives rise to one or more arcs within each level of the product model, as in the other products, one for each interaction with product compartments. There are also additional, diagonal arcs in the product model that cross levels, representing more than one of the factor model's transitions taking place simultaneously.
In Figure 13, we present the strong product of the above SIS model with itself.
The arcs of the Cartesian product of models are present, representing infection of an individual by either strain 1 or 2, but there are additional arcs as well, including the diagonal transition from to 12 representing simultaneous transmission of both strains 1 and 2 to a fully susceptible individual in a single encounter with an individual carrying both strains.
Unlike the Cartesian product, here a single interaction between compartments can manifest in multiple transitions. The interaction between examples and 12 can result in transmission of either or both strains, and these cases are represented by three arcs in the diagram, with transmission rates distinguished by brackets.
A formal definition of the strong product of compartmental models, which generates the above example product, is as follows.

Definition 2. A strong product of two compartmental models
and is a compartmental model ⊠ whose set of compartments is the set of ordered pairs ( , ) for every compartment of and of . Models and are considered to be distinct models for the purpose of this definition, and each model's transitions are considered distinct from the other, even when a product is taken of a model with itself.
For every set = { 1 , . . . , } of factor models' transitions, belonging to distinct factor models, each with source compartment , target compartment , and per capita transition rate ( , 1 , . . . , ), the product model includes all arcs of the form where ranges over the compartments of the product model that descend from all the factor vertices { 1 , . . . , }, each ranges over the product compartments that descend from all vertices in the set { }, and descends from all of { } and is otherwise on all the same levels as . The arcs of the product model are only those generated by the above definition. As previously, the subscripts , . . . to the rate function distinguish the different product arcs by indicating the levels to which all the function's arguments belong.
In our SI example, we have defined the rate functions to produce appropriate products of transmission ( ) and recovery ( ) transitions, with distinct but compact subscripts, and to omit transitions in which transmission of one strain occurs simultaneously with recovery from the other one.

Exploration of a Family of Models
In this section, we illustrate the use of the extended Cartesian product in model development and exploration, using a model of targeted screening for gonorrhea as a simple example. Such a model can be expressed using four components: a natural history model, a partitioning of the population by gender, a division into low and high risk groups, and a process of screening of individuals ( Figure 14). For the natural history model, we will use the simple SIS process as in [25] for illustration, while recognizing that for some STIs a more complex transmission model may be needed, for example, to reflect partial immunity [47]. Because within-and betweengender transmission can vary greatly, we include a division of the model population by gender, with the assumption (d) exposure model, consisting of groups unexposed and exposed to screening. that rates of gender transition and proportions of nonbinary individuals are small in comparison to the model dynamics. We include a high and low risk group as in [36], with transitions between the risk groups, and finally we include an exposure model tracking the individuals exposed to a control measure such as frequent screening [48].
The product of these four models (constructed by extending the above definition of the extended Cartesian product of two models or by taking a product of products) has sixteen compartments and describes a process of transmission with rates affected by the genders, risk group membership, and exposure status of both susceptibles and infectives ( Figure 15). The product structure naturally generates a process that includes both homosexual and heterosexual transmission. As drawn here, the effect of the screening program is expressed by changes in the removal rate such that screened individuals are removed from the infective state more quickly than those who are not screened.
Using the extended Cartesian product definition of this model, it is straightforward to generate partial products using subsets of the set of four factor models shown in Figure 14, yielding a spectrum of models of intermediate complexity (Figure 16), which can be evaluated on their ability to fit observed data. Methods to evaluate the goodness of fit of such a model to data might include least squares (e.g., [49]) or likelihood methods (e.g., [50]).
More importantly, it is also straightforward using this formulation to generate models with greater detail, for example, by using more than two risk groups ( Figure 17). In this way, models with arbitrarily large numbers of risk groups can be straightforwardly and systematically evaluated for goodness of fit to find the best description of the true process available in this framework, a process which cannot be undertaken without an automated model generation framework of this sort.

Discussion
Products of compartmental models, defined as straightforward generalizations of graph products, represent useful operations in developing epidemiological models. Similar mathematical structures arise from addition of age structure, gender, geographic differences, or other forms of heterogeneity to an epidemic model. Such similarities reveal the presence of a "design pattern" [51] that is captured by the extended Cartesian products we define here.
The products presented in this paper by no means represent the full range of possible products of models. For the products we presented, the state space of the product model is the Cartesian product of the state spaces of the factor models. Some cases may require only a subset of this: consider an HIV model in which the infective classes are structured by CD4 count and viral load classes, which are not relevant to the susceptible classes. Such examples can be easily handled by straightforward generalizations of the products given in this paper. More complex products are required when the state space of the product model must include history (for example, the order in which individuals were infected by pathogen strains).
The extended Cartesian product is well suited to the operation of adding host heterogeneity to an epidemic model, and so it may facilitate automated generation of a family of epidemic models. Similarly, the extended strong product is suited to the process of adding pathogen heterogeneity to an epidemic model. We have developed software to implement these products. All models and figures in this paper were generated by this software, which is freely available as a module for the Sage mathematics computing system [52]. This software enables systematic numerical exploration of a large family of related models, to automate evaluation of specific refinements of an epidemic process for relevance to observed dynamics, and could form the basis of a systematic approach to numerical structural sensitivity analysis.  of the factor graphs. Notationally, if 1 , 2 , . . . , are sets of vertices, then their Cartesian product is the set 1 × 2 × ⋅ ⋅ ⋅ × = {( 1 , 2 , . . . , ) | 1 ∈ 1 , 2 ∈ 2 , . . . , ∈ }, with the elements of 1 × 2 × ⋅ ⋅ ⋅ × being tuples of elements of the component sets 1 , 2 , . . . , .
For application to mathematical models, the arrows (arcs) will represent transition rates between states represented by vertices. Each arc will therefore require an associated label. We allow multiple arcs between the same vertices and thus we must use multigraphs, represented as a set {(V, , )} ⊆ × × . Here, is the vertex set of the graph and is its set of arc labels. Each of these tuples is visualized as an arrow from V to with label (which we may denote as {V → }).
The Cartesian product 1 ◻ 2 ◻ ⋅ ⋅ ⋅ ◻ of directed graphs 1 , 2 , . . . , is a graph whose vertex set is the Cartesian product 1 × 2 ×⋅ ⋅ ⋅× of the vertex sets of each graph and whose arcs are of the form (V 1 , V 2 , . . . , V , . . . , V ) → (V 1 , V 2 , . . . , , . . . , V ), where the two tuples are identical in all but the th position and where there is an arc connecting V to in . In this paper, the products defined will yield the arc labels (transition rates) in the product graph.
For each vertex in one of the factor models, each vertex in the other model is replicated. If the first factor is a graph with vertices and , with an arc from to , and the second is a graph with vertices 1 and 2 and an arc from 1 to 2, then the product graph contains vertices which could be denoted as 1, 2, 1, and 2. Each arc of one graph is replicated for every vertex of the other. Thus, for example, the arc from 1 to 2 in the second factor graph corresponds to an arc from 1 to 2 for the first vertex of the first model and also to an arc from 1 to 2 for the second vertex. Similarly, the arc from to in the first model corresponds to an arc from 1 to 1 (for arc 1 of the second model) and from 2 to 2 (for the other).
The strong product (or strong Cartesian product) of graphs 1 , . . . , , written 1 ⊠ 2 ⊠⋅ ⋅ ⋅⊠ , is the graph whose vertex set is the Cartesian product of the graphs' vertex sets, which has an arc from (V 1 , . . . , V ) to ( 1 , . . . , ) if and only if, for every , either there is an arc from V to , or V = .  Figure 17: Transmission dynamics with three risk groups (low, partial, and high), together with gender and exposure categories.
A.1. Adjacency Matrices. The Cartesian product graph can also be defined by its adjacency matrix. Let the adjacency matrices of finite graphs and , respectively, be and . Let and be identity matrices of the same size as A and , respectively. The Cartesian product graph ◻ has adjacency matrix = ⊕ = ⊗ + ⊗ , where ⊗ is the Kronecker product. Writing = ⊕ yields an adjacency matrix for the product graph which is the same, except for the ordering of the vertices in the product (and the order in which the Cartesian product of sets of vertices is taken). More generally, graphs with multiple arcs between two vertices can be defined, in which case the elements of the adjacency matrix record the number of directed arcs to from . The Cartesian product definition above can be applied in this case as well.
The strong product of two directed graphs and includes more arcs than the Cartesian product [23]. This product ⊠ has the same vertex set, the Cartesian product of the factors' vertex sets, but in addition to the arcs of the Cartesian product graphs, it also includes all arcs from (V , ) to (V , ), where there is an arc from V to V and an arc from to . Using the same notation as above, the adjacency matrix of the strong product graph is = ⊗ + ⊗ + ⊗ . Products of more than two graphs can be represented by analogous, though more tedious, matrix operations. where is a vector of exogenous inflow terms and is a transition rate matrix. In general, could contain sink terms; for example, let 1 represent the number of individuals in a population with constant recruitment Λ and constant per capita mortality, so thaṫ1 = Λ − 1 . In this case, is a 1 × 1 matrix [− ].
Consider two continuous time chains, with state spaces , = 1, . . . , and , = 1, . . . , , respectively. Suppose that the transition rate matrix for each is given by and , respectively (assumed time-independent, for simplicity). A transition rate matrix may contain both positive (inflow) terms and negative (outflow) terms. A transition to from state at rate will be represented in by a term in the , th element of of − and a term in the , th element of of ] .

(A.3)
A Cartesian product of two Markov chains and can then be defined as follows. We will denote the arcs of model by ; for each arc there is a matrix whose elements are 0, except for the inflow and outflow represented by that and their product as defined here (Figure 18(c)). This special case only represents a model in which the two chains behave completely independently.
To obtain a more general product, we replace the identity matrices with general diagonal matrices. The elements of the diagonal matrix are not assumed identical. We let Λ be such a diagonal matrix of the same dimension as , representing a scaling matrix for each arc of model for every state of model . Similarly, Λ , a matrix of the same dimension as , is a scaling matrix for each arc of model for every state of model . A more general product is then expressed by = ∑Λ ⊗ + ∑ ⊗ Λ , (A.5) producing a product process like the one pictured in Figure 18(d).
Note that a given arc connecting two vertices may, in applications, represent two separate processes. For instance, we may have a compartment representing live individuals and another dead and wish to model the rate of death due to two causes, say 1 and 2 . Canonically, we may represent the total transition from live to dead as a single arc with rate 1 + 2 (assuming independent competing risks), but in the decomposition above, if we represent the transition by two separate arcs, the Cartesian product formula may be applied in the same way. Let us use the notation ∝ to indicate that compartment descends from factor compartment . The transition matrix for the extended Cartesian product model is where is considered to depend on .

Conflicts of Interest
The authors declare they each have no conflicts of interest.