R/RWRandMatrices.R
compute.transition.matrix.Rdcompute.transition.matrix is a function to compute the transition
matrix of a multiplex heterogeneous network provided as a MultiplexHet
object.
compute.transition.matrix(x,lambda = 0.5, delta1=0.5, delta2=0.5)A MultiplexHet object describing a multiplex and
heterogeneous network generated by the function
create.multiplexHet.
A numeric value between 0 and 1. It sets the probability of jumping within a network or change to the other network of the heterogeneous system. It is set by default to 0.5. See more details below.
A numeric value between 0 and 1. It sets the probability of performing inter-layer versus intra-layer transitions in the first multiplex. It is set by default to 0.5. See more details below.
A numeric value between 0 and 1. It sets the probability of performing inter-layer versus intra-layer transitions in the second multiplex. It is set by default to 0.5. See more details below.
A square sparse transition matrix created with the Matrix
package. It is the transition matrix for the Random Walk with Restart on
Multiplex and Heterogeneous networks algorithm.
We clarify the role of the different parameters in this point:
lambda: For a given node, if a bipartite association exists,
the particle can either jump between networks or stay in the current
graph with a probability given by this parameter. The closer lambda is to
one, the higher is the probability of jumping between networks following
bipartite interactions.
delta: This parameter sets the probability to change between
layers at the next step. If delta = 0, the particle will always remain
in the same layer after a non-restart iteration. On the other hand, if
delta = 1, the particle will always change between layers, therefore
not following the specific edges of each layer.
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_1 <- create.multiplex(list(m1=m1,m2=m2))
h1 <- igraph::make_graph(c("A","C","B","E","E","D","E","C"), directed = FALSE)
bipartite_relations <- data.frame(m=c(1,3),h=c("A","E"))
multiObject_2 <- create.multiplex(list(h1=h1))
multiHetObject <- create.multiplexHet(multiObject_1, multiObject_2,
bipartite_relations)
#> checking input arguments...
#> Generating bipartite matrix...
#> Expanding bipartite matrix to fit the multiplex network...
compute.transition.matrix(multiHetObject)
#> Computing adjacency matrix of the first Multiplex network...
#> Computing adjacency matrix of the second Multiplex network...
#> Computing inter-subnetworks transitions...
#> Computing intra-subnetworks transitions...
#> Combining inter e intra layer probabilities into the global
#> Transition Matix
#> 13 x 13 sparse Matrix of class "dgCMatrix"
#> [[ suppressing 13 column names ‘1_1’, ‘2_1’, ‘3_1’ ... ]]
#>
#> 1_1 . 0.3333333 0.1666667 . 0.1666667 . . . 0.25 . . .
#> 2_1 0.1666667 . 0.1666667 . . 0.5 . . . . . .
#> 3_1 0.1666667 0.3333333 . . . . 0.125 . . . . .
#> 4_1 . . . . . . . 0.3333333 . . . .
#> 1_2 0.1666667 . . . . . 0.125 0.3333333 0.25 . . .
#> 2_2 . 0.3333333 . . . . 0.125 . . . . .
#> 3_2 . . 0.1666667 . 0.1666667 0.5 . 0.3333333 . . . .
#> 4_2 . . . 1 0.1666667 . 0.125 . . . . .
#> A_1 0.5000000 . . . 0.5000000 . . . . . 0.5 .
#> B_1 . . . . . . . . . . . .
#> C_1 . . . . . . . . 0.50 . . .
#> D_1 . . . . . . . . . . . .
#> E_1 . . 0.5000000 . . . 0.500 . . 1 0.5 1
#>
#> 1_1 .
#> 2_1 .
#> 3_1 0.2500000
#> 4_1 .
#> 1_2 .
#> 2_2 .
#> 3_2 0.2500000
#> 4_2 .
#> A_1 .
#> B_1 0.1666667
#> C_1 0.1666667
#> D_1 0.1666667
#> E_1 .