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 🙏

© 2024 – Pkg Stats / Ryan Hefner

unle

v1.1.0

Published

An unconstrained force directed node graph layout engine written in javascript and designed for maximum speed and performance

Downloads

4

Readme

UNLE.js

An unconstrained node layout engine for those who really care about performance.

UNLE stands for Unconstrained Node Layout Engine.

Click here for a demo.

Documentation

Installation

Installing UNLE from npm:

npm install unle

Usage

Importing UNLE into your project:

import UNLE from 'unle';

Creating a new UNLE instance:

// Options are:
// "canvas" << required,
// "show_id" -> either true or false,
// "node_radius" -> any positive integer,
// "node_color" -> any HEX colour expressed such as 0x000000 for example,
// "edge_length" -> any positive integer
let graph = new UNLE({
    "canvas": document.getElementById("<div where you want UNLE to place the canvas>"),
    "node_color": 0xA0A0A0,
});

Adding nodes to the graph:

// ID can be anything from an integer to a string
graph.add_node(<id>);

Adding edges to the graph:

// INFO: length has been depreciated and will be removed in an upcoming version
graph.add_edge(<id of first node>, <id of second node>, <length of edge>);

Removing nodes from the graph:

// This will also remove any connected edges
graph.remove_node(<id>);

Removing edges from the graph:

graph.remove_edge(<id of first node>, <id of second node>);

Using the node language:

// The node language is a way of describing a graph in a string
input = `
    nodes: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
    1 -> 2
    2 -> 3
    3 -> 4
    4 -> 5
    5 -> 6
    6 -> 7
    7 -> 8
    8 -> 9
    9 -> 10
    10 -> 1
    5 -> 1
    5 -> 2
    5 -> 3
    5 -> 4
    5 -> 6
`
// Note this is a simple wrapper and has its limitations. Beware of bugs.
from_node_language(input);

The above code will produce the following graph:

Node graph from above node language

Images

Node graph with a central node surrounded by 11 outer nodes connected with edges

Node graph from node language example