Learn R Programming

IVPP (version 1.1.2)

centrality: Centrality (degree/EI) and bridge centrality for an network matrix

Description

Computes node centrality measures from a weighted network matrix. Degree and expected-influence measures are obtained via centrality and bridge centrality is obtained via bridge when communities are supplied.

Usage

centrality(
  graph,
  communities = NULL,
  alpha = 1,
  posfun = abs,
  weighted = TRUE,
  signed = TRUE,
  directed = NULL,
  bridge_normalize = FALSE,
  useCommunities = "all"
)

Value

A list with components:

degree

Named list of numeric vectors (length p): OutDegree, InDegree, OutExpectedInfluence, InExpectedInfluence.

bridge

If communities is provided, the object returned by networktools::bridge(); otherwise NULL.

meta

List with metadata: directed, alpha, weighted, signed, and the expression name of posfun.

Arguments

graph

A square numeric network matrix (p x p). Can be weighted and/or signed. If directed, provide a non-symmetric matrix. Row and column names should be identical and in the same order (node names).

communities

A character vector indicating community membership of the nodes (e.g., c("Comm1", "Comm1", "Comm2", "Comm2)).

alpha

The tuning parameter. Defaults to 1.

posfun

A function that converts positive and negative values to only positive. Defaults to the absolute value.

weighted

Logical, set to FALSE to set all edge weights to 1 or -1

signed

Logical, set to FALSE to make all edge weights absolute.

directed

Logical. Whether the input network is directed. Automatically detected if set to "NULL" (the default). Symmetric network matrices will be undirected, asymmetric matrices will be directed

bridge_normalize

logical. Bridge centralities are divided by their highest possible value (assuming max edge strength=1) in order to normalize by different community sizes

useCommunities

Character string passed to networktools::bridge(useCommunities = ...).

See Also

centrality, bridge

Examples

Run this code
# Undirected signed weighted example:
W <- matrix(c(
  0,  0.4, -0.2,
  0.4, 0,   0.1,
 -0.2, 0.1, 0
), nrow = 3, byrow = TRUE)
colnames(W) <- rownames(W) <- c("A","B","C")

cent <- centrality(W)
cent$degree$OutDegree
cent$degree$OutExpectedInfluence

# Bridge centrality:
comm <- c(A = "X", B = "X", C = "Y")
cent_b <- centrality(W, communities = comm)

Run the code above in your browser using DataLab