Learn R Programming

netrankr (version 1.2.4)

swan_closeness: Impact on closeness when a node is removed

Description

swan_closeness measures the change in the sum of the inverse of distances between all node pairs when excluding that node.#'

Usage

swan_closeness(g)

Value

A numeric vector containing the swan_closeness values for all vertices.

Arguments

g

An igraph object representing the graph to analyze.

Details

swan_closeness measures the impact of a node's removal by computing the change in the sum of inverse distances between all node pairs.

The code is an adaptation from the NetSwan package that was archived on CRAN.

References

Lhomme S. (2015). Analyse spatiale de la structure des réseaux techniques dans un contexte de risques. Cybergeo: European Journal of Geography.

Examples

Run this code
library(igraph)
# Example graph (electrical network structure)
elec <- matrix(ncol = 2, byrow = TRUE, c(
  11,1, 11,10, 1,2, 2,3, 2,9,
  3,4, 3,8, 4,5, 5,6, 5,7,
  6,7, 7,8, 8,9, 9,10
))
gra <- graph_from_edgelist(elec, directed = FALSE)

# Compute swan_closeness
f2 <- swan_closeness(gra)

# Compare with betweenness centrality
bet <- betweenness(gra)
reg <- lm(bet ~ f2)
summary(reg)

Run the code above in your browser using DataLab