npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

@thi.ng/dgraph

1.1.9 • Public • Published

@thi.ng/dgraph

npm version npm downloads Twitter Follow

About

Type-agnostic directed acyclic graph (DAG), using @thi.ng/associative maps & sets as backend.

Features

  • cycle detection
  • accessors for direct & transitive dependencies / dependents
  • topological sorting
  • iterable (in topo order)

Installation

yarn add @thi.ng/dgraph

Dependencies

Usage examples

import { DGraph } from "@thi.ng/dgraph";
 
g = new DGraph();
 
// dependencies from a -> b
g.addDependency([1, 2], [10, 20]);
g.addDependency([3, 4], [30, 40]);
g.addDependency([1, 2], [3, 4]);
 
// add isolated nodes
g.addNode([100, 200]);
 
g.sort();
// [[30, 40], [3, 4], [10, 20], [100, 200], [1, 2]]

Authors

  • Karsten Schmidt

License

© 2018 Karsten Schmidt // Apache Software License 2.0

install

npm i @thi.ng/dgraph

Downloadsweekly downloads

16

version

1.1.9

license

Apache-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability