如果您从 R 中使用 igraph,请使用此选项
sample_pref {igraph} | R 文档 |
基于不同顶点类型的随机图生成。
sample_pref(
nodes,
types,
type.dist = rep(1, types),
fixed.sizes = FALSE,
pref.matrix = matrix(1, types, types),
directed = FALSE,
loops = FALSE
)
pref(...)
sample_asym_pref(
nodes,
types,
type.dist.matrix = matrix(1, types, types),
pref.matrix = matrix(1, types, types),
loops = FALSE
)
asym_pref(...)
节点 |
图中顶点的数量。 |
类型 |
不同顶点类型的数量。 |
type.dist |
顶点类型的分布,一个长度为“类型”的数字向量,包含非负数。该向量将被标准化以获得概率。 |
fixed.sizes |
修复具有给定顶点类型标签的顶点的数量。在这种情况下, |
pref.matrix |
一个给出顶点类型偏好的方阵。该矩阵有“类型”行和列。 |
有向 |
逻辑常量,是否创建有向图。 |
循环 |
逻辑常量,图中是否允许自环。 |
... |
传递给构造函数 |
type.dist.matrix |
入度和出顶点类型的联合分布。 |
两种模型都生成具有给定顶点类型的随机图。对于 sample_pref
,两个顶点将被连接的概率取决于它们的类型,并由 'pref.matrix' 参数给出。该矩阵应该是对称的才有意义,但没有检查这一点。不同顶点类型的分布由 'type.dist' 向量给出。
对于 sample_asym_pref
,每个顶点都有一个入类型和一个出类型,并创建一个有向图。从具有给定出类型的顶点到具有给定入类型的顶点实现有向边的概率在 'pref.matrix' 参数中给出,该参数可以是不对称的。入和出类型的联合分布在 'type.dist.matrix' 参数中给出。
生成的顶点的类型可以从 sample_pref
的 type
顶点属性以及 sample_asym_pref
的 intype
和 outtype
顶点属性中检索。
igraph 图。
Tamas Nepusz ntamas@gmail.com 和 Gabor Csardi csardi.gabor@gmail.com 为 R 接口
sample_traits
。 sample_traits_callaway
pf <- matrix( c(1, 0, 0, 1), nrow=2)
g <- sample_pref(20, 2, pref.matrix=pf)
## Not run: tkplot(g, layout=layout_with_fr)
pf <- matrix( c(0, 1, 0, 0), nrow=2)
g <- sample_asym_pref(20, 2, pref.matrix=pf)
## Not run: tkplot(g, layout=layout_in_circle)