mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
* Update graphviz-tests.ts * Update tslint.json * Update index.d.ts * union is unnecessary. * Update index.d.ts * add graphviz.org * trigger build * Update index.d.ts * Update index.d.ts * fix linter * export everything and fix lint
27 lines
622 B
TypeScript
27 lines
622 B
TypeScript
import graphviz = require("graphviz");
|
|
|
|
// Create digraph G
|
|
const g: graphviz.Graph = graphviz.digraph("G");
|
|
|
|
// Add node (ID: Hello)
|
|
const n1: graphviz.Node = g.addNode("Hello", { color: "blue" });
|
|
n1.set("style", "filled");
|
|
|
|
// Add node (ID: World)
|
|
g.addNode("World");
|
|
|
|
// Add edge between the two nodes
|
|
const e: graphviz.Edge = g.addEdge(n1, "World");
|
|
e.set("color", "red");
|
|
|
|
// Print the dot script
|
|
console.log(g.to_dot());
|
|
|
|
// Set GraphViz path (if not in your path)
|
|
g.setGraphVizPath("/usr/local/bin");
|
|
|
|
// Generate a PNG output
|
|
g.output("png", "test01.png");
|
|
|
|
g.output({ type: "pdf", use: "circo" }, "test02.pdf");
|