Plot one or more centrality scores of all vertices in the network

plot_centralities(
  net,
  measures = c("betweenness", "closeness", "degree", "eccentricity"),
  directed = TRUE,
  mode = c("all", "out", "in"),
  k = 3,
  rescaled = FALSE,
  ...
)

Arguments

net

a network of class igraph or network

measures

character vector of one or more centrality measures

directed

logical, should direction be taken into account? This argument is optional, if it is not chosen the directionality of the network will be used.

mode

Character. The default is "all".

k

The k parameter for the "geokpath" measure. The default is 3.

rescaled

Logical scalar, whether to rescale the centrality scores to they add up to 1.

...

other arguments passed to plot.

Value

a plot

Details

This function creates of grid of plots containing the values a set of centrality scores, selected by the user. The function will calculate the requested scores and then plot them. When a large network is used and many or complex measures are requested, the calculations can take some time. The plotting itself will be fast.

Since the function calculates the centrality scores itself, the choice is currently limited to the centralities implemented in this package.

At the moment, these are "betweenness", "closeness", "degree", "eccentricity", "eigenvector", "geokpath", "harmonic", "shapley", and "stress". The default is to plot "betweenness", "closeness", "degree", and "eccentricity".

The various arguments relate to these measures. The mode, directed, and rescaled arguments will be appled to all chosen measures

The function takes an igraph object or a network object as input.

Examples

if (FALSE) { # \dontrun{
g <- igraph::erdos.renyi.game(20, 1/20)
plot_centralities(g, measures = c("degree", "betweenness"))
# note that closeness is not well-defined for disconnected graphs
plot_centralities(g)

data(florentine, package = "snafun")
business <- florentine$flobusiness
plot_centralities(business)
plot_centralities(business, rescaled = TRUE)
plot_centralities(business, measures = c("betweenness", "closeness", "degree", 
   "eccentricity", "eigenvector", "geokpath", "harmonic", "stress"))
bus_n <- snafun::to_network(business)
plot_centralities(bus_n, c("degree", "betweenness"), mode = "out", use_vertexnames = TRUE)
} # }