https://github.com/m-bednar/dot-generator
Generator for Graphviz's DOT language
https://github.com/m-bednar/dot-generator
generator graph graphviz graphviz-dot typescript
Last synced: 6 months ago
JSON representation
Generator for Graphviz's DOT language
- Host: GitHub
- URL: https://github.com/m-bednar/dot-generator
- Owner: m-bednar
- Created: 2024-07-25T14:31:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-27T16:32:39.000Z (about 1 year ago)
- Last Synced: 2025-03-06T12:52:53.817Z (7 months ago)
- Topics: generator, graph, graphviz, graphviz-dot, typescript
- Language: TypeScript
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DOT Generator
Generator for Graphviz's DOT language written in Typescript.
## Usage
### Basic graph
```typescript
import { generate, graph, edge, node } from 'dot-generator'const a = node('A')
const b = node('B', { bgcolor: 'red', })
const c = node('C', { shape: 'rectangle' })const g = graph([
edge(a, b),
edge(a, c),
])console.log(generate(g))
```### Directed graph
```typescript
// same as previously...const g = digraph([
edge(a, b),
edge(a, c),
])console.log(generate(g))
```### Subgraph / Cluster
```typescript
import { generate, graph, edge, node, subgraph, cluster } from 'dot-generator'const a = node('A')
const b = node('B', { bgcolor: 'red', })
const c = node('C', { shape: 'rectangle' })
const d = node('D')const g = graph([
edge(a, b),
subgraph([
edge(b, c)
]),
cluster([
edge(c, d)
])
])console.log(generate(g))
```