Construct and use the Perturbed Laplacian
Usage
PerturbedLaplacian(A, tau = NULL)
# S4 method for PerturbedLaplacian,sparseMatrix
transform(iform, A)
# S4 method for PerturbedLaplacian,sparseLRMatrix
inverse_transform(iform, A)
Arguments
- A
A matrix to transform.
- tau
Additive regularizer for row and column sums of
abs(A)
. Typically this corresponds to inflating the (absolute) out-degree and the (absolute) in-degree of each node bytau
. Defaults toNULL
, in which case we settau
to the mean value ofabs(A)
.- iform
An Invertiform object describing the transformation.
Value
PerturbedLaplacian()
creates a PerturbedLaplacian 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 perturbed Laplacian \(L^\tau(A)\) of an \(n \times n\) graph adjacency matrix \(A\) as
$$ L^\tau(A)_{ij} = \frac{A_{ij} + \frac{\tau}{n}}{\sqrt{d^{out}_i + \tau} \sqrt{d^{in}_j + \tau}} $$
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\).
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 <- PerturbedLaplacian(A)
L <- transform(iform, A)
L
#> An object of class "sparseLRMatrix"
#> Slot "sparse":
#> 34 x 34 sparse Matrix of class "dgCMatrix"
#> [[ suppressing 34 column names ‘Mr Hi’, ‘Actor 2’, ‘Actor 3’ ... ]]
#>
#> Mr Hi . 0.08236888 0.07819977 0.1005103 0.1406051 0.1224281
#> Actor 2 0.08236888 . 0.10392887 0.1335800 . .
#> Actor 3 0.07819977 0.10392887 . 0.1268188 . .
#> Actor 4 0.10051035 0.13358002 0.12681884 . . .
#> Actor 5 0.14060509 . . . . .
#> Actor 6 0.12242812 . . . . .
#> Actor 7 0.12242812 . . . 0.2777473 0.2418410
#> Actor 8 0.12242812 0.16270913 0.15447358 0.1985453 . .
#> Actor 9 0.10986217 . 0.13861850 . . .
#> Actor 10 . . 0.21497877 . . .
#> Actor 11 0.14060509 . . . 0.3189845 0.2777473
#> Actor 12 0.23368359 . . . . .
#> Actor 13 0.17038155 . . 0.2763127 . .
#> Actor 14 0.10986217 0.14600877 0.13861850 0.1781667 . .
#> Actor 15 . . . . . .
#> Actor 16 . . . . . .
#> Actor 17 . . . . . 0.3365668
#> Actor 18 0.17038155 0.22644008 . . . .
#> Actor 19 . . . . . .
#> Actor 20 0.14060509 0.18686664 . . . .
#> Actor 21 . . . . . .
#> Actor 22 0.17038155 0.22644008 . . . .
#> Actor 23 . . . . . .
#> Actor 24 . . . . . .
#> Actor 25 . . . . . .
#> Actor 26 . . . . . .
#> Actor 27 . . . . . .
#> Actor 28 . . 0.15447358 . . .
#> Actor 29 . . 0.17740835 . . .
#> Actor 30 . . . . . .
#> Actor 31 . 0.16270913 . . . .
#> Actor 32 0.10051035 . . . . .
#> Actor 33 . . 0.09017170 . . .
#> John A . . . . . .
#>
#> Mr Hi 0.1224281 0.1224281 0.1098622 . 0.1406051 0.2336836 0.1703815
#> Actor 2 . 0.1627091 . . . . .
#> Actor 3 . 0.1544736 0.1386185 0.2149788 . . .
#> Actor 4 . 0.1985453 . . . . 0.2763127
#> Actor 5 0.2777473 . . . 0.3189845 . .
#> Actor 6 0.2418410 . . . 0.2777473 . .
#> Actor 7 . . . . . . .
#> Actor 8 . . . . . . .
#> Actor 9 . . . . . . .
#> Actor 10 . . . . . . .
#> Actor 11 . . . . . . .
#> Actor 12 . . . . . . .
#> Actor 13 . . . . . . .
#> Actor 14 . . . . . . .
#> Actor 15 . . . . . . .
#> Actor 16 . . . . . . .
#> Actor 17 0.3365668 . . . . . .
#> 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.2170186 . . . .
#> Actor 32 . . . . . . .
#> Actor 33 . . 0.1266814 . . . .
#> John A . . 0.1066082 0.1653351 . . .
#>
#> Mr Hi 0.1098622 . . . 0.1703815 . 0.1406051
#> Actor 2 0.1460088 . . . 0.2264401 . 0.1868666
#> Actor 3 0.1386185 . . . . . .
#> Actor 4 0.1781667 . . . . . .
#> Actor 5 . . . . . . .
#> Actor 6 . . . 0.3365668 . . .
#> Actor 7 . . . 0.3365668 . . .
#> 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.1964660 0.1964660 . . 0.1964660 .
#> John A 0.1066082 0.1653351 0.1653351 . . 0.1653351 0.1364405
#>
#> Mr Hi . 0.1703815 . . . . .
#> Actor 2 . 0.2264401 . . . . .
#> 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 . . . . . 0.2492395 .
#> Actor 25 . . . . . 0.3189845 .
#> Actor 26 . . . 0.2492395 0.3189845 . .
#> Actor 27 . . . . . . .
#> Actor 28 . . . 0.2170186 0.2777473 . .
#> Actor 29 . . . . . . .
#> Actor 30 . . . 0.2170186 . . 0.3365668
#> Actor 31 . . . . . . .
#> Actor 32 . . . . 0.2280234 0.2280234 .
#> Actor 33 0.1964660 . 0.1964660 0.1266814 . . .
#> John A 0.1653351 . 0.1653351 0.1066082 . . 0.1653351
#>
#> Mr Hi . . . . 0.10051035 .
#> Actor 2 . . . 0.1627091 . .
#> Actor 3 0.1544736 0.1774084 . . . 0.09017170
#> Actor 4 . . . . . .
#> Actor 5 . . . . . .
#> Actor 6 . . . . . .
#> Actor 7 . . . . . .
#> Actor 8 . . . . . .
#> Actor 9 . . . 0.2170186 . 0.12668145
#> Actor 10 . . . . . .
#> Actor 11 . . . . . .
#> Actor 12 . . . . . .
#> Actor 13 . . . . . .
#> Actor 14 . . . . . .
#> Actor 15 . . . . . 0.19646599
#> Actor 16 . . . . . 0.19646599
#> Actor 17 . . . . . .
#> Actor 18 . . . . . .
#> Actor 19 . . . . . 0.19646599
#> Actor 20 . . . . . .
#> Actor 21 . . . . . 0.19646599
#> Actor 22 . . . . . .
#> Actor 23 . . . . . 0.19646599
#> Actor 24 0.2170186 . 0.2170186 . . 0.12668145
#> Actor 25 0.2777473 . . . 0.22802338 .
#> Actor 26 . . . . 0.22802338 .
#> Actor 27 . . 0.3365668 . . .
#> Actor 28 . . . . . .
#> Actor 29 . . . . 0.22802338 .
#> Actor 30 . . . . . 0.14117117
#> Actor 31 . . . . . 0.14117117
#> Actor 32 . 0.2280234 . . . 0.11589791
#> Actor 33 . . 0.1411712 0.1411712 0.11589791 .
#> John A 0.1188020 0.1364405 0.1188020 0.1188020 0.09753335 0.06934891
#>
#> Mr Hi .
#> Actor 2 .
#> Actor 3 .
#> Actor 4 .
#> Actor 5 .
#> Actor 6 .
#> Actor 7 .
#> Actor 8 .
#> Actor 9 0.10660819
#> Actor 10 0.16533505
#> Actor 11 .
#> Actor 12 .
#> Actor 13 .
#> Actor 14 0.10660819
#> Actor 15 0.16533505
#> Actor 16 0.16533505
#> Actor 17 .
#> Actor 18 .
#> Actor 19 0.16533505
#> Actor 20 0.13644054
#> Actor 21 0.16533505
#> Actor 22 .
#> Actor 23 0.16533505
#> Actor 24 0.10660819
#> Actor 25 .
#> Actor 26 .
#> Actor 27 0.16533505
#> Actor 28 0.11880195
#> Actor 29 0.13644054
#> Actor 30 0.11880195
#> Actor 31 0.11880195
#> Actor 32 0.09753335
#> Actor 33 0.06934891
#> John A .
#>
#> Slot "U":
#> 34 x 1 Matrix of class "dgeMatrix"
#> [,1]
#> [1,] 0.03359564
#> [2,] 0.04464920
#> [3,] 0.04238928
#> [4,] 0.05448304
#> [5,] 0.07621695
#> [6,] 0.06636387
#> [7,] 0.06636387
#> [8,] 0.06636387
#> [9,] 0.05955233
#> [10,] 0.09235770
#> [11,] 0.07621695
#> [12,] 0.12667146
#> [13,] 0.09235770
#> [14,] 0.05955233
#> [15,] 0.09235770
#> [16,] 0.09235770
#> [17,] 0.09235770
#> [18,] 0.09235770
#> [19,] 0.09235770
#> [20,] 0.07621695
#> [21,] 0.09235770
#> [22,] 0.09235770
#> [23,] 0.09235770
#> [24,] 0.05955233
#> [25,] 0.07621695
#> [26,] 0.07621695
#> [27,] 0.09235770
#> [28,] 0.06636387
#> [29,] 0.07621695
#> [30,] 0.06636387
#> [31,] 0.06636387
#> [32,] 0.05448304
#> [33,] 0.03873895
#> [34,] 0.03260058
#>
#> Slot "V":
#> 34 x 1 Matrix of class "dgeMatrix"
#> [,1]
#> [1,] 0.2489523
#> [2,] 0.3308621
#> [3,] 0.3141154
#> [4,] 0.4037333
#> [5,] 0.5647872
#> [6,] 0.4917733
#> [7,] 0.4917733
#> [8,] 0.4917733
#> [9,] 0.4412980
#> [10,] 0.6843942
#> [11,] 0.5647872
#> [12,] 0.9386680
#> [13,] 0.6843942
#> [14,] 0.4412980
#> [15,] 0.6843942
#> [16,] 0.6843942
#> [17,] 0.6843942
#> [18,] 0.6843942
#> [19,] 0.6843942
#> [20,] 0.5647872
#> [21,] 0.6843942
#> [22,] 0.6843942
#> [23,] 0.6843942
#> [24,] 0.4412980
#> [25,] 0.5647872
#> [26,] 0.5647872
#> [27,] 0.6843942
#> [28,] 0.4917733
#> [29,] 0.5647872
#> [30,] 0.4917733
#> [31,] 0.4917733
#> [32,] 0.4037333
#> [33,] 0.2870655
#> [34,] 0.2415787
#>
if (FALSE) {
A_recovered <- inverse_transform(iform, L)
all.equal(A, A_recovered)
}