1.0.0 • Published 5 years ago

simian-simple-graph v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Simian Simple Graph

This is a pretty basic DAG structure I cooked up for a particular project.

Installation

npm i --save simian-simple-graph

Usage

import {
  Edge,
  Graph,
  toDot,
  getSubTree
} from 'simian-simple-graph';

const g0 = new Graph([
  new Edge('a', 'b'), // a -> b
  new Edge('a', 'c'), // a -> c
  new Edge('a', 'd'), // a -> d
  new Edge('d', 'e'), // d -> e
  new Edge('d', 'f'), // d -> f
]);

const g1 = getSubTree(g0, 'd'); // d -> e, d -> f

const dotOutput = toDot(g0); // produces string in DOT syntax