Skip to contents

Create layouts for longitudinal networks.

Usage

layout_as_dynamic(gList, weights = NA, alpha = 0.5, iter = 500, tol = 1e-04)

Arguments

gList

list of igraph objects. Each network must contain the same set of nodes.

weights

possibly a numeric vector with edge weights. If this is NULL and the graph has a weight edge attribute, then the attribute is used. If this is NA then no weights are used (even if the graph has a weight attribute). By default, weights are ignored. See details for more.

alpha

weighting of reference layout. See details.

iter

number of iterations during stress optimization

tol

stopping criterion for stress optimization

Value

list of coordinates for each graph

Details

The reference layout is calculated based on the union of all graphs. The parameter alpha controls the influence of the reference layout. For alpha=1, only the reference layout is used and all graphs have the same layout. For alpha=0, the stress layout of each individual graph is used. Values in-between interpolate between the two layouts.

Be careful when using weights. In most cases, the inverse of the edge weights should be used to ensure that the endpoints of an edges with higher weights are closer together (weights=1/E(g)$weight).

References

Brandes, U. and Indlekofer, N. and Mader, M. (2012). Visualization methods for longitudinal social networks and stochastic actor-oriented modeling. Social Networks 34 (3) 291-308

Examples

library(igraph)
g1 <- sample_gnp(20, 0.2)
g2 <- sample_gnp(20, 0.2)
g3 <- sample_gnp(20, 0.2)

xy <- layout_as_dynamic(list(g1, g2, g3))

# layout for first network
xy[[1]]
#>              [,1]         [,2]
#>  [1,] -0.99925961 -1.045505972
#>  [2,]  0.04434166 -0.085501597
#>  [3,]  0.50589703  1.762391108
#>  [4,] -0.11031676 -0.071354525
#>  [5,] -0.69628480 -0.653660420
#>  [6,] -0.46412468  1.154685464
#>  [7,]  0.71168739  1.285419367
#>  [8,]  0.72910424 -0.353030914
#>  [9,]  1.50092683  0.779891910
#> [10,] -1.14110176  0.879401430
#> [11,]  0.17701790 -1.481548923
#> [12,]  1.48873344 -0.366018172
#> [13,] -0.32109596 -1.663064961
#> [14,] -1.82462521  0.293307564
#> [15,] -0.35175650 -0.374144459
#> [16,] -0.03019450  0.978198514
#> [17,]  0.69415785 -1.430846069
#> [18,]  0.50497044 -0.001843499
#> [19,]  0.41254403  0.528727884
#> [20,] -0.46945577 -0.303720619