register_layout: Register a Custom Layout

View source: R/aaa-globals.R

register_layoutR Documentation

Register a Custom Layout

Description

Register a new layout algorithm that can be used for network visualization.

Usage

register_layout(name, layout_fn)

Arguments

name

Character. Name of the layout.

layout_fn

Function. A function that computes node positions. Should accept a CographNetwork object and return a matrix with x, y columns.

Value

Invisible NULL.

Examples

# Register a simple random layout
register_layout("random", function(network, ...) {
  n <- network$n_nodes
  cbind(x = runif(n), y = runif(n))
})

cograph documentation built on April 1, 2026, 1:07 a.m.