CographLayout: CographLayout R6 Class

CographLayoutR Documentation

CographLayout R6 Class

Description

Class for managing layout algorithms and computing node positions.

Value

A CographLayout R6 object.

Methods

Public methods


Method new()

Create a new CographLayout object.

Usage
CographLayout$new(type = "circle", ...)
Arguments
type

Layout name. One of the names returned by list_layouts(), or "custom" together with a coords argument.

...

Additional parameters stored and passed to the layout function.

Returns

A new CographLayout object.


Method compute()

Compute layout coordinates for a network.

Usage
CographLayout$compute(network, ...)
Arguments
network

A CographNetwork or cograph_network object.

...

Additional parameters passed to the layout function. They override parameters given to ⁠$new()⁠.

Returns

A data frame with columns x and y, one row per node, rescaled by ⁠$normalize_coords()⁠.


Method normalize_coords()

Rescale coordinates into the unit square. Both axes are scaled by the same factor, so the larger spread spans ⁠[padding, 1 - padding]⁠ and the layout is centered at 0.5.

Usage
CographLayout$normalize_coords(coords, padding = 0.1)
Arguments
coords

Matrix or data frame. Columns x and y are used, or the first two columns when these names are absent.

padding

Numeric. Margin left on each side of the larger spread.

Returns

A data frame with rescaled x and y columns.


Method get_type()

Get layout type.

Usage
CographLayout$get_type()
Returns

A character string.


Method get_params()

Get layout parameters.

Usage
CographLayout$get_params()
Returns

A list of the parameters given to ⁠$new()⁠.


Method print()

Print layout summary.

Usage
CographLayout$print()
Returns

The object itself, invisibly.


Method clone()

The objects of this class are cloneable with this method.

Usage
CographLayout$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

layout <- CographLayout$new("circle")
layout$compute(CographNetwork$new(regulation_net))

cograph documentation built on Nov. 19, 2026, 5:07 p.m.