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.
xfm.weights(g, xfm.type = c("1/w", "-log(w)", "1-w"), invert = FALSE)
An igraph
graph object
Character string specifying how to transform the weights
(default: 1/w
)
Logical indicating whether or not to invert the transformation
(default: FALSE
)
An igraph
graph object with transformed edge weights and a
graph attribute, xfm.type
, of the type of transform
There are 3 options for the type of transform to apply:
1/w
: calculate the inverse
-log(w)
: calculate the negative (natural) logarithm
1-w
: subtract each weight from 1
To transform the weights back to original values, specify invert=TRUE
.