Skip to content

Latest commit

 

History

History
145 lines (107 loc) · 4.71 KB

README.md

File metadata and controls

145 lines (107 loc) · 4.71 KB

@thi.ng/dgraph-dot

npm version npm downloads Mastodon Follow

Note

This is one of 199 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

ESM import:

import * as dd from "@thi.ng/dgraph-dot";

Browser ESM import:

<script type="module" src="https://esm.run/@thi.ng/dgraph-dot"></script>

JSDelivr documentation

For Node.js REPL:

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

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

Dependencies

Note: @thi.ng/api is in most cases a type-only import (not used at runtime)

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