centrality_closeness: Closeness Centrality

View source: R/centrality.R

centrality_closenessR Documentation

Closeness Centrality

Description

Inverse of the average shortest path distance from a node to all others. For directed networks, centrality_incloseness and centrality_outcloseness measure incoming and outgoing closeness.

Usage

centrality_closeness(x, mode = "all", ...)

centrality_incloseness(x, ...)

centrality_outcloseness(x, ...)

Arguments

x

Network input (matrix, igraph, network, cograph_network, tna object).

mode

For directed networks: "all" (default), "in", or "out".

...

Additional arguments passed to centrality (e.g., normalized, weighted, directed).

Value

Named numeric vector of closeness values.

See Also

centrality for computing multiple measures at once, centrality_harmonic for a variant that handles disconnected graphs.

Examples

adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3, 3)
rownames(adj) <- colnames(adj) <- c("A", "B", "C")
centrality_closeness(adj)

cograph documentation built on April 1, 2026, 1:07 a.m.