
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
gd_graph is a simple tool for managing a directed graph and includes some nice features that help to manage the data:
npm install --save gd_graph
npm test
import graph from "gd_graph" // ES6
// or
var graph = require("../gd_graph.es5").default; // ES5
const g = graph()
// add nodes to the graph
// they start out disconnected
// returns id's for the nodes
const id1 = g.add()
const id2 = g.add()
const id3 = g.add()
const id4 = g.add()
// removes the node and all of its connections
// cleans up connections from other nodes as well
g.remove( id4 );
// connect directional edge between nodes
// returns true/false for connection success
g.connect( id1, id2 ) //true
g.connect( id1, id3 ) //true
g.connect( id1, id4 ) //false
// bidirectionally connect nodes
g.connectFull(id2, id3) //[true, true]
g.connectFull(id1, id2) //[false, true]
g.connectFull(id1, id4) //[false, false]
// get a list of all node ids
// unique ids are generated by the graph
g.ids() // ["n0", "n1", "n2"]
// get all the nodes and their edges
g.nodes() // {n0:[], n1:[], n2:[]}
// does a directional edge
// connect the first node to the second
g.connected( id1, id2 ) // true
g.connected( id1, id3 ) // false
g.connected( id3, id1 ) // false
// does the graph contain a node with this id?
g.has( id1 ) // true
g.has( id4 ) // false
// get the node's list of edges
g.get( id1 ) // [ ids... ]
g.get( id1 ) // [ ids... ]
// how many connections has id1 formed with other nodes
// convenience to get the length of the edge list for
// this node
g.degree( id1 ) // 3
// removes the edge from id1 -> id2
// returns true if the connection is severed
// returns false if the sever fails
g.sever( id1, id2 ) // true
// removes the edge from id2 -> id3 and id3 -> id2
// returns [true,true] if the connections are severed
// returns [false, false] if the severs fail
g.severFull(id2, id3)
FAQs
simple graph library
The npm package gd_graph receives a total of 4 weekly downloads. As such, gd_graph popularity was classified as not popular.
We found that gd_graph demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.