1.0.1 • Published 6 years ago
thegraph.io v1.0.1
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');