Calculate graph or vertex average shortest path lengths. For vertices, this is just the row means of the distance matrix. For the graph-level, it is the overall mean of the distance matrix.
mean_distance_wt(g, level = c("graph", "vertex"), weights = NULL,
xfm = FALSE, xfm.type = NULL, D = NULL)
Numeric vector (if level='vertex'
) of each vertex's shortest
path length, or a single number for the graph-level average
An igraph
graph object
Character string indicating whether to calculate vertex- or
graph-level shortest path length. Default: 'graph'
Numeric vector of edge weights; if NULL
(the default),
and if the graph has edge attribute weight
, then that will be used.
To avoid using weights, this should be NA
.
Logical indicating whether to transform the edge weights. Default:
FALSE
Character string specifying how to transform the weights.
Default: 1/w
Numeric matrix; the graph's “distance matrix”
By default, edge weights are not transformed (e.g., inverted). However, if
set to TRUE
, then the input graph must have a graph-level attribute
called 'xfm.type'
or you must supply a value in the function call. If
you supply a distance matrix (the D
argument), it is not necessary to
transform edge weights, as it is assumed the the distance matrix was
calculated from a graph with transformed edge weights already.