I have an igraph network of 169 nodes (neighbourhoods). I've added some vertices attributes using: V(g)$attribute
. I'm going to study the impact of the geographic distance between the nodes (neighbourhoods). I've calculated the distance between neighbourhoods based on the longitude and latitude:
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)
Now, my question is How can I add these distances to the network (g) in order to study the impact of the distance on linked nodes using Exponential Random Graph Model ergm().