0.2.1 • Published 1 year ago

@kaylum.io/json-graph-ts v0.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

JSON Graph TS

This is a small TypeScript library for working with json-graph objects in JavaScript/TypeScript.

Features

  • Add nodes and edges
  • disables re-adding existing nodes and edges
  • support for finding nodes according to source/target of edges

Usage

const { JsonGraph } = require("@kaylum.io/json-graph-ts")

const graph = new JsonGraph();

let author = graph.addNode("Stephen King", { "type": "author" })
let book = graph.addNode("The Shining", { "type": "book" })
graph.addEdge(a.id, b.id, "wrote")

console.log(graph.toString())