Learn R Programming

caugi (version 1.0.0)

caugi_layout_kamada_kawai: Kamada-Kawai Stress Minimization Layout

Description

Computes node coordinates using the Kamada-Kawai stress minimization algorithm. High-quality force-directed layout that minimizes "stress" by making Euclidean distances proportional to graph-theoretic distances. Better preserves global structure and path lengths compared to Fruchterman-Reingold. Ideal for publication-quality visualizations. Works with all edge types and produces deterministic results.

Usage

caugi_layout_kamada_kawai(x, packing_ratio = 1.618034, ...)

Value

A data.frame with columns name, x, and y containing node names and their coordinates.

Arguments

x

A caugi object.

packing_ratio

Aspect ratio for packing disconnected components (width/height). Default is the golden ratio (1.618) which works well with widescreen displays. Use 1.0 for square grid, 2.0 for wider layouts, 0.5 for taller layouts, Inf for single row, or 0.0 for single column.

...

Ignored. For future extensibility.

See Also

Other plotting: add-caugi_plot-caugi_plot, caugi_layout(), caugi_layout_bipartite(), caugi_layout_fruchterman_reingold(), caugi_layout_sugiyama(), caugi_layout_tiered(), caugi_plot(), divide-caugi_plot-caugi_plot, plot()

Examples

Run this code
cg <- caugi(
  A %-->% B,
  B %<->% C,
  C %-->% D
)
layout <- caugi_layout_kamada_kawai(cg)

Run the code above in your browser using DataLab