Options
All
  • Public
  • Public/Protected
  • All
Menu

@thi.ng/dgraph-dot

dgraph-dot

npm versionnpm downloads Twitter Follow

This project is part of the @thi.ng/umbrella monorepo.

About

Customizable Graphviz DOT serialization for @thi.ng/dgraph.

This package acts as optional glue layer between the @thi.ng/dgraph and @thi.ng/dot packages. The latter is used to perform the actual Graphviz serialization. Please consult its readme & source code for visualization options.

Status

ALPHA - bleeding edge / work-in-progress

Installation

yarn add @thi.ng/dgraph-dot
// ES module
<script type="module" src="https://unpkg.com/@thi.ng/dgraph-dot?module" crossorigin></script>

// UMD
<script src="https://unpkg.com/@thi.ng/dgraph-dot/lib/index.umd.js" crossorigin></script>

Package sizes (gzipped, pre-treeshake): ESM: 241 bytes / CJS: 292 bytes / UMD: 393 bytes

Dependencies

API

Generated API docs

TODO

import { defDGraph } from "@thi.ng/dgraph";
import { toDot } from "@thi.ng/dgraph-dot";

// define dependency graph
const graph = defDGraph([
    ["a", "b"],
    ["a", "c"],
    ["b", "d"],
    ["c", "d"],
    ["c", "e"],
]);

// convert to graphviz format
console.log(toDot(graph, { id: (node) => node }));
// digraph g {
// "b"[label="b"];
// "c"[label="c"];
// "d"[label="d"];
// "e"[label="e"];
// "a"[label="a"];
// "b" -> "d";
// "c" -> "d";
// "c" -> "e";
// "a" -> "b";
// "a" -> "c";
// }

(Also see tests)

Authors

Karsten Schmidt

License

© 2020 Karsten Schmidt // Apache Software License 2.0

Generated using TypeDoc