Class for managing layout algorithms and computing node positions.
Value
A CographLayout R6 object.
Methods
Method new()
Create a new CographLayout object.
Arguments
type
Layout type (e.g., "circle", "spring", "groups").
...
Additional parameters for the layout algorithm.
Returns
A new CographLayout object.
Method compute()
Compute layout coordinates for a network.
Usage
CographLayout$compute(network, ...)
Arguments
network
A CographNetwork object.
...
Additional parameters passed to the layout function.
Returns
Data frame with x, y coordinates.
Method normalize_coords()
Normalize coordinates to 0-1 range with padding.
Usage
CographLayout$normalize_coords(coords, padding = 0.1)
Arguments
coords
Matrix or data frame with x, y columns.
padding
Numeric. Padding around edges (default 0.1).
Returns
Normalized coordinates.
Method get_type()
Get layout type.
Returns
Character string.
Method get_params()
Get layout parameters.
Usage
CographLayout$get_params()
Returns
List of parameters.
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
# Create a circular layout
layout <- CographLayout$new("circle")
# Apply to network
adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), nrow = 3)
net <- CographNetwork$new(adj)
coords <- layout$compute(net)