The vulnerability of a network, in terms of the change in necessary path lengths.

g_vuln_efficiency(
  g,
  method = c("harmonic", "sum"),
  mode = c("all", "out", "in"),
  weight = NA,
  disconnected = c("size", "max", "infinite"),
  digits = 3
)

Arguments

g

object of class igraph, network, matrix

method

Either "harmonic" (the default) or "sum". Denotes which method to use for the measure of efficiency.

mode

Character constant, gives whether the shortest paths to or from the vertices should be calculated for directed graphs. If out then the shortest paths in the direction of the edges is taken, if in then paths will go against the direction of the edge. If all, the default, then the corresponding undirected graph will be used, ie. edge direction is not taken into account. This argument is ignored for undirected graphs.

weight

Possibly a numeric vector giving edge weights. If this is NA–which is the default– then no weights are used (even if the graph has a weight attribute). If set to NULL and the graph has a weight edge attribute, then this edge attribute is used in the calculation of the distances.

disconnected

how to deal with disconnected vertices. See Details. This is irrelevant for fully connected graphs and then does not need to be set. The default is disconnected == "size".

digits

number of decimals for vuln_prop.

Value

data.frame

Details

When a vertex is removed from the network, some other vertices might not be able to reach each other as efficiently as before anymore. For example, when A-B-C, the removal of vertex B requires A and C to connect through other vertices than through B, which might require more steps.

The "efficiency" of a graph can be defined in many ways, here we adopt two of the common definitions: the sum of the geodesic lengths between each pair of vertices or the harmonic mean of these lengths. The latter is the default in this function.

Actually, the measure captures the **lack** of efficiency: the more efficient the network, the lower should be the sum or the harmonic mean of the geodesic lengths. As a result, the efficiency score might more appropriately be called "inefficiency," but we use the term "efficiency" here for compatibility with the literature.

This algorithm calculates the change in efficiency due to vertex i as the increase in summed geodesic lengths (across the whole network)–or the harmonic mean of these lengths–after vertex i has been removed. Note that this measure is not comparable between graphs of different sizes; it is therefore mainly useful to find those vertices that have the most (or, perhaps, least) critical influence on the graph.

The output includes a column vuln_prop that is the ratio of the harmonic mean of (or: total) geodesic lengths after removing the vertex and that before removing it ( correcting for the paths to and from i). For example, if this ratio is 1.5, then the efficiency (without the paths to and from i) decreases by 50 A score of 1 means that there is no effect on the efficiency of the graph when the vertex is removed from the graph.

When a graph is fully connected, the geodesic between disconnected vertices is not defined and is commonly reported as infinite. Using infinite distances renders efficiency calculations largely useless, since it makes the summed geodesic lengths infinite as well and can even lead to an infinite reduction in summed geodesic lengths when a disconnected vertex is removed from the graph.

Therefore, the default in this function is to set the distance to a disconnected vertex to n + 1, with n equal to the number of vertices in the original graph (ie. the "size" of the graph before removing any vertices). This is disconnected == "size". If a weighted graph is used (and the weight argument has been specified appropriately), the distance to a disconnected vertex is set to to n*maximum_weight + 1. Of course, this is a somewhat arbitrary choice.

Alternatively, "max" sets it to "maximum distance + 1" (of the graph before removing any vertices). If an edge weight has been specified, it will be used here as well.

The argument disconnected == "infinite" maintains the Inf value for the geodesic lengths of paths between disconnected vertices.

Alternatively, one can also provide a numeric value for disconnected. In that case, the Inf values will replaced by this number.

When a vector of length larger than 1 is specified for disconnected, the first value will be used only.

Note

This function is inspired by the swan_efficiency function. Our function is more robust and a lot more useful (e.g., the original function was useless for not-fully connected graphs.) Our function yields the same SCORE as swan_efficiency through g_vuln_efficiency(g, method = "sum", weight = NULL, disconnected = "infinite").

See also

Other vulnerability measures: g_vuln_attack(), g_vuln_paths()