@thi.ng/dgraph-dot
TypeScript icon, indicating that this package has built-in type declarations

2.1.112 • Public • Published

@thi.ng/dgraph-dot

npm version npm downloads Mastodon Follow

[!NOTE] This is one of 190 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.

🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️

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

STABLE - used in production

Search or submit any issues for this package

Installation

yarn add @thi.ng/dgraph-dot

ES module import:

<script type="module" src="https://cdn.skypack.dev/@thi.ng/dgraph-dot"></script>

Skypack documentation

For Node.js REPL:

const dgraphDot = await import("@thi.ng/dgraph-dot");

Package sizes (brotli'd, pre-treeshake): ESM: 228 bytes

Dependencies

Usage examples

One project in this repo's /examples directory is using this package:

Screenshot Description Live demo Source
Declarative component-based system with central rstream-based pubsub event bus Demo Source

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

If this project contributes to an academic publication, please cite it as:

@misc{thing-dgraph-dot,
  title = "@thi.ng/dgraph-dot",
  author = "Karsten Schmidt",
  note = "https://thi.ng/dgraph-dot",
  year = 2020
}

License

© 2020 - 2024 Karsten Schmidt // Apache License 2.0

Package Sidebar

Install

npm i @thi.ng/dgraph-dot

Weekly Downloads

111

Version

2.1.112

License

Apache-2.0

Unpacked Size

23.1 kB

Total Files

6

Last publish

Collaborators

  • thi.ng