This function samples a realization of a stochastic block model from a set a user-defined parameters in a igraĥ format.
rSBM(nbNodes, connectParam, blockProp)
nbNodes | number of nodes in the graph |
---|---|
connectParam | inter and intra block connection probabilities |
blockProp | proportion of node in each block of the SBM |
an igraph object with a vertex attribute called "memberships" for block belonging
## graph parameters nNodes <- 90 blockProp <- c(.5, .25, .25) # group proportions nbBlock <- length(blockProp) # number of blocks connectParam <- diag(.4, nbBlock) + 0.05 # connectivity matrix: affiliation network ## Graph Sampling mySBM <- rSBM(nNodes, connectParam, blockProp) ## Graph plotting plot(mySBM, vertex.color = igraph::V(mySBM)$memberships)