@nhz.io/graph
v0.1.1
Published
Graph
Downloads
6
Readme
Graph
Install
npm i -S @nhz.io/graph
Usage
This:
const Graph = require('@nhz.io/graph')
const graph = new Graph()
graph.setEdge ['node-1', 'node-2', 'edge-1']
graph.setEdge ['node-1', 'node-3', 'edge-2']
console.log(JSON.stringify(graph, null, 2))
Will produce:
{
"id": "737e19e0-d447-11e7-901a-c91a9d397e30",
"nodes": [
"node-1",
"node-2",
"node-3"
],
"edges": [
[
"node-1",
"node-2",
"edge-1"
],
[
"node-1",
"node-3",
"edge-2"
]
]
}