Normalize the transition matrix.
normalize(x, ...)
object of class Transition*
optional argument method
(see Details)
an object of class TransitionLayer
argument method
passed through ...
a character for the normalization method
the default is 'row' users can set the optional method argument
to either "col" or "symm"
Normalization of the weighted adjacency matrix in the Transition* object. Matrix values are divided by their respective row-sums, column-sums, or the product of the square-roots of both (symmetric normalization).
The default method
is row-normalization. To use the other normalization
methods, users can set the optional method
argument
to either "col" or "symm".
For random walk calculations a symmetric matrix is needed (method = "symm").
von Luxburg, U. 2007. A tutorial on spectral clustering. Statistics and Computing 17(4), 395-416. doi:10.1007/s11222-007-9033-z
Chung, F. 1997. Spectral Graph Theory. Conference Board of the Mathematical Sciences, Washington.
library("raster")
r <- raster(ncol=36,nrow=18)
r <- setValues(r,rep(1,times=ncell(r)))
tr <- transition(r, mean, directions=8)
#> The extent and CRS indicate this raster is a global lat/lon raster. This means that transitions going off of the East or West edges will 'wrap' to the opposite edge.
#> Global lat/lon rasters are not supported under new optimizations for 4 and 8 directions with custom transition functions. Falling back to old method.
normalize(tr)
#> class : TransitionLayer
#> dimensions : 18, 36, 648 (nrow, ncol, ncell)
#> resolution : 10, 10 (x, y)
#> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> values : conductance
#> matrix class: dgCMatrix
normalize(tr, method="symm")
#> class : TransitionLayer
#> dimensions : 18, 36, 648 (nrow, ncol, ncell)
#> resolution : 10, 10 (x, y)
#> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> values : conductance
#> matrix class: dsCMatrix