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! ❤️
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.
STABLE - used in production
Search or submit any issues for this package
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>
For Node.js REPL:
const dd = await import("@thi.ng/dgraph-dot");
Package sizes (brotli'd, pre-treeshake): ESM: 228 bytes
Note: @thi.ng/api is in most cases a type-only import (not used at runtime)
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 |
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)
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
}
© 2020 - 2024 Karsten Schmidt // Apache License 2.0