JSPM

simian-simple-graph

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q24655F
  • License MIT

A quick and dirty DAG data structure.

Package Exports

  • simian-simple-graph

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simian-simple-graph) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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