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

weavatrix-graph

v0.6.5

Published

Deterministic, evidence-carrying Rust graph core for Node.js and Bun

Readme

weavatrix-graph

A deterministic, evidence-carrying directed graph with production algorithms — written in Rust, exposed to Node.js and Bun through Node-API.

Every edge carries provenance: which extractor produced it, what evidence backs it, how confident that evidence is, and optionally where in the source it came from. That is the difference between a graph you can query and a graph you can defend.

npm install weavatrix-graph
# or
bun add weavatrix-graph
const { Graph } = require('weavatrix-graph')

const graph = new Graph({
  nodes: [
    { id: 'api', label: 'API', kind: 'service' },
    { id: 'db', label: 'Database', kind: 'table' },
  ],
  edges: [{
    source: 'api',
    target: 'db',
    kind: 'reads',
    provenance: { extractor: 'architecture', evidence: 'parsed', confidence: 'exact' },
  }],
})

graph.shortestPath('api', 'db')          // ['api', 'db']
graph.hasCycle()                          // false
graph.pageRank({ damping: 0.85 })         // [{ id, score }, …]
graph.outgoing('api')[0].provenance        // why that edge exists

Input

GraphNode

| Field | Type | Notes | | --- | --- | --- | | id | string | Stable identity. Must be unique. | | label | string | Human-readable name. | | kind | string | Free-form node category. | | language | string? | | | span | SourceSpan? | { file, start: { line, column }, end: { line, column } } | | attributes | Record<string, AttributeValue>? | Nested JSON values are allowed. |

GraphEdge

| Field | Type | Notes | | --- | --- | --- | | source, target | string | Must reference declared node ids. | | kind | string | Relation type, such as calls, reads, implements. | | provenance | Provenance | Required. { extractor, evidence, confidence, span?, detail? } where confidence is 'exact' \| 'high' \| 'medium' \| 'low'. | | attributes | Record<string, AttributeValue>? | |

Requiring provenance on construction is deliberate: an edge nobody can justify never enters the graph.


API

new Graph(input)

Validates the whole input and throws on a duplicate node id, a dangling edge endpoint, or a malformed provenance record.

| Member | Returns | Notes | | --- | --- | --- | | nodeCount | number | | | edgeCount | number | | | canonical() | GraphInput | Deterministic serialization. Two graphs with equal content produce byte-identical output, which is what makes a graph diffable and cacheable. | | node(id) | GraphNode \| undefined | | | outgoing(id) | GraphEdge[] | Edges leaving id, with provenance intact. | | incoming(id) | GraphEdge[] | Edges arriving at id. | | bfs(start) | string[] | Materialized breadth-first visit order. | | shortestPath(source, target) | string[] \| undefined | Node ids inclusive of both ends; undefined when unreachable. | | stronglyConnectedComponents() | string[][] | Each component in deterministic order. | | topologicalSort() | string[] \| undefined | undefined when the graph has a cycle. | | hasCycle() | boolean | | | pageRank(options?) | { id, score }[] | { damping = 0.85, iterations = 20 }. Deterministic for a given graph and settings. | | toDot() | string | Deterministic Graphviz DOT. |

Traversal methods throw InvalidArg for an unknown node id, rather than silently returning nothing.


Determinism

Component order, visit order, DOT output, and canonical serialization are all derived from content, never from insertion order or thread scheduling. The same input produces the same bytes on every platform and every run.


Errors

| code | Cause | | --- | --- | | InvalidArg | Malformed input JSON, duplicate node id, edge endpoint that references no node, unknown node id passed to a traversal, invalid PageRank settings. |


What ships

| | | | --- | --- | | Runtimes | Node.js 18+ (Node-API 8), Bun 1.4+ | | Platforms | Windows x64/arm64, macOS x64/arm64, glibc Linux x64/arm64 | | Install script | none | | Network at install | none | | Runtime dependencies | none | | Platform packages | none — all six bindings are in this one tarball |

The Node-API 8 ABI keeps the addon independent of any single Node major version.


Measured

benchmark/RESULTS.md is generated from the weavatrix-benchmarks harness, which forces both sides to materialize the identical BFS visit order before either is timed. The competitor is graphology, the standard JavaScript graph library.

Medians of three independent runs over 50,000 nodes and 149,991 edges:

| Contract | Node 24 | Bun 1.3 | | --- | ---: | ---: | | Materialized directed BFS node ids | 2.98x (2.91–3.14) | 2.98x (2.82–3.20) |

graphology stores a plain topology; the Weavatrix graph also retains typed provenance on every edge, so it is carrying more and still traversing faster. On a ten-node graph both sides sit in timer noise, and this project makes no small-graph claim.


Graph owns its repository, package, release evidence, and MIT license, and can be used entirely on its own.

Repository: Weavatrix/weavatrix-graph · Rust crate: crates.io/crates/weavatrix-graph · License: MIT