每条可能的边都以相同的概率 p
独立创建。此模型也称为伯努利随机图,因为顶点对的连通性状态遵循伯努利分布。
详细信息
该图有 n
个顶点,并且每对顶点都以相同的概率 p
连接。 loops
参数控制是否也考虑自连接。此模型有效地约束了边的平均数量,\(p m_\text{max}\),其中 \(m_\text{max}\) 是边的最大可能数量,这取决于图是有向还是无向,以及是否允许自环。
参见
随机图模型(博弈) 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_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()
作者
Gabor Csardi csardi.gabor@gmail.com
示例
# Random graph with expected mean degree of 2
g <- sample_gnp(1000, 2 / 1000)
mean(degree(g))
#> [1] 2.056
degree_distribution(g)
#> [1] 0.119 0.274 0.279 0.173 0.099 0.037 0.013 0.004 0.000 0.002
# Pick a simple graph on 6 vertices uniformly at random
plot(sample_gnp(6, 0.5))