Skip to contents

Uses the techniques in enumerate_RGs to uniformly sample a relationship graph. All clonal partitions are generated, and the number of sibling partitions consistent with each clonal partition is determined. A clonal partition is randomly selected with probability proportional to the corresponding number of sibling partitions, and a sibling partition is then uniformly sampled. The nested partition is equivalent to a relationship graph. See enumerate_RGs for details on the nested partition representation of a relationship graph.

Usage

sample_RG(MOIs, igraph = T)

Arguments

MOIs

A numeric vector specifying, for each infection, the number of distinct parasite genotypes, a.k.a. the multiplicity of infection (MOI).

igraph

Logical for whether to return an igraph object.

Value

A relationship graph, i.e. one entry of the list returned by enumerate_RGs.

Examples

set.seed(20)
RG <- sample_RG(c(2, 2))