New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

vertex-ds

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vertex-ds

Vertex data structure class for Javascript

latest
Source
npmnpm
Version
0.8.2
Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

Usage

//Initialize
let vertex = new Vertex('key', 'value');
let n1 = new Vertex(1, 'one');
let n2 = new Vertex(2, 'two');

//Append neighbours to vertex instance
vertex.addNeighbour(n1);
vertex.addNeighbour(n2);

//Get number of neighbours in vertex instance
let numNeighbours = vertex.degree; // 2

//Get all neighbours in vertex instance
let neighbourhood = vertex.neighbourhood();// Map {1:'one', 2:'two'}

vertex.hasNeighbour(1);// True
vertex.hasNeighbour(3);// False

vertex.getNeighbour(1);// "one"

vertex.delete(2);
vertex.getNeighbour(2);// "null"
numNeighbours = vertex.degree; // 1
neighbourhood = vertex.neighbourhood();// Map {1:'one'}

Requirements

  • ES6, or compiler
  • Node ^4.4.4

FAQs

Package last updated on 05 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts