Skip to contents

Computes the vulnerability of each node, defined as the relative drop in global efficiency when that node is removed from the network.

Usage

vulnerability(
  x,
  directed = NULL,
  normalized = TRUE,
  weighted = FALSE,
  invert_weights = TRUE,
  alpha = 1,
  digits = NULL,
  ...
)

Arguments

x

Network input: matrix, igraph, network, cograph_network, or tna object.

directed

Logical or NULL. If NULL (default), auto-detect from matrix symmetry. Set TRUE to force directed, FALSE to force undirected.

normalized

Logical. If TRUE (default), return the proportional drop. If FALSE, return the raw efficiency difference.

weighted

Logical. If TRUE, honor edge weights when computing shortest paths (Dijkstra); distance is 1/weight^alpha per the usual qgraph/tna convention when invert_weights = TRUE. If FALSE (default, matches prior behavior), all edges are treated as unit length.

invert_weights

Logical. If TRUE (default) and weights are present, invert weights to distances via 1/weight^alpha so that higher weight = shorter path (matches centrality()'s default). Ignored when weighted = FALSE.

alpha

Weight-to-distance exponent (default 1).

digits

Integer or NULL. Round scores to this many decimal places. Default NULL (no rounding).

...

Currently unused; directed is already an explicit argument above and to_igraph accepts no others.

Value

A data frame of class "cograph_vulnerability" with one row per node and columns:

node

Node labels.

vulnerability

Vulnerability scores, sorted descending.

The original input network ("network") and the normalization mode ("normalized") are stored as attributes. Scores are NA for a network with at most one node, and all zero when the full network already has zero global efficiency.

Details

$$V(i) = \frac{E_{global} - E_{global \setminus i}}{E_{global}}$$

where \(E_{global}\) is the global efficiency of the full network and \(E_{global \setminus i}\) is the global efficiency after removing node i and all its edges.

Global efficiency is defined as:

$$E_{global} = \frac{1}{n(n-1)} \sum_{i \neq j} \frac{1}{d(i,j)}$$

\(E_{global \setminus i}\) is computed on the reduced graph but keeps the original \(n(n-1)\) denominator, so vulnerability is bounded below by zero (Latora & Marchiori 2007); re-normalizing by \((n-1)(n-2)\) would let a node removal appear to raise efficiency.

Nodes with high vulnerability are critical to the network's communication efficiency. Removing them causes the greatest drop in global efficiency.

Performance note: This function computes all-pairs shortest paths once for the full graph and once per node removal, giving O(n) calls to the shortest-path algorithm. A warning is issued for networks with more than 500 nodes.

References

Latora, V. & Marchiori, M. (2007). A measure of centrality based on network efficiency. New Journal of Physics, 9(6), 188. doi:10.1088/1367-2630/9/6/188

Examples

# Star network: hub is most vulnerable
star <- matrix(c(0,1,1,1, 1,0,0,0, 1,0,0,0, 1,0,0,0), 4, 4)
rownames(star) <- colnames(star) <- c("hub", "a", "b", "c")
cograph::vulnerability(star)
#> Node Vulnerability (normalized)
#>  node vulnerability
#>   hub     1.0000000
#>     a     0.4444444
#>     b     0.4444444
#>     c     0.4444444

# Complete graph: all nodes equally vulnerable
k4 <- matrix(1, 4, 4); diag(k4) <- 0
rownames(k4) <- colnames(k4) <- c("A", "B", "C", "D")
cograph::vulnerability(k4)
#> Node Vulnerability (normalized)
#>  node vulnerability
#>     A           0.5
#>     B           0.5
#>     C           0.5
#>     D           0.5