This function generates a network from the Stochastic Block Model with \(K\) blocks.
adja(N, K, alpha, directed = FALSE)
A row-normalized non-negative matrix describing the network. The main diagonal entries of the matrix are zeros, all the other entries are non-negative and the sum of elements over the rows equals one.
The number of nodes on the network.
The number of blocks. Each block has dimension \(N/K\). \(K\) should be chosen such that \(N\) is divisible by \(K\).
The network density. A value in \([0,1]\) defining the frequency of connections in the network.
Logical scalar, whether to generate a directed network or not. If TRUE a directed network is generated.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
For each pair of nodes it performs a Bernoulli trial with values 1 "draw an edge", 0 "otherwise". The probabilities of these trials are bigger if the two nodes are in the same block, lower otherwise, and they are specified based on the number of nodes on the network \(N\) and network density \(alpha\): Probability to draw an edge for a pair of nodes in the same block: \(\alpha*N^{-0.3}\). Probability to draw an edge for a pair of nodes in different blocks: \(\alpha*N^{-1}\).
Faust, K. and S. Wasserman (1992). Blockmodels: Interpretation and evaluation. Social Networks, 14, 5--61.
adja_gnp
W <- adja(N = 20, K = 5, alpha = 0.1)
Run the code above in your browser using DataLab