20,000 nodes.
One component.
Rust WASM core, WebGL2 rendering, Web Worker physics, one React component. Every canvas on this page is live.
Built like a renderer, shipped like a package
A Rust core compiled to WASM
Graph model, spatial index, and force simulation run as compiled code, not JavaScript. Two WASM modules ship in the package: the render engine on the main thread and the layout engine inside a Web Worker.
graph-coremodel, filtering, algorithmsgraph-layoutBarnes-Hut force, hierarchical, gridgraph-renderWebGL2 buffers and passesgraph-main-wasm+graph-worker-wasmthe two shipped modules
Eight node shapes, two edge arrows, four dash styles
Every shape is drawn in the shader with antialiased borders and per-type styling.
Layout off the main thread
A Barnes-Hut quadtree approximates repulsion in O(n log n), so the simulation keeps converging while your UI thread stays free. Positions stream back as transferable buffers.
One React component to adopt it
<GraphScene themeMode="dark" snapshot={data} />GraphScene wires the canvas, worker, labels, and theme in one drop-in. Prefer composing? Every overlay is exported separately.
A typed theme system
These swatches are imported from the package at build time. Light and dark bases ship built in; overrides are plain objects.
Five datasets, one engine
The scenarios below are procedurally generated and deliberately generic. Switching restyles the same engine through plain theme overrides: shapes, colors, and edge styles per node or edge type.
Stress test it yourself
The graph is generated in your browser the moment you pick a size, then handed to the layout worker. Numbers below are measured live on your machine, not quoted.
Two base themes, override anything
The specimen graph shows every built-in node type. Both base themes ship in the package; overrides are plain typed objects merged per node or edge type. The code on the right is exactly what drives the canvas on the left.
<GraphScene themeMode="dark" snapshot={specimen} />Overrides merge into the base theme per node or edge type, and the merged result is referentially stable, so React consumers rerender only when something actually changed. Apps that need the resolved colors for a legend can call buildGraphTheme and mergeGraphTheme themselves.
The whole API fits on one screen
Install from GitHub Packages, drop the scene into a sized box, and reach for the imperative handle when you need camera or layout control.
# .npmrc: the package is published to GitHub Packages
@invariantcontinuum:registry=https://npm.pkg.github.com
npm install @invariantcontinuum/graphimport { GraphScene } from "@invariantcontinuum/graph/react";
export function MyGraph({ data }) {
return (
<div style={{ height: 480 }}>
<GraphScene
themeMode="dark"
snapshot={data}
layout="force"
onNodeClick={(node) => console.log(node?.name)}
/>
</div>
);
}const graph = useRef<GraphHandle>(null);
graph.current?.relayout("hierarchical");
graph.current?.focusFit(nodeId, 72);
graph.current?.selectNode(nodeId);
// 60fps position stream for custom overlays
const stop = graph.current?.subscribeFrame(({ positions, vpMatrix }) => {
drawMyOverlay(positions, vpMatrix);
});Components
GraphScene is the batteries-included composite. Graph is the bare engine canvas, and GridOverlay, LabelOverlay, EdgeLabelsOverlay, and CompoundFramesOverlay are exported separately for custom composition.
Theme utilities
buildGraphTheme(mode) returns a full typed theme, mergeGraphTheme(base, overrides) layers your changes, and LIGHT, DARK, and TYPE_STYLES expose the raw tokens for legends and side panels.
Data in, events out
Feed a GraphSnapshot of typed nodes and edges, or point snapshotUrl and wsUrl at a server. Events cover clicks, hover, background clicks, legend changes, and live stats.