Construct and use the Regularized Laplacian
Source:R/RegularizedLaplacian.R
RegularizedLaplacian.Rd
Construct and use the Regularized Laplacian
Usage
RegularizedLaplacian(A, tau_row = NULL, tau_col = NULL)
# S4 method for RegularizedLaplacian,Matrix
transform(iform, A)
# S4 method for RegularizedLaplacian,matrix
transform(iform, A)
# S4 method for RegularizedLaplacian,sparseLRMatrix
transform(iform, A)
# S4 method for RegularizedLaplacian,Matrix
inverse_transform(iform, A)
# S4 method for RegularizedLaplacian,matrix
inverse_transform(iform, A)
# S4 method for RegularizedLaplacian,vsp_fa
inverse_transform(iform, A)
Arguments
- A
A matrix to transform.
- tau_row
Additive regularizer for row sums of
abs(A)
. Typically this corresponds to inflating the (absolute) out-degree of each node bytau_row
. Defaults toNULL
, in which case we settau_row
to the mean (absolute) row sum ofA
.- tau_col
Additive regularizer for column sums of
abs(A)
. Typically this corresponds to inflating the (absolute) in-degree of each node bytau_col
. Defaults toNULL
, in which case we settau_col
to the mean (absolute) column sum ofA
.- iform
An Invertiform object describing the transformation.
Value
RegularizedLaplacian()
creates a RegularizedLaplacian object.transform()
returns the transformed matrix, typically as a Matrix.inverse_transform()
returns the inverse transformed matrix, typically as a Matrix.
Details
We define the regularized Laplacian \(L^\tau(A)\) of an \(n \times n\) graph adjacency matrix \(A\) as
$$ L^\tau(A)_{ij} = \frac{A_{ij}}{\sqrt{d^{out}_i + \tau_{row}} \sqrt{d^{in}_j + \tau_{col}}} $$
where
$$ d^{out}_i = \sum_{j=1}^n \| A_{ij} \| $$
and
$$ d^{in}_j = \sum_{i=1}^n \| A_{ij} \|. $$
When \(A_{ij}\) denotes the present of an edge from node \(i\) to node \(j\), which is fairly standard notation, \(d^{out}_i\) denotes the (absolute) out-degree of node \(i\) and \(d^{in}_j\) denotes the (absolute) in-degree of node \(j\). Then \(\tau_{row}\) is an additive out-degree regularizer and \(\tau_{col}\) is an additive in-degree regularizer.
Note that this documentation renders more clearly at https://rohelab.github.io/invertiforms/.
Examples
library(igraph)
library(igraphdata)
data("karate", package = "igraphdata")
A <- get.adjacency(karate)
iform <- RegularizedLaplacian(A)
L <- transform(iform, A)
L
#> 34 x 34 sparse Matrix of class "dgCMatrix"
#> [[ suppressing 34 column names ‘Mr Hi’, ‘Actor 2’, ‘Actor 3’ ... ]]
#>
#> Mr Hi . 0.05978730 0.05770176 0.06772962 0.08000554 0.07520357
#> Actor 2 0.05978730 . 0.07102596 0.08336940 . .
#> Actor 3 0.05770176 0.07102596 . 0.08046126 . .
#> Actor 4 0.06772962 0.08336940 0.08046126 . . .
#> Actor 5 0.08000554 . . . . .
#> Actor 6 0.07520357 . . . . .
#> Actor 7 0.07520357 . . . 0.12387328 0.11643836
#> Actor 8 0.07520357 0.09256920 0.08934015 0.10486637 . .
#> Actor 9 0.07117395 . 0.08455305 . . .
#> Actor 10 . . 0.10200326 . . .
#> Actor 11 0.08000554 . . . 0.13178295 0.12387328
#> Actor 12 0.09322944 . . . . .
#> Actor 13 0.08586297 . . 0.11973019 . .
#> Actor 14 0.07117395 0.08760908 0.08455305 0.09924734 . .
#> Actor 15 . . . . . .
#> Actor 16 . . . . . .
#> Actor 17 . . . . . 0.13294239
#> Actor 18 0.08586297 0.10569001 . . . .
#> Actor 19 . . . . . .
#> Actor 20 0.08000554 0.09848001 . . . .
#> Actor 21 . . . . . .
#> Actor 22 0.08586297 0.10569001 . . . .
#> Actor 23 . . . . . .
#> Actor 24 . . . . . .
#> Actor 25 . . . . . .
#> Actor 26 . . . . . .
#> Actor 27 . . . . . .
#> Actor 28 . . 0.08934015 . . .
#> Actor 29 . . 0.09504477 . . .
#> Actor 30 . . . . . .
#> Actor 31 . 0.09256920 . . . .
#> Actor 32 0.06772962 . . . . .
#> Actor 33 . . 0.06428335 . . .
#> John A . . . . . .
#>
#> Mr Hi 0.07520357 0.07520357 0.07117395 . 0.08000554 0.09322944
#> Actor 2 . 0.09256920 . . . .
#> Actor 3 . 0.08934015 0.08455305 0.10200326 . .
#> Actor 4 . 0.10486637 . . . .
#> Actor 5 0.12387328 . . . 0.13178295 .
#> Actor 6 0.11643836 . . . 0.12387328 .
#> Actor 7 . . . . . .
#> Actor 8 . . . . . .
#> Actor 9 . . . . . .
#> Actor 10 . . . . . .
#> Actor 11 . . . . . .
#> Actor 12 . . . . . .
#> Actor 13 . . . . . .
#> Actor 14 . . . . . .
#> Actor 15 . . . . . .
#> Actor 16 . . . . . .
#> Actor 17 0.13294239 . . . . .
#> Actor 18 . . . . . .
#> Actor 19 . . . . . .
#> Actor 20 . . . . . .
#> Actor 21 . . . . . .
#> Actor 22 . . . . . .
#> Actor 23 . . . . . .
#> Actor 24 . . . . . .
#> Actor 25 . . . . . .
#> Actor 26 . . . . . .
#> Actor 27 . . . . . .
#> Actor 28 . . . . . .
#> Actor 29 . . . . . .
#> Actor 30 . . . . . .
#> Actor 31 . . 0.11019926 . . .
#> Actor 32 . . . . . .
#> Actor 33 . . 0.07929222 . . .
#> John A . . 0.06950597 0.08385074 . .
#>
#> Mr Hi 0.08586297 0.07117395 . . . 0.08586297
#> Actor 2 . 0.08760908 . . . 0.10569001
#> Actor 3 . 0.08455305 . . . .
#> Actor 4 0.11973019 0.09924734 . . . .
#> Actor 5 . . . . . .
#> Actor 6 . . . . 0.1329424 .
#> Actor 7 . . . . 0.1329424 .
#> Actor 8 . . . . . .
#> Actor 9 . . . . . .
#> Actor 10 . . . . . .
#> Actor 11 . . . . . .
#> Actor 12 . . . . . .
#> Actor 13 . . . . . .
#> Actor 14 . . . . . .
#> Actor 15 . . . . . .
#> Actor 16 . . . . . .
#> Actor 17 . . . . . .
#> Actor 18 . . . . . .
#> Actor 19 . . . . . .
#> Actor 20 . . . . . .
#> Actor 21 . . . . . .
#> Actor 22 . . . . . .
#> Actor 23 . . . . . .
#> Actor 24 . . . . . .
#> Actor 25 . . . . . .
#> Actor 26 . . . . . .
#> Actor 27 . . . . . .
#> Actor 28 . . . . . .
#> Actor 29 . . . . . .
#> Actor 30 . . . . . .
#> Actor 31 . . . . . .
#> Actor 32 . . . . . .
#> Actor 33 . . 0.09565669 0.09565669 . .
#> John A . 0.06950597 0.08385074 0.08385074 . .
#>
#> Mr Hi . 0.08000554 . 0.08586297 . .
#> Actor 2 . 0.09848001 . 0.10569001 . .
#> Actor 3 . . . . . .
#> Actor 4 . . . . . .
#> Actor 5 . . . . . .
#> Actor 6 . . . . . .
#> Actor 7 . . . . . .
#> Actor 8 . . . . . .
#> Actor 9 . . . . . .
#> Actor 10 . . . . . .
#> Actor 11 . . . . . .
#> Actor 12 . . . . . .
#> Actor 13 . . . . . .
#> Actor 14 . . . . . .
#> Actor 15 . . . . . .
#> Actor 16 . . . . . .
#> Actor 17 . . . . . .
#> Actor 18 . . . . . .
#> Actor 19 . . . . . .
#> Actor 20 . . . . . .
#> Actor 21 . . . . . .
#> Actor 22 . . . . . .
#> Actor 23 . . . . . .
#> Actor 24 . . . . . .
#> Actor 25 . . . . . .
#> Actor 26 . . . . . 0.11723580
#> Actor 27 . . . . . .
#> Actor 28 . . . . . 0.11019926
#> Actor 29 . . . . . .
#> Actor 30 . . . . . 0.11019926
#> Actor 31 . . . . . .
#> Actor 32 . . . . . .
#> Actor 33 0.09565669 . 0.09565669 . 0.09565669 0.07929222
#> John A 0.08385074 0.07813058 0.08385074 . 0.08385074 0.06950597
#>
#> Mr Hi . . . . . .
#> Actor 2 . . . . . .
#> Actor 3 . . . 0.08934015 0.09504477 .
#> Actor 4 . . . . . .
#> Actor 5 . . . . . .
#> Actor 6 . . . . . .
#> Actor 7 . . . . . .
#> Actor 8 . . . . . .
#> Actor 9 . . . . . .
#> Actor 10 . . . . . .
#> Actor 11 . . . . . .
#> Actor 12 . . . . . .
#> Actor 13 . . . . . .
#> Actor 14 . . . . . .
#> Actor 15 . . . . . .
#> Actor 16 . . . . . .
#> Actor 17 . . . . . .
#> Actor 18 . . . . . .
#> Actor 19 . . . . . .
#> Actor 20 . . . . . .
#> Actor 21 . . . . . .
#> Actor 22 . . . . . .
#> Actor 23 . . . . . .
#> Actor 24 . 0.1172358 . 0.11019926 . 0.11019926
#> Actor 25 . 0.1317829 . 0.12387328 . .
#> Actor 26 0.1317829 . . . . .
#> Actor 27 . . . . . 0.13294239
#> Actor 28 0.1238733 . . . . .
#> Actor 29 . . . . . .
#> Actor 30 . . 0.13294239 . . .
#> Actor 31 . . . . . .
#> Actor 32 0.1115624 0.1115624 . . 0.11156239 .
#> Actor 33 . . . . . 0.08378146
#> John A . . 0.08385074 0.07344115 0.07813058 0.07344115
#>
#> Mr Hi . 0.06772962 . .
#> Actor 2 0.09256920 . . .
#> Actor 3 . . 0.06428335 .
#> Actor 4 . . . .
#> Actor 5 . . . .
#> Actor 6 . . . .
#> Actor 7 . . . .
#> Actor 8 . . . .
#> Actor 9 0.11019926 . 0.07929222 0.06950597
#> Actor 10 . . . 0.08385074
#> Actor 11 . . . .
#> Actor 12 . . . .
#> Actor 13 . . . .
#> Actor 14 . . . 0.06950597
#> Actor 15 . . 0.09565669 0.08385074
#> Actor 16 . . 0.09565669 0.08385074
#> Actor 17 . . . .
#> Actor 18 . . . .
#> Actor 19 . . 0.09565669 0.08385074
#> Actor 20 . . . 0.07813058
#> Actor 21 . . 0.09565669 0.08385074
#> Actor 22 . . . .
#> Actor 23 . . 0.09565669 0.08385074
#> Actor 24 . . 0.07929222 0.06950597
#> Actor 25 . 0.11156239 . .
#> Actor 26 . 0.11156239 . .
#> Actor 27 . . . 0.08385074
#> Actor 28 . . . 0.07344115
#> Actor 29 . 0.11156239 . 0.07813058
#> Actor 30 . . 0.08378146 0.07344115
#> Actor 31 . . 0.08378146 0.07344115
#> Actor 32 . . 0.07545502 0.06614235
#> Actor 33 0.08378146 0.07545502 . 0.05284347
#> John A 0.07344115 0.06614235 0.05284347 .
A_recovered <- inverse_transform(iform, L)
all.equal(A, A_recovered)
#> [1] TRUE