Geodesic K-path centrality counts the number of vertices that can be reached through a geodesic path of length less than "k".
v_geokpath_w(
graph,
vids = NULL,
mode = c("all", "out", "in"),
weights = NULL,
k = 3
)
The input graph as igraph object
Numeric vertex sequence, the vertices that should be considered.
Default is all vertices. Otherwise, the operation is performed on the
subgraph only containing vertices vids
.
Character constant, gives whether the shortest paths to or from
the given vertices should be calculated for directed graphs.
If out
then the shortest paths from the vertex, if in
then to
it will be considered. If all
, the default, then the corresponding
undirected graph will be used, ie. not directed paths are searched.
This argument is ignored for undirected graphs.
Possibly a numeric vector giving edge weights.
If this is NULL
, the default, and the graph has a weight edge attribute,
then the attribute is used. If this is NA
then no weights are used
(even if the graph has a weight attribute).
The k parameter. The default is 3.
A numeric vector contaning the centrality scores for the selected vertices.
This function counts the number of vertices that a specific vertex can
reach within k steps.
By default, this number is weighted (if the graph has a weight
edge attribute).
This can be overridden by setting the weights
argument to
NA
(no weight is used) or to a vector with weights (typically
this is a numeric edge attribute).
More detail at Geodesic K-Path Centrality
Borgatti, Stephen P., and Martin G. Everett. "A graph-theoretic perspective on centrality." Social networks 28.4 (2006): 466-484.
g <- igraph::barabasi.game(100)
#> Warning: `barabasi.game()` was deprecated in igraph 2.0.0.
#> ℹ Please use `sample_pa()` instead.
v_geokpath_w(g)
#> [1] 69 62 67 41 62 32 21 42 11 52 43 11 52 52 42 43 11 21 43 52 42 52 24 14 9
#> [26] 15 15 52 53 52 45 11 13 13 52 52 32 16 32 32 5 14 15 32 25 15 10 13 52 52
#> [51] 52 14 42 13 32 52 32 13 11 11 52 32 52 15 5 11 32 32 25 15 13 5 24 3 8
#> [76] 25 9 8 52 10 32 10 52 9 52 24 24 9 3 7 3 15 9 24 3 11 42 4 52 15