Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Transformation

Functions to transform existing layers into new ones.


Description

These functions merge multiple layers into one. The new layer is added to the network. If the input layers are no longer necessary, they must be explicitely erased.

flatten_ml adds a new layer with the actors in the input layers and an edge between A and B if they are connected in any of the merged layers.

project_ml adds a new layer with the actors in the first input layer and an edge between A and B if they are connected to the same actor in the second layer.

Usage

flatten_ml(n, new.layer = "flattening", layers = character(0),
  method = "weighted", force.directed = FALSE, all.actors = FALSE)
project_ml(n, new.layer = "projection", layer1, layer2,
method = "clique")

Arguments

n

A multilayer network.

new.layer

Name of the new layer.

layers

An array of layers belonging to the network.

layer1

Name of a layer belonging to the network.

layer2

Name of a layer belonging to the network.

method

This argument can take values "weighted" or "or" for flatten_ml and "clique" for project_ml. "weighted" adds an attribute to the new edges with the number of layers where the two actors are connected.

force.directed

The new layer is set as directed. If this is false, the new layer is set as directed if at least one of the merged layers is directed.

all.actors

If TRUE, then all the actors are included in the new layer, even if they are not present in any of the merged layers.

References

Dickison, Magnani, and Rossi, 2016. Multilayer Social Networks. Cambridge University Press. ISBN: 978-1107438750

See Also

Examples

net <- ml_aucs()
# A new layer is added to the network, with a flattening of all the other layers
flatten_ml(net, layers = layers_ml(net))
# Bipartite network
from_actor=c("A","B")
to_actor=c("1","1")
from_layer=c("l1","l1")
to_layer=c("l2","l2")
edges = data.frame(from_actor, from_layer, to_actor, to_layer)
n = ml_empty()
add_edges_ml(n, edges)
project_ml(n, layer1 = "l1", layer2="l2")

multinet

Analysis and Mining of Multilayer Social Networks

v3.3.2
GPL
Authors
Matteo Magnani, Luca Rossi (API design), Obaida Hanteer (mdlpa, flat_ec, flat_nw, some community eval. functions), Davide Vega (API and code design), Mikael Dubik (glouvain). The package uses functions from eclat (www.borgelt.net/eclat.html), for association rule mining, Eigen (eigen.tuxfamily.org) and spectra (https://spectralib.org), for matrix manipulation, Infomap (www.mapequation.org), for the Infomap community detection method, and Howard Hinnant's date and time library (https://github.com/HowardHinnant/date). The code from these libraries has been included in our source package.
Initial release
2021-01-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.