createNodeProgram
createNodeProgram<
N,E,G>(options):NodeProgramType<N,E,G>
Defined in: packages/sigma/src/rendering/nodes/factory.ts:68
Creates a node program from SDF shape(s) and fragment layers.
The resulting program renders nodes as quads with the specified shape(s) and layers.
It also includes a static LabelProgram property for rendering shape-aware labels.
Supports two modes:
- Single shape: Use
shapefor a program that renders one shape type - Multi-shape: Use
shapesfor a program that can render different shapes per node
Type Parameters
N
N extends Attributes = Attributes
E
E extends Attributes = Attributes
G
G extends Attributes = Attributes
Parameters
options
Configuration for the node program
Returns
NodeProgramType<N, E, G>
A NodeProgram class that can be used with Sigma
Examples
// Single shape (backward compatible)import { createNodeProgram, sdfCircle, layerFill } from "sigma/rendering";
const CircleProgram = createNodeProgram({ shape: sdfCircle(), layers: [layerFill()],});// Multi-shape programconst MultiShapeProgram = createNodeProgram({ shapes: [sdfCircle(), sdfSquare(), sdfTriangle(), sdfDiamond()], layers: [layerFill(), layerBorder({ ... })],});
// Nodes select their shape via the 'shape' attributegraph.setNodeAttribute(node, 'shape', 'square');