Skip to contents

See centralize() for a summary of graph centralization.

Usage

centr_degree(
  graph,
  mode = c("all", "out", "in", "total"),
  loops = TRUE,
  normalized = TRUE
)

Arguments

graph

The input graph.

mode

This is the same as the mode argument of degree().

loops

Logical scalar, whether to consider loops edges when calculating the degree.

normalized

Logical scalar. Whether to normalize the graph level centrality score by dividing by the theoretical maximum.

Value

A named list with the following components:

res

The node-level centrality scores.

centralization

The graph level centrality index.

theoretical_max

The maximum theoretical graph level centralization score for a graph with the given number of vertices, using the same parameters. If the normalized argument was TRUE, then the result was divided by this number.

See also

Examples

# A BA graph is quite centralized
g <- sample_pa(1000, m = 4)
centr_degree(g)$centralization
#> [1] 0.1638375
centr_clo(g, mode = "all")$centralization
#> [1] 0.4236249
centr_betw(g, directed = FALSE)$centralization
#> [1] 0.2452183
centr_eigen(g, directed = FALSE)$centralization
#> [1] 0.941744