cgv_set_graph: Set Graph Data for Rendering

View source: R/graph_render.R

cgv_set_graphR Documentation

Set Graph Data for Rendering

Description

Provide the full graph (or a subgraph) as adjacency data with optional node colors, sizes, and colormap.

Usage

cgv_set_graph(
  viewer,
  nodes,
  edges,
  positions = NULL,
  node_values = NULL,
  node_colors = NULL,
  node_sizes = NULL,
  cmap = 6L
)

Arguments

viewer

External pointer returned by cgv_viewer.

nodes

Integer vector of node IDs.

edges

Two-column integer matrix (from, to), 1-based.

positions

Nx3 numeric matrix of 3D coordinates (optional; linear if NULL).

node_values

Numeric vector of length N for automatic coloring via colormap (e.g. BFS depth, group id). Ignored if node_colors is provided.

node_colors

Nx4 integer matrix (RGBA 0-255) for explicit node colors. Takes priority over node_values.

node_sizes

Numeric vector of length N for point sizes (default 10).

cmap

Integer colormap id (default 6 = viridis). Common values: 5 = plasma, 6 = viridis, 7 = inferno, 8 = magma.

Value

No return value, called for side effects: uploads the node and edge buffers to the GPU and caches node positions on the viewer for subsequent cgv_fly_to / picking calls. Returns NULL invisibly.


cgvR documentation built on May 12, 2026, 1:06 a.m.