robustnessGraph: Analysis of supply network robustness

Description Usage Arguments Details Value See Also Examples

View source: R/robustness.R

Description

This function performs a "targeted attack" of a graph or a "random failure" analysis, calculating a tunable critical metric of the supply network after successive edge or vertex removals. Attacks can target a vertex or an edge according to different centrality indices.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
robustnessGraph(
  g,
  type = c("vertices", "edges"),
  vs = V(g)[V(g)$type == "I"],
  es = E(g),
  mode = c("random", "targeted"),
  metric.FUN = SAR,
  niter = Inf,
  ...
)

Arguments

g

igraph; a supply network where every node has a 'type' attribute which can be "P" (producer), "I" (intermediary), or "D" (distributor).

type

character string; either 'vertices' or 'edges' removals. (default: 'vertices').

vs

igraph.vs; used if type='vertices', the vertices which can be deleted. (default: only intermediaries).

es

igraph.es; used if type='edges', the edges which can be deleted. (default: all graph edges).

mode

character; how to choose the vertex or the edge to delete, either 'random' or 'targeted'. If 'targeted', the v or e with highest betweenness is selected (default: 'random').

metric.FUN

function; critical supply network metric to recompute at Each time step. (default: SAR).

niter

numeric; maximal number of removals (default: infinite).

...

if mode='targeted', other arguments can be passed to getVertices, or getEdges functions. Example:

  • if type='vertices' and ct.ind.FUN=betweenness, we target the vertex with highest betweenness.

  • if type='edges' and ct.ind.FUN=edge_betweenness, we target the edge with highest betweenness.

  • type='edges' and ct.ind.FUN=betweenness does not work.

Details

At each time step, a vertex or an edge is deleted from the supply network. Then, vertices isolated are also deleted (cascading failures), and critical metric is recomputed. Process stops if: * all graph elements has been deleted. * critical metrics reached 0. * maximal number of iterations has been reached

Value

numeric between 0 and 1. The mean of metric.FUN over iterations.

See Also

Improves brainGraph:robustness with more modularity in the choice of centrality index and critical metric. See https://github.com/cran/brainGraph/blob/master/R/robustness.R

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Generate a theoretical supply network, define producers (P),
## Intermediaries (I) and distributors (D) vertices.
library(igraph)
set.seed(123)
g = make_tree(20)
V(g)[!degree(g, mode="in")]$type = "P"
V(g)[degree(g, mode="in") & degree(g, mode="in")]$type = "I"
V(g)[!degree(g, mode="out")]$type = "D"
V(g)$color = c("green","red","yellow")[factor(V(g)$type, levels=c("P","I","D"))]
## Vertices robustness
robustnessGraph(g, type="v") # Random failures
robustnessGraph(g, type="v", mode="targ", ct.ind.FUN=betweenness) # Betweenness targeted attacks
robustnessGraph(g, type="v", mode="targ", ct.ind.FUN=degree) # Degree targeted
## Edges robustness
robustnessGraph(g, type="e")  # Random failures
robustnessGraph(g, type="e", mode="targ") # Betweenness targeted attacks

MiloMonnier/supplynet documentation built on Feb. 16, 2021, 8:03 p.m.