API Overview
This section is the reference for the @kortexya/nodus package: the top-level
exports, the Nodus instance, and every module hanging off an instance. For
task-oriented walkthroughs see the guides; this
section documents signatures.
Package exports
Section titled “Package exports”@kortexya/nodus is ESM-first and also ships a <script> global build that
exposes Nodus. The default export is also Nodus.
import { Nodus } from '@kortexya/nodus';// or: import Nodus from '@kortexya/nodus';Classes and helpers
Section titled “Classes and helpers”| Export | What it is |
|---|---|
Nodus (and default) |
The main class. See The Nodus class. |
isWebGpuSupported() |
Returns whether the current browser exposes WebGPU. |
Node, Edge |
Element wrappers returned by graph queries. See Graph. |
NodeList, EdgeList |
Array-like collections of elements. See Graph. |
Transformation |
A graph transformation. See Utilities. |
BoundingBox |
An axis-aligned bounds value used across the view API. |
StyleRule, StyleClass |
Style primitives. See Styles & rules. |
NonObjectPropertyWatcher, ObjectPropertyWatcher |
Reactive property watchers. See Utilities. |
WasmGraphRenderer, WasmRendererAdapter |
The WebAssembly renderer and its adapter. |
Namespaces
Section titled “Namespaces”| Namespace | What it is |
|---|---|
geometry |
Pure geometry utilities. See Utilities. |
parse |
Graph-format parsers that return the RawGraph JSON shape. See Utilities. |
hypergraph |
Hypergraph types and utilities. See Hypergraph. |
import { geometry, parse, hypergraph } from '@kortexya/nodus';Layout factories
Section titled “Layout factories”The everyday layout API is nodus.layouts.*. For advanced use
(registering or configuring a layout) the factory functions are exported:
forceFactory, forceLinkFactory, gridFactory, hierarchicalFactory,
radialFactory, concentricFactory, sequentialFactory.
Backend activation
Section titled “Backend activation”These functions move compute work to the compiled Rust backend. See Utilities for details.
enableWasmBackend()useWasm(subsystem)wheresubsystemis'layout' | 'geometry' | 'all'configureBackends(...)
The types Subsystem and Backend are also exported.
Instance modules
Section titled “Instance modules”Once you have an instance, the API is organized into modules hanging off it. Each links to its reference page.
| Module | Purpose |
|---|---|
nodus.styles |
Style rules, classes, themes and state styling. |
nodus.algorithms |
Graph algorithms (paths, cycles, MST, traversals). |
nodus.layouts |
Layout runners. |
nodus.view |
Camera, coordinates, fit, size and snapshots. |
nodus.events |
Lifecycle and key events. |
nodus.tools |
Interaction tools (lasso, connect, tooltip, …). |
nodus.generate |
Deterministic graph generators. |
nodus.transformations |
Graph transformations. |
nodus.hypergraph |
Hypergraph pipeline and rendering. |
nodus.geo |
Geometry helpers on the instance. |
nodus.layers |
Render-layer management. |
nodus.schema |
Reactive property watchers. |
nodus.keyboard |
Keyboard input module. |
nodus.mouse |
Mouse input module. |
nodus.rules |
Conditional styling rules (works with nodus.styles). |
nodus.export |
Export the graph or an image. |
nodus.debug |
Debug helpers (see isDebug()). |
Graph and selection methods are mixed directly onto the instance — see Graph: nodes & edges.
Constructor and lifecycle
Section titled “Constructor and lifecycle”new Nodus<ND, ED>(params?)ND and ED are the types of your per-node and per-edge data payloads. The
WebAssembly core auto-initializes on import (top-level await), so there is no
init function and no Nodus.create() — construction is synchronous. See
The Nodus class for the constructor parameters.
Lifecycle methods on the instance:
onReady(cb)— run a callback once the instance is ready.reset()— reset the instance.destroy()— tear the instance down and free resources.isDestroyed()— whetherdestroy()has been called.isDebug()— whether debug mode is on.
nodus.build carries build metadata: { version, commit, buildTime }.
import { Nodus } from '@kortexya/nodus';
const nodus = new Nodus({ container: document.getElementById('graph') });console.log(nodus.build.version);
nodus.onReady(() => { // safe to drive the instance});