### =======================================
### SIMPLE BINARY SBM (Bernoulli model)
## Graph parameters
nbNodes <- 90
blockProp <- c(.5, .25, .25) # group proportions
means <- diag(.4, 3) + 0.05 # connectivity matrix: affiliation network
# In Bernoulli SBM, parameters is a list with a
# matrix of means 'mean' which are probabilities of connection
connectParam <- list(mean = means)
## Graph Sampling
mySampler <- sampleSimpleSBM(nbNodes, blockProp, connectParam, model = 'bernoulli')
plot(mySampler)
plot(mySampler)
plot(mySampler,type='meso')
hist(mySampler$networkData)
### =======================================
### SIMPLE POISSON SBM
## Graph parameters
nbNodes <- 90
blockProp <- c(.5, .25, .25) # group proportions
means <- diag(15., 3) + 5 # connectivity matrix: affiliation network
# In Poisson SBM, parameters is a list with
# a matrix of means 'mean' which are a mean integer value taken by edges
connectParam <- list(mean = means)
## Graph Sampling
mySampler <- sampleSimpleSBM(nbNodes, blockProp, list(mean = means), model = "poisson")
plot(mySampler)
plot(mySampler,type='meso')
hist(mySampler$networkData)
### =======================================
### SIMPLE GAUSSIAN SBM
## Graph parameters
nbNodes <- 90
blockProp <- c(.5, .25, .25) # group proportions
means <- diag(15., 3) + 5 # connectivity matrix: affiliation network
# In Gaussian SBM, parameters is a list with
# a matrix of means 'mean' and a matrix of variances 'var'
connectParam <- list(mean = means, var = 2)
## Graph Sampling
mySampler <- sampleSimpleSBM(nbNodes, blockProp, connectParam, model = "gaussian",dimLabels='Tree')
plot(mySampler)
plot(mySampler,type='meso')
hist(mySampler$networkData)
Run the code above in your browser using DataLab