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 connectivity loss
f3 <- swan_connectivity(gra)
Run the code above in your browser using DataLab