从网络的分层随机块模型中进行采样。
参数
- n
整数标量,顶点的数量。
- m
整数标量,每个块的顶点数。
n / m
必须为整数。或者,如果不是所有块的大小都相等,则可以使用块大小的整数向量。- rho
数值向量,每个块内每个簇的顶点比例。总和必须为 1,并且对于 rho 的所有元素,
rho * m
必须为整数。或者,如果不同块的 rho 不相同,则可以使用 rho 向量的列表,每个块一个。- C
一个方形对称数值矩阵,块内簇的伯努利速率。其大小必须与
rho
向量的大小匹配。或者,如果不同块的伯努利速率不同,则可以使用方形矩阵的列表。- p
数值标量,不同块中顶点之间连接的伯努利速率。
- ...
传递给
sample_hierarchical_sbm()
。
参见
随机图模型(游戏) bipartite_gnm()
, erdos.renyi.game()
, sample_()
, sample_bipartite()
, sample_chung_lu()
, sample_correlated_gnp()
, sample_correlated_gnp_pair()
, sample_degseq()
, sample_dot_product()
, sample_fitness()
, sample_fitness_pl()
, sample_forestfire()
, sample_gnm()
, sample_gnp()
, sample_grg()
, sample_growing()
, sample_islands()
, sample_k_regular()
, sample_last_cit()
, sample_pa()
, sample_pa_age()
, sample_pref()
, sample_sbm()
, sample_smallworld()
, sample_traits_callaway()
, sample_tree()
作者
Gabor Csardi csardi.gabor@gmail.com
示例
## Ten blocks with three clusters each
C <- matrix(c(
1, 3 / 4, 0,
3 / 4, 0, 3 / 4,
0, 3 / 4, 3 / 4
), nrow = 3)
g <- sample_hierarchical_sbm(100, 10, rho = c(3, 3, 4) / 10, C = C, p = 1 / 20)
g
#> IGRAPH 3f8dac5 U--- 100 452 -- Hierarchical stochastic block model
#> + attr: name (g/c), m (g/n), rho (g/n), C (g/n), p (g/n)
#> + edges from 3f8dac5:
#> [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 3-- 4 2-- 5 1-- 6 2-- 6 3-- 6
#> [11] 4-- 7 5-- 7 4-- 8 5-- 8 6-- 8 4-- 9 6-- 9 4--10 5--10 6--10
#> [21] 7-- 8 8-- 9 7--10 8--10 9--10 11--12 11--13 12--13 11--14 13--14
#> [31] 11--15 12--15 11--16 12--16 13--16 14--17 15--17 16--17 14--18 15--18
#> [41] 16--18 14--19 15--19 16--19 14--20 15--20 16--20 17--18 17--19 18--19
#> [51] 17--20 18--20 19--20 21--22 21--23 22--23 22--24 23--24 21--25 22--25
#> [61] 23--25 21--26 24--27 25--27 26--27 24--28 25--28 25--29 26--29 25--30
#> [71] 26--30 27--28 27--29 28--29 27--30 28--30 31--32 31--33 32--33 32--34
#> + ... omitted several edges
library("Matrix")
image(g[])