@sapphirecode/graphviz-builder
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

@sapphirecode/graphviz-builder

version: 1.4.x

constructing graphviz files using an easy typescript interface

Installation

npm:

npm i --save @sapphirecode/graphviz-builder

yarn:

yarn add @sapphirecode/graphviz-builder

Usage

Object structure

import {Graph,Color} from '@sapphirecode/graphviz-builder';

// create a new graph
const g = new Graph('foo');

// add a node to the graph
// this function returns the full name of the node that's later used for creating edges
const bar = g.add_node('bar');

// if you want to specify attributes
const baz = g.add_node(n => {
  n.name = 'baz';
  n.label = 'node baz';
  n.color = Color.red;
});

// connect nodes
g.add_edge(bar, baz);

// add a subgraph
g.add_graph(sg=>{
  sg.name = 'subgraph';

  sg.add_node('foo');
})

// get info about current stream state
g.node_count // count of nodes written
g.path // get current path (parent graph names separated by underscores)

License

MIT © Timo Hocker timo@scode.ovh

Readme

Keywords

Package Sidebar

Install

npm i @sapphirecode/graphviz-builder

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

33.2 kB

Total Files

38

Last publish

Collaborators

  • timoho01