attach_layout {metanetwork} | R Documentation |
compute and attach metanetwork layouts
Description
Method to compute 'TL-tsne'
and 'group-TL-tsne'
layouts and save it as node attributes of the focal network.
Usage
attach_layout(
metanetwork,
g = NULL,
beta = 0.1,
mode = "TL-tsne",
TL_tsne.config = TL_tsne.default,
res = NULL,
group_layout.config = group_layout.default
)
## S3 method for class 'metanetwork'
attach_layout(
metanetwork,
g = NULL,
beta = 0.1,
mode = "TL-tsne",
TL_tsne.config = TL_tsne.default,
res = NULL,
group_layout.config = group_layout.default
)
Arguments
metanetwork |
object of class 'metanetwork' |
g |
character indicating the name of the network for which the 'TL-tsne' layout is computed, default is 'metaweb' |
beta |
the diffusion parameter of the diffusion kernel, a positive scalar controlling the squeezing of the network, default is 0.1 |
mode |
'TL-tsne' or 'group-TL-tsne', default is 'TL-tsne'. |
TL_tsne.config |
configuration list for mode 'TL-tsne', default is TL_tsne.default |
res |
resolution for the 'group-TL-tsne' layout |
group_layout.config |
configuration list for mode 'group-TL-tsne', default is group_layout.default |
Details
The 'TL-tsne'
layout is a diffusion based layout algorithm specifically designed for trophic networks.
In metanetwork, first axis is the trophic level (see compute_TL
method) whereas the second axis is computed using a diffusion graph kernel (Kondor & Lafferty 2002)
and tsne dimension reduction algorithm to (see van der Maaten & Hinton (2008) and 'tsne' R package).
Let A
be the adjacency matrix of the considered network and D
its degree diagonal matrix.
The Laplacian matrix of the symmetrised network is defined by:
L = D - A - t(A)
The diffusion graph kernel is:
K = exp(-beta*L)
It is a similarity matrix between nodes according to a diffusion process. beta
is the diffusion constant,it must be provided by the user.
beta
parameter influences the layout by grouping together similar paths (see pyramid
vignette).
Each node of the focal network has an attribute layout_beta_VALUE
.
If this function is run several times for a given beta value, repetitions of the layout algorithm will be stored as node attributes.
The 'group-TL-tsne'
layout is a variation of 'TL-tsne
layout. For a focal network, it mixes 'TL-tsne'
layout at the desired aggregated level
with the layout_with_graphopt
function from igraph
. It clusters nodes belonging to the same group.
'group-TL-tsne'
layout is recommended for large networks since you only need to compute 'TL-tsne'
at the aggregated network
that is much smaller than the focal network. group_layout.config
allows controlling the overall size of the groups.
Value
an object of class 'metanetwork', with the computed layout added as node attribute of the considered network
NULL
References
Kondor, R. I., & Lafferty, J. (2002, July). Diffusion kernels on graphs and other discrete structures. In Proceedings of the 19th international conference on machine learning (Vol. 2002, pp. 315-322). Van der Maaten, L., & Hinton, G. (2008). Visualizing data using t-SNE. Journal of machine learning research, 9(11).
See Also
ggmetanet()
, vismetaNetwork()
,group_layout.default
Examples
library(metanetwork)
library(igraph)
# on angola dataset (metaweb)
data("meta_angola")
meta_angola = attach_layout(meta_angola,beta = 0.05)
V(meta_angola$metaweb)$layout_beta0.05