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

lightning-adjacency

v0.0.14

Published

Adjacency plot for **Lightning**

Downloads

100

Readme

Lightning Adjcency

Adjacency plot for Lightning

Documentation and examples at lightning-viz.org

adjacency

Usage options

Lightning server

The Lightning server provides API-based access to reproducible, web-based visualizations. It can be deployed in many ways, including Heroku, Docker, a public server, a local app for OS X — and even a server-less version well-suited to notebooks like Jupyter. It comes bundled with a core set of visualizations, but is built to support custom ones.

Read more about getting started with a Lightning server

You can create an adjacency visualization using Python, Scala, JavaScript, or R by using API clients for making requests to a Lightning server.

Clients

Take a look at each client for installation and usage examples:

Python adjacency example

from lightning import Lightning
from numpy import random

lgn = Lightning()

mat = random.rand(10,10)
mat[mat < 0.75] = 0
group = (random.rand(10) * 5).astype('int')

lgn.adjacency(mat, group=group)

Scala adjacency example

import org.viz.lightning._
import scala.util.Random

val lgn = Lightning()

val mat = Array.fill(10)(Array.fill(10)(Random.nextDouble()).map{ d =>
	if (d < 0.75) {
		d
	} else {
		0.0
	}
})
val group = Array.fill(10)(Random.nextInt)

lgn.adjacency(mat, group=group)

JavaScript module via npm

lightning-adjacency is an npm module that can be used on its own.

Install as JavaScript module

npm i --save lightning-adjacency

Example

var Adjacency = require('lightning-adjacency');

var el = document.createElement('div');
document.body.appendChild(el);

var data = {
  nodes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  group: [0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2],
  links: [[0, 1, 1], [0, 2, 1], [1, 3, 3], [5, 6, 4], [7, 9, 2]],
  labels: ["name 0", "name 1", "name 2", "name 3", "name 4", "name 5", "name 6", "name 7", "name 8", "name 9", "name 10"]
};

var options = {
  numbers: true,
  symmetric: true,
  sort: 'group',
  width: 600,
  height: 400
};

var adjacency = new Adjacency(el, data, options);

API

var Adjacency = require('lightning-adjacency');

var adjacency = new Adjacency(selector, data, options);

Arguments:

  • selector – css selector or dom node that will act as parent node of the visualization
  • data – the required data for the Visualization
    • nodes – array representing nodes in the visualization
    • group – array representing groups
    • links – array of arrays describing the links between nodes
    • labels – array of strings
  • options
    • widthNumber – the width of the visualization
    • heightNumber – the height of the visualization
    • numbersBoolean – Set to true to show numbers in cells of the visualization. Default: false
    • symmetricBoolean
    • sort – can be either group or degree

License

MIT