R/generalize-userfunction.R
    mlvsbm_simulate_generalized_network.RdCreate a simulate a generalized multilevel network (GenMLVSBM object)
mlvsbm_simulate_generalized_network(
  n,
  Q,
  pi,
  gamma,
  alpha,
  directed,
  affiliation = "uniform",
  distribution,
  no_empty_org = FALSE,
  no_isolated_node = FALSE
)A vector of L positive integers where L is the number of levels from the upper level to the lower level.
A vector of L positive integers, the number of clusters for each level.
A list of length L, with vectors of probabilities of length Q[l],
the mixture parameters. pi[[1]] must be a probability, pi[[l]] can be set to
NULL for a given level if all nodes of this level have an affiliation.
A list of size \(L-1\) of \(Q[l+1] \times Q[l]\) matrix with each column summing to one, the mixture parameters given the affiliation
A list of L matrices, of size \(Q[l] \times Q[l]\) matrix giving the connectivity probabilities.
A vector of L logical. Is level l a directed network ?
The distribution under which the affiliation matrix is
simulated in c("uniform", "preferential", "diagonal").
"diagonal" is a special case where all affiliation matrix are diagonal
(individuals are the same on each levels, for temporal networks e.g.).
It requires n to be
constant.
A list for the distribution of X, only "bernoulli" is implemented.
A logical with FALSE as default, should every nodes have at least one affiliated node on the level below? Needs to have \(n[l] \geq n[l+1]\).
A logical, if TRUE then the network is simulated again until all nodes are connected.
An GenMLVSBM object, a simulated multilevel network with levels, affiliations and memberships.
my_genmlvsbm <- MLVSBM::mlvsbm_simulate_generalized_network(
  n = c(10, 20), # Number of nodes for each level
  Q = c(2, 2), # Number of blocks for each level
  pi = list(c(.3, .7), NULL), # Block proportion for the upper level, must sum to one
  gamma = list(matrix(c(.9, .2,   # Block proportion for the lower level,
                   .1, .8),      # each column must sum to one
                 nrow = 2, ncol = 2, byrow = TRUE)),
  alpha = list(matrix(c(.8, .2,
                            .2, .1),
                          nrow = 2, ncol = 2, byrow = TRUE), # Connection matrix
               matrix(c(.99, .3,
                            .3, .1),
                          nrow = 2, ncol = 2, byrow = TRUE)),# between blocks
  directed = c(FALSE, FALSE),
  distribution = rep("bernoulli", 2)) # Are the upper and lower level directed