Learn R Programming

brainGraph (version 2.7.3)

xfm.weights: Transform edge weights

Description

For distance-based measures, it is important to transform the edge weights so that the strongest connections are re-mapped to having the lowest weights. Then you may calculate e.g., the shortest path length which will include the strongest connections.

Usage

xfm.weights(g, xfm.type = c("1/w", "-log(w)", "1-w"), invert = FALSE)

Arguments

g

An igraph graph object

xfm.type

Character string specifying how to transform the weights (default: 1/w)

invert

Logical indicating whether or not to invert the transformation (default: FALSE)

Value

An igraph graph object with transformed edge weights and a graph attribute, xfm.type, of the type of transform

Details

There are 3 options for the type of transform to apply:

  1. 1/w: calculate the inverse

  2. -log(w): calculate the negative (natural) logarithm

  3. 1-w: subtract each weight from 1

To transform the weights back to original values, specify invert=TRUE.