Operations for count graphs
Weixiang Fang
10/27/2022
operations.Rmd
Operations implemented for count graphs
# Split
N = 100
p_vec = c(0.5, 0.2, 0.15, 0.1, 0.04, 0.01)
m_vec = c(2, 2, 2, 2, 2, 2)
round_frac(N, p_vec, m_vec)
## [1] 49 20 15 10 4 2
# Stochastic split
S = 100
N_vec = c(100, 200, 300)
extraDistr::rmvhyper(nn = 1,
n = N_vec,
k = S)[1, ]
## [1] 18 34 48
# Stochastic coalescence
S = 15
N = 10
C = sample_doublet_branch(N, S)
S_ = S - C
S_
## [1] 9
# Stochastic asymm coal
S1 = 5
S2 = 8
N = 10
C = sample_doublet_twotype(N, S1, S2)
S_ = S1 + S2 - C
S_
## [1] 10