| cgv_set_graph | R Documentation |
Provide the full graph (or a subgraph) as adjacency data with optional node colors, sizes, and colormap.
cgv_set_graph(
viewer,
nodes,
edges,
positions = NULL,
node_values = NULL,
node_colors = NULL,
node_sizes = NULL,
cmap = 6L
)
viewer |
External pointer returned by |
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 |
Nx4 integer matrix (RGBA 0-255) for explicit node colors.
Takes priority over |
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. |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.