thegraph.io

1.0.1 • Public • Published

theGraph.io

A simple, minimalistic, no-nonsense graph library for Node.js.

Installation

  npm install thegraph.io

Usage

const Graph = require('thegraph.io');
var graph = new Graph();
 
// Add vertices.
graph.addVertices(['a', 'b', 'c', 'd']);
 
// Add vertices with associated objects.
graph.addVertex('f', {type: 'Character'});
 
// Add edges between nodes.
graph.addEdge('a', 'b');
 
// Edges an have associated objects (e.g. weight)
graph.addEdge('b', 'c', {weight: 20});
 
graph.addEdge('c', 'd', {relationship: 'Consecutive'});
 
// Find shortest path between nodes.
var path = graph.getShortestPath('a', 'd');

Made with ❤️ & ☕️ from 🇬🇮

Package Sidebar

Install

npm i thegraph.io

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

14.6 kB

Total Files

5

Last publish

Collaborators

  • vizcosity