R/CreateMultiHetObjects.R
create.multiplexHet.Rdcreate.multiplexHet is a function to create a multiplex
and heterogeneous network (MultiplexHet object). It combines a
multiplex network composed from 1 (monoplex case) up to 6 layers with another
single network whose nodes are of different nature. See more details below.
create.multiplexHet(...)
# Default S3 method
create.multiplexHet(
Multiplex_object_1,
Multiplex_object_2,
Nodes_relations,
...
)Further arguments passed to create.multiplexHet
First Multiplex network (Multiplex object)
generated by the function create.multiplex. This multiplex network
will be integrated as the first network of the heterogeneous network.
Second Multiplex network (Multiplex object)
generated by the function create.multiplex. This multiplex network
will be integrated as the first network of the 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 Multiplex Heterogeneous object. It contains a list of the different graphs integrating the multiplex network, the names and number of its nodes and the number of layers. In addition, it contains the graph of the second network integrating the heterogeneous network along with its number of nodes Finally, it contains a expanded bipartite adjacency matrix describing the relations of the nodes in every layer of the multiplex network with the nodes of the second network.
A multiplex network is a collection of layers (monoplex networks) sharing the same nodes, but in which the edges represent relationships of different nature. A heterogeneous network is composed of two single networks where the nodes are of different nature. These nodes of different nature are linked through bipartite 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)
bipartite_relations <- data.frame(m=c(1,3),h=c("A","E"))
multiObject_2 <- create.multiplex(list(h1=h1))
create.multiplexHet(multiObject_1, multiObject_2,bipartite_relations)
#> checking input arguments...
#> Generating bipartite matrix...
#> Expanding bipartite matrix to fit the multiplex network...
#> Number of Layers Multiplex 1:
#> [1] 2
#>
#> Number of Nodes Multiplex 1:
#> [1] 4
#>
#> IGRAPH f9c9ea4 UNW- 4 3 --
#> + attr: name (v/n), weight (e/n), type (e/c)
#> + edges from f9c9ea4 (vertex names):
#> [1] 1--2 1--3 2--3
#>
#> IGRAPH 2e51ee4 UNW- 4 4 --
#> + attr: name (v/n), weight (e/n), type (e/c)
#> + edges from 2e51ee4 (vertex names):
#> [1] 1--3 1--4 2--3 3--4
#>
#> Number of Layers Multiplex 2:
#> [1] 1
#>
#> Number of Nodes Multiplex 2:
#> [1] 5
#>
#> IGRAPH 37300f3 UNW- 5 4 --
#> + attr: name (v/c), weight (e/n), type (e/c)
#> + edges from 37300f3 (vertex names):
#> [1] A--C C--E B--E E--D