simian-simple-graph

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i simian-simple-graph

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

14.9 kB

Total Files

19

Last publish

Collaborators

  • akshat1