Skip to contents

A simple layout generator, that places one vertex in the center of a circle and the rest of the vertices equidistantly on the perimeter.

Usage

layout_as_star(graph, center = V(graph)[1], order = NULL)

as_star(...)

Arguments

graph

The graph to layout.

center

The id of the vertex to put in the center. By default it is the first vertex.

order

Numeric vector, the order of the vertices along the perimeter. The default ordering is given by the vertex ids.

...

Arguments to pass to layout_as_star().

Value

A matrix with two columns and as many rows as the number of vertices in the input graph.

Details

It is possible to choose the vertex that will be in the center, and the order of the vertices can be also given.

Author

Gabor Csardi csardi.gabor@gmail.com

Examples


g <- make_star(10)
layout_as_star(g)
#>             [,1]       [,2]
#>  [1,]  0.0000000  0.0000000
#>  [2,]  1.0000000  0.0000000
#>  [3,]  0.7660444  0.6427876
#>  [4,]  0.1736482  0.9848078
#>  [5,] -0.5000000  0.8660254
#>  [6,] -0.9396926  0.3420201
#>  [7,] -0.9396926 -0.3420201
#>  [8,] -0.5000000 -0.8660254
#>  [9,]  0.1736482 -0.9848078
#> [10,]  0.7660444 -0.6427876

## Alternative form
layout_(g, as_star())
#>             [,1]       [,2]
#>  [1,]  0.0000000  0.0000000
#>  [2,]  1.0000000  0.0000000
#>  [3,]  0.7660444  0.6427876
#>  [4,]  0.1736482  0.9848078
#>  [5,] -0.5000000  0.8660254
#>  [6,] -0.9396926  0.3420201
#>  [7,] -0.9396926 -0.3420201
#>  [8,] -0.5000000 -0.8660254
#>  [9,]  0.1736482 -0.9848078
#> [10,]  0.7660444 -0.6427876