Skip to content

Welcome

Warning

this package is a WIP and will introduce breaking changes while on major version zero.

Status GitHub tag (latest SemVer) Go Report Card GoDoc

Quality Gate Status Reliability Rating Security Rating Maintainability Rating

Dot is a lightweight, pure golang graphviz-compatible dot language implementation focused on generating dot/gv files that Graphviz can then convert into any of its output formats supported (e.g. png, jpeg, svg, pdf).

Dot provides both interfaces and ready-to-use concrete types that represent dot language resources - namely Graphs, Nodes and Edges, plus all attributes.

This package was inspired/initially forked from emicklei/dot, but has too many breaking changes compared to the original - namely interface usage and other distinct design decisions - so it seemed better to maintain it separately. If you need a simpler, no-brainy option, use emicklei's dot package.

Installation

Fetch the package using go

go get -u github.com/wwmoraes/dot

Usage

package main

import (
  "os"
  "github.com/wwmoraes/dot"
)

func main() {
  graph := dot.New()

  graph.Node("n1").SetAttributeString("label", "hello dot!")

  fd, _ := os.Create("sample.dot")
  defer fd.Close()

  graph.WriteTo(fd)
}