arrange nodes in concentric circles around a focal node according to their distance from the focus.
layout_with_focus(g, v, weights = NA, iter = 500, tol = 1e-04)
layout_igraph_focus(g, v, weights = NA, iter = 500, tol = 1e-04, circular)
igraph object
id of focal node to be placed in the center
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.
number of iterations during stress optimization
stopping criterion for stress optimization
not used
a list containing xy coordinates and the distances to the focal node
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).
Brandes, U., & Pich, C. (2011). More flexible radial layout. Journal of Graph Algorithms and Applications, 15(1), 157-173.
layout_focus_group The layout_igraph_* function should not be used directly. It is only used as an argument for plotting with 'igraph'. 'ggraph' natively supports the layout.
library(igraph)
g <- sample_gnp(10,0.4)
coords <- layout_with_focus(g,v = 1)
coords
#> $xy
#> [,1] [,2]
#> [1,] 0.00000000 0.0000000
#> [2,] -0.67991207 0.7332936
#> [3,] -1.19344372 1.6048963
#> [4,] -1.95898048 0.4029832
#> [5,] -2.85178473 0.9313022
#> [6,] 0.01135715 0.9999355
#> [7,] -1.90977755 -0.5939274
#> [8,] -0.90165116 -0.4324641
#> [9,] -1.68150886 1.0828333
#> [10,] -0.97729181 0.2118979
#>
#> $distance
#> [1] 0 1 2 2 3 1 2 1 2 1
#>