View source: R/cluster-metrics.R
| aggregate_layers | R Documentation |
Combines multiple network layers into a single network.
aggregate_layers(
layers,
method = c("sum", "mean", "max", "min", "union", "intersection"),
weights = NULL
)
lagg(
layers,
method = c("sum", "mean", "max", "min", "union", "intersection"),
weights = NULL
)
layers |
List of adjacency matrices |
method |
Aggregation: "sum", "mean", "max", "min", "union", "intersection" |
weights |
Optional layer weights (for weighted sum) |
Aggregated adjacency matrix
nodes <- c("A", "B", "C")
l1 <- matrix(c(0, 1, 0, 1, 0, 1, 0, 1, 0), 3, 3, dimnames = list(nodes, nodes))
l2 <- matrix(c(0, 1, 1, 1, 0, 0, 1, 0, 0), 3, 3, dimnames = list(nodes, nodes))
layers <- list(L1 = l1, L2 = l2)
aggregate_layers(layers, "sum") # total edge weight
aggregate_layers(layers, "mean") # average edge weight
aggregate_layers(layers, "union") # edge present in any layer
aggregate_layers(layers, "intersection") # edge present in every layer
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.