Skip to contents

An RG is a graph over all per-person parasite genotypes (each as a vertex), with edges between clone and sibling genotypes. Valid RGs satisfy:

  • Subgraphs induced by clone edges are cluster graphs.

  • Subgraphs induced by clone plus sibling edges are cluster graphs.

  • Clone edges only link genotypes from different episodes.

Usage

enumerate_RGs(MOIs, igraph = TRUE, progress.bar = TRUE)

Arguments

MOIs

Vector of per-episode multiplicities of infection (MOIs), i.e., numbers of per-episode genotypes / vertices.

igraph

Logical; returns RGs as igraph objects (default TRUE).

progress.bar

Logical; show progress bar (default TRUE).

Value

A list of RGs. If igraph = FALSE, each RG is a list of length four with:

clone

List of vectors encoding genotypes per clonal cell.

clone.vec

Numeric vector with the clonal cell membership of each genotype.

sib

List of vectors encoding clonal cells per sibling cell.

sib.vec

Numeric vector with the sibling cell membership of each clonal cell.

If igraph = TRUE (default), each RG is encoded as an igraph object (see RG_to_igraph).

Details

RGs are generated by enumerating nested set partitions under specific constraints; see Understand graph and partition enumeration. Each nested set parition is an RG. Clone edges induce a cluster graph, equivalent to a partition of genotypes, with no intra-episode clones allowed. Sibling edges refine the clone partition, with no constraints (intra-episode siblings allowed). Each nested set partition is encoded as a list. Each partition is represented by a list of vectors (either clone or sib) and by a membership vector (either clone.vec or sib.vec). By default, an RG encoded as a list is converted to an igraph object.

Examples

graphs <- enumerate_RGs(c(2, 1, 2), progress.bar = FALSE) # nine graphs
#> Number of valid relationship graphs (RGs) is 250