使用 Erdős-Rényi 模型生成二分图。请改用
sample_bipartite_gnm()
和 sample_bipartite_gnp()
。
参数
- n1
整数标量,底部顶点数。
- n2
整数标量,顶部顶点数。
- type
字符标量,图的类型,“gnp”创建 \(G(n,p)\) 图,“gnm”创建 \(G(n,m)\) 图。请参阅下面的详细信息。
- p
实数标量,\(G(n,p)\) 图的连接概率。不应为 \(G(n,m)\) 图给出。
- m
整数标量,\(G(n,m)\) 图的边数。不应为 \(G(n,p)\) 图给出。
- directed
逻辑标量,是否创建有向图。另请参阅
mode
参数。- mode
字符标量,指定如何定向有向图中的边。如果为“out”,则有向边从底部顶点指向顶部顶点。如果为“in”,则边从顶部顶点指向底部顶点。“out”和“in”不会生成互边。如果此参数为“all”,则独立考虑每个边方向,并且可能会生成互边。此参数对于无向图将被忽略。
- ...
传递给
sample_bipartite()
。
参见
随机图模型(游戏) bipartite_gnm()
, erdos.renyi.game()
, sample_()
, 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_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
示例
## empty graph
sample_bipartite(10, 5, p = 0)
#> Warning: `sample_bipartite()` was deprecated in igraph 2.2.0.
#> ℹ Please use `sample_bipartite_gnp()` instead.
#> IGRAPH 4a86366 U--B 15 0 -- Bipartite Gnp random graph
#> + attr: name (g/c), p (g/n), type (v/l)
#> + edges from 4a86366:
## full graph
sample_bipartite(10, 5, p = 1)
#> IGRAPH f567ebb U--B 15 50 -- Bipartite Gnp random graph
#> + attr: name (g/c), p (g/n), type (v/l)
#> + edges from f567ebb:
#> [1] 1--11 1--12 1--13 1--14 1--15 2--11 2--12 2--13 2--14 2--15
#> [11] 3--11 3--12 3--13 3--14 3--15 4--11 4--12 4--13 4--14 4--15
#> [21] 5--11 5--12 5--13 5--14 5--15 6--11 6--12 6--13 6--14 6--15
#> [31] 7--11 7--12 7--13 7--14 7--15 8--11 8--12 8--13 8--14 8--15
#> [41] 9--11 9--12 9--13 9--14 9--15 10--11 10--12 10--13 10--14 10--15
## random bipartite graph
sample_bipartite(10, 5, p = .1)
#> IGRAPH 385355e U--B 15 8 -- Bipartite Gnp random graph
#> + attr: name (g/c), p (g/n), type (v/l)
#> + edges from 385355e:
#> [1] 4--12 5--12 1--13 2--13 7--13 2--14 3--14 5--15
## directed bipartite graph, G(n,m)
sample_bipartite(10, 5, type = "Gnm", m = 20, directed = TRUE, mode = "all")
#> Warning: `sample_bipartite()` was deprecated in igraph 2.2.0.
#> ℹ Please use `sample_bipartite_gnm()` instead.
#> IGRAPH f0fa798 D--B 15 20 -- Bipartite Gnm random graph
#> + attr: name (g/c), m (g/n), type (v/l)
#> + edges from f0fa798:
#> [1] 1->11 3->11 5->11 6->11 1->13 4->13 7->13 8->13 4->14 3->15
#> [11] 4->15 10->15 12-> 1 13-> 3 11-> 4 12-> 6 13-> 6 14-> 6 15-> 8 14->10