R/InduceNetworks.R
create.multiplexHetNetwork.topResults.Rdcreate.multiplexHetNetwork.topResults is a function to create a
network from the top results of the Random Walk with Restart on Multiplex and
Heterogeneous networks algorithm (a RWRMH_Results object).
create.multiplexHetNetwork.topResults(RWRMH_Results_Object,
MultiplexHetObject, bipartite_relations, bipartite_name, k=25)A RWRMH_Results object generated by the
function Random.Walk.Restart.MultiplexHet representing the results
of the Random Ralk with restart on the multiplex and heterogeneous network
described in the following argument.
A MultiplexHet object generated by the
function create.multiplexHet representing a multiplex and
heterogeneous network.
A data frame containing the relationships (bipartite interactions) between the nodes of the first multiplex network and the nodes of the second multiplex of the heterogeneous system. The data frame should contain two or three columns: the first one with the nodes of the multiplex network; the second one with the nodes of the second network. The third one is not mandatory and it should contain the weights. Every node should be present in their corresponding multiplex network.
A vector containing the name for the bipartite relations to be integrated as part of the resulting network. It is included as an attribute for all the bipartite edges of the resulting network. It's optional and its default value is "bipartiteRelations".
A numeric value between 1 and 200. It is the number of top ranked nodes to be included in the resulting multiplex network.
An igraph object containing the top k ranked
multiplex nodes and the top k ranked second network nodes in the
Random Walk with Restart on a Multiplex and Heterogeneous network algorithm.
We include all the possible types of interactions between pairs of
nodes according to the different layers of the multiplex network, the
bipartite interactions and the second network type of interactions.
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)
multiObject_2 <- create.multiplex(list(h1=h1))
bipartite_relations <- data.frame(m=c(1,3),h=c("A","E"))
multiHetObject <-
create.multiplexHet(multiObject_1, multiObject_2,bipartite_relations)
#> checking input arguments...
#> Generating bipartite matrix...
#> Expanding bipartite matrix to fit the multiplex network...
MultiHetTranMatrix <- 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
Multiplex1_Seeds <- c(1)
Multiplex2_Seeds <- c("E")
RWR_MultiHetResults <-
Random.Walk.Restart.MultiplexHet(MultiHetTranMatrix, multiHetObject,
Multiplex1_Seeds,Multiplex2_Seeds)
create.multiplexHetNetwork.topResults(RWR_MultiHetResults,multiHetObject,
bipartite_relations)
#> IGRAPH f8e47bf UNW- 9 13 --
#> + attr: name (v/c), comp (v/n), weight (e/n), type (e/c)
#> + edges from f8e47bf (vertex names):
#> [1] 1--2 1--3 2--3 1--3 1--4 2--3 3--4 A--C C--E B--E E--D 1--A 3--E