R igraph 手册页

如果您从 R 中使用 igraph,请使用此选项

sample_dot_product {igraph}R 文档

根据随机点积图模型生成随机图

描述

在此模型中,每个顶点由一个潜在位置向量表示。两个顶点之间存在边的概率由其潜在位置向量的点积给出。

用法

sample_dot_product(vecs, directed = FALSE)

dot_product(...)

参数

vecs

一个数值矩阵,其中每个潜在位置向量都是一列。

有向

一个逻辑标量,如果生成的图应该是定向的,则为 TRUE。

...

传递给 sample_dot_product

详细信息

潜在位置向量的点积应在 [0,1] 区间内,否则会发出警告。对于负点积,不添加边;大于 1 的点积总是添加边。

一个 igraph 图对象,它是生成的随机点积图。

作者

Gabor Csardi csardi.gabor@gmail.com

参考

Christine Leigh Myers Nickel: Random dot product graphs, a model for social networks. Dissertation, Johns Hopkins University, Maryland, USA, 2006.

参见

sample_dirichlet, sample_sphere_surfacesample_sphere_volume 用于采样位置向量。

示例


## A randomly generated  graph
lpvs <- matrix(rnorm(200), 20, 10)
lpvs <- apply(lpvs, 2, function(x) { return (abs(x)/sqrt(sum(x^2))) })
g <- sample_dot_product(lpvs)
g

## Sample latent vectors from the surface of the unit sphere
lpvs2 <- sample_sphere_surface(dim=5, n=20)
g2 <- sample_dot_product(lpvs2)
g2

[包 igraph 版本 1.3.5 索引]