通过扰乱给定图的邻接矩阵并打乱其顶点来采样一个新图。
用法
sample_correlated_gnp(
old.graph,
corr,
p = edge_density(old.graph),
permutation = NULL
)
参考文献
Lyzinski, V., Fishkind, D. E., Priebe, C. E. (2013). Seeded graph matching for correlated Erdős-Rényi graphs. https://arxiv.org/abs/1304.7844
参见
随机图模型(游戏) bipartite_gnm()
, erdos.renyi.game()
, sample_()
, sample_bipartite()
, sample_chung_lu()
, 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_hierarchical_sbm()
, sample_islands()
, sample_k_regular()
, sample_last_cit()
, sample_pa()
, sample_pa_age()
, sample_pref()
, sample_sbm()
, sample_smallworld()
, sample_traits_callaway()
, sample_tree()
示例
g <- sample_gnp(1000, .1)
g2 <- sample_correlated_gnp(g, corr = 0.5)
cor(as.vector(g[]), as.vector(g2[]))
#> [1] 0.5002114
g
#> IGRAPH cd7c6c9 U--- 1000 49769 -- Erdos-Renyi (gnp) graph
#> + attr: name (g/c), type (g/c), loops (g/l), p (g/n)
#> + edges from cd7c6c9:
#> [1] 1-- 7 4-- 7 1-- 8 2--10 9--11 10--12 6--13 6--14 12--14 1--15
#> [11] 7--16 7--17 12--17 13--17 16--17 12--18 5--21 6--21 13--22 4--23
#> [21] 8--23 15--23 6--24 19--24 20--24 21--24 2--25 18--25 2--26 4--26
#> [31] 7--26 4--27 8--27 24--27 1--28 13--28 18--28 1--29 17--29 5--30
#> [41] 13--30 26--30 5--31 12--31 21--31 9--32 17--33 18--33 6--34 18--34
#> [51] 25--34 32--34 11--35 33--35 1--36 10--36 21--36 6--37 11--37 13--37
#> [61] 15--37 17--37 7--38 13--38 24--38 30--38 2--39 3--39 21--39 35--39
#> [71] 4--40 4--41 8--41 9--41 36--41 37--41 1--42 19--42 23--42 29--42
#> + ... omitted several edges
g2
#> IGRAPH 35e18ba U--- 1000 49866 -- Correlated random graph
#> + attr: name (g/c), corr (g/n), p (g/n)
#> + edges from 35e18ba:
#> [1] 2-- 4 4-- 5 1-- 7 4-- 7 2--10 6--14 7--16 13--17 16--17 13--20
#> [11] 17--20 6--21 4--23 8--23 15--23 20--24 10--25 15--25 18--25 24--26
#> [21] 4--27 24--27 25--27 13--28 18--28 13--29 28--29 5--30 13--30 5--31
#> [31] 12--31 13--31 21--31 22--31 16--33 24--33 26--33 5--34 6--34 25--34
#> [41] 18--35 31--35 1--36 9--36 10--36 27--36 6--37 7--37 11--37 13--37
#> [51] 15--37 17--37 13--38 21--38 24--38 29--38 2--39 21--39 35--39 4--40
#> [61] 8--41 9--41 32--41 11--42 12--42 23--42 29--42 32--42 39--42 3--43
#> [71] 5--43 6--43 11--43 27--43 39--43 7--44 10--44 15--44 39--44 23--45
#> + ... omitted several edges