normalize.multiplex.adjacency is a function to compute the column normalization of a sparse matrix of the package Matrix.

normalize.multiplex.adjacency(x)

Arguments

x

A Matrix object describing an adjacency matrix of a network.

Value

A square sparse column normalized matrix created with the Matrix package.

Author

Alberto Valdeolivas Urbelz alvaldeolivas@gmail.com

Examples

m1 <- igraph::make_graph(c(1,2,1,3,2,3), directed = FALSE)
m2 <- igraph::make_graph(c(1,3,2,3,3,4,1,4), directed = FALSE)
multiObject <- create.multiplex(list(m1=m1,m2=m2))
AdjMatrix <- compute.adjacency.matrix(multiObject)
normalize.multiplex.adjacency(AdjMatrix)
#> 8 x 8 sparse Matrix of class "dgCMatrix"
#>           1_1       2_1       3_1 4_1       1_2 2_2  3_2       4_2
#> 1_1 .         0.3333333 0.3333333   . 0.3333333 .   .    .        
#> 2_1 0.3333333 .         0.3333333   . .         0.5 .    .        
#> 3_1 0.3333333 0.3333333 .           . .         .   0.25 .        
#> 4_1 .         .         .           . .         .   .    0.3333333
#> 1_2 0.3333333 .         .           . .         .   0.25 0.3333333
#> 2_2 .         0.3333333 .           . .         .   0.25 .        
#> 3_2 .         .         0.3333333   . 0.3333333 0.5 .    0.3333333
#> 4_2 .         .         .           1 0.3333333 .   0.25 .