Weighted GRIP layout in arbitrary dimensions
Source:R/grip_layout_weighted_nd.R
weighted.grip.nd.Rdweighted.grip.nd() is an opt-in weighted GRIP layout backend
for embeddings in dimensions dim >= 2. It is implemented beside the
legacy 2D/3D GRIP code path so that existing weighted-GRIP entry points and
their dimensionality checks are unchanged.
Usage
weighted.grip.nd(
edges = NULL,
n = NULL,
adj_list = NULL,
weight_list = NULL,
edge_weights = NULL,
dim = 3,
preset = NULL,
placement = c("barycenter", "circle"),
rounds = 160,
final_rounds = 256,
num_init = NULL,
num_nbrs = 24,
r = 0.03,
s = 6,
repulsion_factor = 1.5,
tinit_factor = 2,
final_move_scale_after_first = 1,
final_mode = c("fr", "kk_repulse"),
metric_neighbor_cap = NULL,
insertion_anchor_count = 3,
insertion_anchor_scope = c("any_higher", "prev_misf"),
insertion_anchor_strategy = c("first", "distance_band", "balanced_band", "spread_prev"),
level0_insertion_mode = c("inherit", "barycenter", "least_squares"),
level0_anchor_count = insertion_anchor_count,
level0_local_kk_steps = 3,
length_normalization = c("median", "mean", "none"),
disconnected = c("components", "error"),
seed = 6
)Arguments
- edges
Two-column integer matrix of edges (1-based vertex ids).
- n
Number of vertices.
- adj_list
Adjacency list (1-based) for an undirected graph.
- weight_list
Parallel list of strictly positive edge lengths.
- edge_weights
Optional vector of edge lengths for
edges.- dim
Embedding dimension. Must be at least 2.
- preset
Optional weighted layout preset:
"carpet","mesh","cylinder","torus","sphere","irregular", or"tree".- placement
Initial insertion placement strategy.
"circle"is only available fordim = 2; higher dimensions use"barycenter".- rounds
Number of weighted refinement rounds before the final phase.
- final_rounds
Number of final weighted refinement rounds.
- num_init
Coarsest-level size control. Defaults to at least
dim + 1.- num_nbrs
Local-neighborhood control used by the ND backend.
- r
Movement-rate parameter in
[0, 1].- s
Repulsion scale parameter.
- repulsion_factor
Non-edge repulsion multiplier.
- tinit_factor
Initial spread multiplier.
- final_move_scale_after_first
Final-stage FR displacement multiplier applied after the first final round. Must be in
[0, 1].- final_mode
Final refinement mode:
"fr"or"kk_repulse".- metric_neighbor_cap
Optional cap on the number of settled Dijkstra vertices used when building weighted neighborhood caches for inserted vertices.
NULLkeeps the exact weighted neighborhood search.- insertion_anchor_count
Number of already placed anchor vertices used when inserting non-final MISF levels.
- insertion_anchor_scope
Anchor eligibility rule:
"any_higher"or"prev_misf".- insertion_anchor_strategy
Anchor selection rule:
"first","distance_band","balanced_band", or"spread_prev".- level0_insertion_mode
Level-0 insertion placement override:
"inherit","barycenter", or"least_squares".- level0_anchor_count
Number of anchors used during level-0 insertion.
- level0_local_kk_steps
Number of local weighted-KK polish steps used immediately after level-0 insertion.
- length_normalization
Global edge-length normalization:
"median"(default),"mean", or"none".- disconnected
How to handle disconnected graphs:
"components"lays out each component separately and packs them;"error"rejects disconnected graphs.- seed
Optional RNG seed for reproducibility. If NULL, uses current time.