Layout functions add x
and y
vertex attributes to the graph object.
The object is modified in place, and its shallow copy is returned.
Arguments
- graph
An
igraph_ptr
object.- mode
An integer value of edge type to count; {1: OUT, 2: IN, 3: ALL}.
- roots
An integer vector of vertex IDs, the roots of the tree.
Value
An igraph_ptr
object with vertex attributes x
and y
.
See also
Other layouts:
layout_nicely()
,
layout_random()
Examples
g = graph_tree(5L)
layout_reingold_tilford(g) |> Vattr()
#> # A tibble: 5 × 2
#> x y
#> <dbl> <dbl>
#> 1 0 0
#> 2 -0.5 1
#> 3 0.5 1
#> 4 -1 2
#> 5 0 2
layout_reingold_tilford_circular(g) |> Vattr()
#> # A tibble: 5 × 2
#> x y
#> <dbl> <dbl>
#> 1 0 0
#> 2 -0.105 0.995
#> 3 0.309 -0.951
#> 4 2 0
#> 5 -1.96 -0.416