shapley_centrality | R Documentation |
This function computes the centrality of vertices based on their Shapley value, following the approach from the Michalak et al. (2013) paper.
shapley_centrality(x, add.vertex.names = FALSE, vids = igraph::V(x))
x |
An object of class |
add.vertex.names |
logical, should the output contain vertex names.
This requires a vertex attribute |
vids |
Vertices to be considered in the calculation (numeric vector) |
Vector with the Shapley centrality values for each vertex
Michalak, T.P., Aadithya, K.V., Szczepanski, P.L., Ravindran, B. and Jennings, N.R., 2013. Efficient computation of the Shapley value for game-theoretic network centrality. Journal of Artificial Intelligence Research, 46, pp.607-650.
The code is adapted from CINNA::group_centrality
and gives the
same result (but our version is slightly more robust).
# Figure 1 network from Michalak et al. g1 <- igraph::graph(c(4,1,5,1,1,6,1,7,1,8,8,11,11,12,11,13,6,2,7,2,8,2, 2,9,2,10,9,3,10,3), directed = FALSE) igraph::V(g1)$name <- paste0("v", 1:13) shapley_centrality(g1) shapley_centrality(g1, add.vertex.names = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.