如果您从 R 中使用 igraph,请使用此选项
sample_dot_product {igraph} | R 文档 |
在此模型中,每个顶点由一个潜在位置向量表示。两个顶点之间存在边的概率由其潜在位置向量的点积给出。
sample_dot_product(vecs, directed = FALSE)
dot_product(...)
vecs |
一个数值矩阵,其中每个潜在位置向量都是一列。 |
有向 |
一个逻辑标量,如果生成的图应该是定向的,则为 TRUE。 |
... |
传递给 |
潜在位置向量的点积应在 [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_surface
和 sample_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