Description Usage Arguments Details Value See Also Examples
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.
1 2 3 4 5 6 7 8 9 10 |
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: |
niter |
numeric; maximal number of removals (default: infinite). |
... |
if mode='targeted', other arguments can be passed to
|
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
numeric between 0 and 1. The mean of metric.FUN
over iterations.
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
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.