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

networkjs

v0.1.1

Published

NetworkX Clone in JavaScript

Downloads

55

Readme

NetworkJS Build Status

NetworkX clone in JavaScript!

Implemented modules :

  • Degree Centrality
  • Betweenness Centrality
  • Eigenvector Centrality

Menu

Installation

  • Install Nodejs
  • For command line install the tool via npm : npm install -g networkjs
  • For library usage : npm install --save networkjs
  • Makefile is also provided which will automatically install latest node if not present and then install the command line tool. To run, type the following :
make
make install

Usage

Command Line

See full options available : networkjs --help

  • -s,--source : Provide the column name for Source Node. Default value = "Source"

  • -t,--target : Provide the column name for Target Node. Default value = "Target"

  • -w,--weight : Provide the column name for Weight Node. Default value = "Weight"

  • -d,--degree: Run Degree centrality measure over the given dataset, which is defined as the number of links incident upon a node. https://en.wikipedia.org/wiki/Centrality#Degree_centrality

  • -b,--betweenness: Run Betweenness centrality measure over the given dataset, which for a node is defined as the number of times a node acts as a bridge along the shortest path between two other nodes. https://en.wikipedia.org/wiki/Centrality#Betweenness_centrality

  • -e,--eigenvector: Run Eigenvector centrality measure over the given dataset, which calculates the influence of a node in the network. It assigns relative scores to all nodes in the network based on the concept that connections to high-scoring nodes contribute more to the score of the node in question than equal connections to low-scoring nodes. https://en.wikipedia.org/wiki/Centrality#Eigenvector_centrality

  • -v,--verbose: Print detailed logs and events

  • -h,--help: Display command line help usage for the methods available

For more details consult the man page : man networkjs

Library Usage

Import the required modules either using AMD require or ES6 import :

import nj from 'networkjs'
const Graph = nj.datastructures.Graph
const {betweenness_centrality,
  degree_centrality,
  eigenvector_centrality} = nj.algorithms.centrality

// Add edges
let G = new Graph()
G.add_edges_from([[1,2],[2,3]])

API Reference

datastructures.Graph

  • read_csv
  • add_node
  • add_nodes_from
  • remove_node
  • get_node
  • order
  • has_node
  • num_nodes
  • get_nodes
  • is_directed
  • add_edge
  • add_edges_from
  • add_weighted_edges_from
  • remove_edge
  • remove_edges_from
  • has_edge
  • neighbors
  • degree_iter
  • nbunch_iter

algorithms.centrality

  • degree_centrality
  • betweenness_centrality
  • eigenvector_centrality

Run Tests

npm test

Change Log

0.1.1

  • Changed the command line usage for providing Source, Target and Weight column headers

0.1.0

  • Updated command line interface, now provide Source, Target and Weight headers directly
  • Command line output in csv by default. To get json output provide flag --json

0.0.7

0.0.6

  • Patch fix again broken library import

0.0.5

  • Patch fix broken library import

0.0.4

  • Experimental Library Support

0.0.3

  • Minor fixes
  • Better readme
  • Project is now public

0.0.2

  • Published as npm package
  • Supports command line features

0.0.1

  • Initial release, supports Degree centrality, Betweenness centrality and Eigenvector centrality
  • Added Tests

License

MIT