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

fdg-wasm

v0.1.1

Published

A flexible force directed graph framework

Readme

fdg-wasm

NPM Package

This is the webassembly api for fdg. I'm really not an expert in anything javascript, so proceed with a bit of caution here.

Basic Example

import init, { ForceGraphSimulator } from 'https://unpkg.com/[email protected]/fdg-wasm.js';

await init();

let sim = new ForceGraphSimulator();

sim.graph = await fetch('https://raw.githubusercontent.com/jsongraph/json-graph-specification/master/examples/les_miserables.json')
    .then(response => response.json())
    .then(response => response.graph);

sim.setDimensions(2);
sim.resetNodePlacement();

for (let i = 0; i < 2000; i++) {
    sim.update(0.035);
}

sim.nodes.forEach((node) => {
    console.log(`${node.name}: ${node.location}`);
});

It works with deno greate just like this:

$ deno run --allow-net deno.js
Listolier: 197.79331970214844,134.728515625,0
CountessdeLo: 157.74066162109375,-356.2279052734375,0
Dahlia: 228.4669647216797,134.91195678710938,0
Jondrette: -403.8577880859375,86.82536315917969,0
Napoleon: 175.74081420898438,-324.6880187988281,0
Zephine: 195.84951782226562,157.9574737548828,0
Champtercier: 50.745147705078125,-383.8532409667969,0
Brujon: -95.5260009765625,23.29458236694336,0
Cochepaille: 137.5876007080078,-97.65261840820312,0
Fauchelevent: -81.33965301513672,-95.81346893310547,0
Mme.Hucheloup: -188.01766967773438,79.68028259277344,0
Boulatruelle: -140.707275390625,-19.337364196777344,0
Child1: -261.75665283203125,36.16830062866211,0
...

ForceGraphSimulation Documentation

simulation.graph

Get and set the simulation's internal graph based on the jsongraph specification.

simulation.addNode(String name)

Insert a new node into the graph and returns it's index.

simulation.nodes

Retrieve all the nodes from the graph in an array.

simulation.addEdge(source index or name, target index or name, weight)

Add a new edge into the graph.

simulation.edges

Retrieve all the edges from the graph in an array.

simulation.resetNodePlacement()

Resets the nodes in the graph to a random position near the origin.

simulation.setDimensions()

Sets the number of dimensions the simulation runs in.

simulation.find(query: [Number; 3], radius: Number)

Queries the graph for a node in a location with a radius and returns the node.

simulation.nodeInfo(String name | Number index)

Returns the node info from the name or index of a node.

simulation.update(Number dt)

Updates the internal simulation for an interval.

jsongraph_to_dot(String graph)

Returns a graphviz dot graph from a jsongraph string.