net_centrality: Compute Centrality Measures for a Network

View source: R/centrality_measures.R

net_centralityR Documentation

Compute Centrality Measures for a Network

Description

Computes centrality measures from a netobject, netobject_group, or cograph_network. For directed networks the default measures are InStrength, OutStrength, and Betweenness. For undirected networks the defaults are Closeness and Betweenness.

Usage

net_centrality(x, measures = NULL, loops = FALSE, centrality_fn = NULL, ...)

Arguments

x

A netobject, netobject_group, or cograph_network.

measures

Character vector. Centrality measures to compute. Built-in: "InStrength", "OutStrength", "Betweenness", "InCloseness", "OutCloseness", "Closeness". Default depends on directedness.

loops

Logical. Include self-loops (diagonal) in computation? Default: FALSE.

centrality_fn

Optional function. Custom centrality function that takes a weight matrix and returns a named list of centrality vectors.

...

Additional arguments (ignored).

Value

For a netobject: a data frame with node names as rows and centrality measures as columns. For a netobject_group: a named list of such data frames (one per group).

Examples

seqs <- data.frame(
  V1 = c("A","B","A","C"), V2 = c("B","C","B","A"),
  V3 = c("C","A","C","B"))
net <- build_network(seqs, method = "relative")
net_centrality(net)


Nestimate documentation built on April 20, 2026, 5:06 p.m.