【发布时间】:2022-04-16 01:00:56
【问题描述】:
我有一个由 169 个节点(社区)组成的 igraph 网络。我添加了一些顶点属性使用: V(g)$attribute。我将研究节点(社区)之间地理距离的影响。我已经根据经度和纬度计算了社区之间的距离:
head(df)
neighbourhood lon lat
1 41.47141 -81.75226
2 41.47562 -81.74670
3 41.47608 -81.73900
. . .
. . .
# Calculate the geographic distance matrix using distm() from geosphere
dis.matrix <- (distm(cbind(df$lon, df$lat)))
# The result is a geographic matrix of 169x169 (distance in meters)
现在,我的问题是如何将这些距离添加到网络 (g) 中,以便使用指数随机图模型 ergm() 研究距离对链接节点的影响。
【问题讨论】: