## Generate a network according to the Erd\"{o}s-Renyi model of order 20
## and parameter p = 0.3
edge_ER <- rbinom(400, 1, 0.3)
weight_ER <- sapply(edge_ER, function(x) x * sample(3, 1))
adj_ER <- matrix(weight_ER, 20, 20)
mydegree <- centrality(
adj = adj_ER,
measure = "degree", degree.control =
list(alpha = 0.8, mode = "in")
)
myclose <- centrality(
adj = adj_ER,
measure = "closeness", closeness.control =
list(alpha = 0.8, mode = "out", method = "harmonic", distance = FALSE)
)
mywpr <- centrality(
adj = adj_ER,
measure = "wpr", wpr.control =
list(gamma = 0.85, theta = 0.75)
)
Run the code above in your browser using DataLab