NetSwan-package: Network Strengths and Weaknesses Analysis

Description Details Author(s) Examples

Description

A set of functions for studying network robustness, resilience and vulnerability.

Details

The main goal of the 'NetSwan' library is to provide a set of functions to study vulnerability, resilience and robustness of graphs. It depends on 'igraph' package. 'Igraph' graphs have a class used in 'NetSwan'.

Author(s)

Serge Lhomme

Maintainer: Serge Lhomme <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
library(igraph)
library(NetSwan)
elec <- matrix(nc=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.edgelist(elec, directed=FALSE)

f<-swan_efficiency(gra)
vertex_attr(gra, "efficiency_loss", index = V(gra))<-f
vertex_attr(gra)

f2<-swan_closeness(gra)
bet<-betweenness(gra)
reg<-lm(bet~f2)
summary(reg)

f3<-swan_connectivity(gra)

f4<-swan_combinatory(gra,10)
plot(f4[,1],f4[,5], type='o', col='yellow',xlab="Fraction of nodes removed",
      ylab="Connectivity loss")
lines(f4[,1],f4[,3], type='o', col='red')
lines(f4[,1],f4[,4], type='o', col='orange')
lines(f4[,1],f4[,2], type='o', col='blue')
legend('bottomright',c("Random", "Betweenness", "Degree", "Cascading"), 
          lty=c(1,1,1,1), pch=c(1,1,1,1), 
          col=c("yellow","blue","red", "orange"))

Example output

Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

$efficiency_loss
 [1]  6 28 26  6  6  0 20 36 34  8  2


Call:
lm(formula = bet ~ f2)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.6235 -0.3692  0.1222  0.4552  1.2889 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -0.2541     0.4486  -0.566    0.585    
f2           -6.0531     0.3058 -19.791 9.96e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.836 on 9 degrees of freedom
Multiple R-squared:  0.9775,	Adjusted R-squared:  0.975 
F-statistic: 391.7 on 1 and 9 DF,  p-value: 9.959e-09

NetSwan documentation built on May 30, 2017, 4:41 a.m.