How Can I add geographic distance matrix to an igraph network?

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().

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.