The vulnerability of a network, in terms of the vanishing of of a path between vertices.
g_vuln_paths(g, mode = c("all", "out", "in"), weight = NULL, digits = 3)
graph, as an object of class igraph
, network
, or
matrix
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.
Possibly a numeric vector giving edge weights.
If this is NULL
–which is the default–and the graph
has a weight
edge attribute, then the attribute is used
in the calculation of the distances.
If this is NA
then no weights are used
(even if the graph has a weight
attribute).
number of decimals for vuln_prop
.
a data.frame with a score per vertex
When a vertex is removed from the network, some other vertices
might not be able to reach each other anymore.
This algorithm calculates the number of pairs of vertices
that can no longer reach each other without vertex i
in the network, but that were able to reach each other
with i
in the network.
More formally, we compare the number of pairs of vertices that
do not have some connecting path before and after removing
vertex i
.
The function returns this change score for
each vertex.
The i
th value is the number of pairs of vertices
that become disconnected when vertex i
is removed
from the network (leaving everything else the same).
The output includes a column vuln_prop
that
is the ratio of the number of disconnected pairs after
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 number
of disconnected pairs of vertices increases by 50
after removing vertex i
(discarding of the paths
to and from i
itself).
A score of 1 means that there is no effect on the
vertex-pair disconnectedness when the vertex is removed
from the graph.
A value of Inf
occurs when all vertices were
connected before i
was removed, but after removing
i
some became disconnected.
This makes the proportion Infinite since the number
is relative to the original number of disconnected
vertices, which was 0.
This function is inspired by
swan_connectivity
.
However, that function
is incorrect when the network is not fully connected.
Moreover, it does not correct for the ties to and from the
vertex that is deleted.
The implementation in the snafun
package corrects this.
In addition, it is more robust and more useful.
Other vulnerability measures:
g_vuln_attack()
,
g_vuln_efficiency()