跳到内容

这些函数实现了基于不同顶点类型的演化网络模型。

用法

sample_traits_callaway(
  nodes,
  types,
  edge.per.step = 1,
  type.dist = rep(1, types),
  pref.matrix = matrix(1, types, types),
  directed = FALSE
)

traits_callaway(...)

sample_traits(
  nodes,
  types,
  k = 1,
  type.dist = rep(1, types),
  pref.matrix = matrix(1, types, types),
  directed = FALSE
)

traits(...)

参数

节点

图中的顶点数。

types

不同顶点类型的数量。

edge.per.step

每个时间步添加到图中的边的数量。

type.dist

顶点类型的分布。假设这在时间上是静止的。

pref.matrix

一个矩阵,给出给定顶点类型的偏好。这些应该是概率,即零到一之间的数字。

directed

逻辑常量,是否生成有向图。

...

传递给构造函数sample_traits()sample_traits_callaway()

k

每个时间步的试验次数,请参阅下面的详细信息。

一个新的图对象。

详细信息

对于sample_traits_callaway(),模拟过程如下:在每个离散时间步中,一个新的顶点被添加到图中。这个顶点的类型是基于type.dist生成的。然后从图中均匀随机地选择两个顶点。它们将被连接的概率取决于这些顶点的类型,并从pref.matrix中获取。然后在每个时间步中选择另外两个顶点,并重复edges.per.step次。

对于sample_traits(),模拟过程如下:在每个时间步添加一个顶点。这个新顶点试图连接到图中的k个顶点。这种连接实现的概率取决于所涉及的顶点的类型,并从pref.matrix中获取。

作者

Gabor Csardi csardi.gabor@gmail.com

示例


# two types of vertices, they like only themselves
g1 <- sample_traits_callaway(1000, 2, pref.matrix = matrix(c(1, 0, 0, 1), ncol = 2))
g2 <- sample_traits(1000, 2, k = 2, pref.matrix = matrix(c(1, 0, 0, 1), ncol = 2))