mean_distance_wt {brainGraph}R Documentation

Calculate weighted shortest path lengths

Description

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.

Usage

mean_distance_wt(g, level = c("graph", "vertex"), weights = NULL,
  xfm = FALSE, xfm.type = NULL, D = NULL)

Arguments

g

An igraph graph object

level

Character string indicating whether to calculate vertex- or graph-level shortest path length. Default: 'graph'

weights

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.

xfm

Logical indicating whether to transform the edge weights. Default: FALSE

xfm.type

Character string specifying how to transform the weights. Default: 1/w

D

Numeric matrix; the graph's “distance matrix”

Details

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.

Value

Numeric vector (if level='vertex') of each vertex's shortest path length, or a single number for the graph-level average


[Package brainGraph version 3.1.0 Index]