Learn R Programming

cograph (version 1.5.2)

CographLayout: CographLayout R6 Class

Description

Class for managing layout algorithms and computing node positions.

Arguments

Methods


Method new()

Create a new CographLayout object.

Usage

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

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.

Usage

CographLayout$get_type()

Returns

Character string.


Method get_params()

Get layout parameters.

Usage

CographLayout$get_params()

Returns

List of parameters.


Method print()

Print layout summary.

Usage

CographLayout$print()


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

Run this code
# 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)

Run the code above in your browser using DataLab