A subset of my data for a temporal network are as below:
edge <- data.frame(onset = c(1968, 1968, 2007),
terminus = c(1968, 1968, 2007),
id_from = c(1, 1, 2),
id_to = c(3, 2, 4),
weight = c(1, 3, 2))
vert <- data.frame(onset = c(1968, 1968, 1980, 1978),
terminus = c(2017, 2017, 2017, 2017),
vertex_id = c(1, 2, 3, 4),
abb.name = c("UK", "US", "Germany", "Pakistan"))
# Create networkDynamic object
netd <- networkDynamic(vertex.spells = vert[,c(1,2,3,4)],
edge.spells = edge[,c(1,2,3,4,5)],
create.TEAs = TRUE,
edge.TEA.names = "weight")
vert$abb.name <- as.character(vert$abb.name)
# Set vertex attributes
set.vertex.attribute(netd, "abb.name", as.vector(vert$abb.name))
network.vertex.names(netd)<-vert$abb.name
# Collapse network to look at 1968 network
net68 <- network.collapse(netd,
at = 1968,
rm.time.info = FALSE,
rule = "latest")
# Get centrality score
degree(net68)
However, this returns centrality scores that do not take the weights into account.
[1] 1 1
How can I make sure that networkDynamic
takes into consideration that (1) weights per year are significant so it doesn't calculate multiple ties between the same two countries as one edge in the aggregate network, (2) the weights get counted in the centrality scores properly, and (3) get a degree()
output that includes country name? Ideally, I'd like to get centrality scores for each country in each slice of the network from 1968 to 2017.