npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mik1810/nxpp-wasm

v1.0.0

Published

Experimental Node.js WASM bindings for nxpp

Readme

nxpp WASM package

@mik1810/nxpp-wasm exposes selected native nxpp graph operations through a TypeScript facade over WebAssembly. The package is experimental. This README describes the current repository revision; a published npm version may differ until the next package release.

Runtime support

  • Node.js 22, 24, and 26 are tested with an installed npm tarball in CI.
  • Browsers have a separate smoke-tested demo, not a supported package API.
  • Consumers use prebuilt JavaScript and WASM assets; Boost and Emscripten are needed only to build the package.

The package exports only its root entrypoint. runtime/, dist/, the raw Embind module, and the browser adapter are internal, not importable subpaths.

Install a published version with npm install @mik1810/nxpp-wasm. To validate the current repository revision before its next npm release, build and test a local tarball as described in the build guide.

Start with a graph

Initialize a context before constructing graphs. Each createNxpp() call creates an independent runtime context.

import { createNxpp } from "@mik1810/nxpp-wasm";

const nxpp = await createNxpp();
const graph = new nxpp.DiGraphInt();

try {
  graph.addEdge(1, 2, 1);
  graph.addEdge(2, 3, 2);
  graph.addEdge(1, 3, 5);

  console.log(graph.dijkstraPath(1, 3)); // [1, 2, 3]
  console.log(graph.dijkstraPathLength(1, 3)); // 3
} finally {
  graph.dispose();
}

The eight concrete constructors are GraphInt, GraphStr, DiGraphInt, DiGraphStr, MultiGraphInt, MultiGraphStr, MultiDiGraphInt, and MultiDiGraphStr. *Int node IDs are integer-valued JavaScript numbers; *Str node IDs are strings. Constructors are properties of the returned context, not global package exports.

Other common operations

Attributes, traversal, and components use ordinary JavaScript values:

import { createNxpp } from "@mik1810/nxpp-wasm";

const nxpp = await createNxpp();
const graph = new nxpp.GraphStr();
try {
  graph.addEdge("a", "b", 1);
  graph.addEdge("b", "c", 1);
  graph.setNodeAttr("a", "label", "start");

  console.log(graph.getNodeAttr("a", "label")); // "start"
  console.log(graph.bfsTree("a")); // { nodes: [...], edges: [...] }
  console.log(graph.connectedComponents()); // [["a", "b", "c"]]
} finally {
  graph.dispose();
}

For parallel edges, use an edge ID when changing one particular edge:

import { createNxpp } from "@mik1810/nxpp-wasm";

const nxpp = await createNxpp();
const graph = new nxpp.MultiDiGraphInt();
try {
  graph.addEdge(1, 2, 4);
  graph.addEdge(1, 2, 7);

  const [edgeId] = graph.edgeIdsBetween(1, 2);
  graph.setEdgeAttrById(edgeId, "capacity", 10);
  console.log(graph.getEdgeAttrById(edgeId, "capacity")); // 10
  console.log(graph.getEdgeEndpoints(edgeId).source()); // 1
} finally {
  graph.dispose();
}

Flow results are plain data; only graph handles need disposal:

import { createNxpp } from "@mik1810/nxpp-wasm";

const nxpp = await createNxpp();
const graph = new nxpp.DiGraphInt();
try {
  graph.addEdge(0, 1, 1);
  graph.setEdgeAttr(0, 1, "capacity", 3);
  const result = graph.maximumFlow(0, 1);
  console.log(result.value); // 3
  console.log(result.edgeFlows); // [{ source: 0, target: 1, flow: 3 }]
} finally {
  graph.dispose();
}

Attribute values are limited to strings, finite numbers, and booleans. tryGet... methods return null for missing or unsupported values. Weighted shortest-path wrappers currently use the built-in "weight" channel.

TypeScript and lifetime

Generic interfaces are for static typing; the runtime constructors stay explicit:

import { createNxpp, type DiGraph } from "@mik1810/nxpp-wasm";

const nxpp = await createNxpp();
const graph: DiGraph<number> = new nxpp.DiGraphInt();
try {
  graph.addEdge(1, 2, 3);
  console.log(graph.neighbors(1));
} finally {
  graph.dispose();
}

dispose() is idempotent. Operations after disposal throw a JavaScript error. In runtimes with Symbol.dispose, facade instances expose the same disposal path. Raw C++/WASM failures are normalized with a WASM graph operation failed: ... prefix.

API coverage

| Area | Current package surface | |---|---| | Graphs and attributes | Eight typed graph families, node/edge attributes, multigraph edge IDs | | Traversal and paths | BFS/DFS, single-pair and single-source shortest paths, Floyd-Warshall | | Other algorithms | Spanning trees, components, centrality, and flow | | Not exposed | Topological sort, generators, and SAT |

For exact method signatures and result types, consult the public declarations in the installed package or the TypeScript source. The API policy defines validation and support boundaries; the architecture explains layer ownership and the 1.0 criteria.

Migration from the former 0.6 singleton

The default singleton export, global graph constructors, loadNxppRuntime(), and the @mik1810/nxpp-wasm/runtime shim have been removed from this repository revision. Replace new nxpp.GraphInt() on a default import with asynchronous context creation:

import { createNxpp } from "@mik1810/nxpp-wasm";

const nxpp = await createNxpp();
const graph = new nxpp.GraphInt();
// Use the graph, then call graph.dispose().

The raw Embind module has no public replacement. See the 1.0 release notes for the breaking-change summary and the WASM build and release guide for maintainer commands. The issue roadmap records the completed architecture audit.