Skip to content

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

@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

ExportWhat it is
Nodus (and default)The main class. See The Nodus class.
isWebGpuSupported()Returns whether the current browser exposes WebGPU.
Node, EdgeElement wrappers returned by graph queries. See Graph.
NodeList, EdgeListArray-like collections of elements. See Graph.
TransformationA graph transformation. See Utilities.
BoundingBoxAn axis-aligned bounds value used across the view API.
StyleRule, StyleClassStyle primitives. See Styles & rules.
NonObjectPropertyWatcher, ObjectPropertyWatcherReactive property watchers. See Utilities.
WasmGraphRenderer, WasmRendererAdapterThe WebAssembly renderer and its adapter.

Namespaces

NamespaceWhat it is
geometryPure geometry utilities. See Utilities.
parseGraph-format parsers that return the RawGraph JSON shape. See Utilities.
hypergraphHypergraph types and utilities. See Hypergraph.
import { geometry, parse, hypergraph } from '@kortexya/nodus';

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

These functions move compute work to the compiled Rust backend. See Utilities for details.

  • enableWasmBackend()
  • useWasm(subsystem) where subsystem is 'layout' | 'geometry' | 'all'
  • configureBackends(...)

The types Subsystem and Backend are also exported.

Instance modules

Once you have an instance, the API is organized into modules hanging off it. Each links to its reference page.

ModulePurpose
nodus.stylesStyle rules, classes, themes and state styling.
nodus.algorithmsGraph algorithms (paths, cycles, MST, traversals).
nodus.layoutsLayout runners.
nodus.viewCamera, coordinates, fit, size and snapshots.
nodus.eventsLifecycle and key events.
nodus.toolsInteraction tools (lasso, connect, tooltip, …).
nodus.generateDeterministic graph generators.
nodus.transformationsGraph transformations.
nodus.hypergraphHypergraph pipeline and rendering.
nodus.geoGeometry helpers on the instance.
nodus.layersRender-layer management.
nodus.schemaReactive property watchers.
nodus.keyboardKeyboard input module.
nodus.mouseMouse input module.
nodus.rulesConditional styling rules (works with nodus.styles).
nodus.exportExport the graph or an image.
nodus.debugDebug helpers (see isDebug()).

Graph and selection methods are mixed directly onto the instance — see Graph: nodes & edges.

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() — whether destroy() 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
});