modulepackage
0.0.0-20180912213407-94a425d4984e
Repository: https://github.com/zenground0/go-dot.git
Documentation: pkg.go.dev
# README
go-dot
Simple dot file writer in go
Example use
import (
os
dot "github.com/zenground0/go-dot"
)
g := dot.NewGraph("MyGraph", os.Stdout)
var v1 dot.VertexDescription
v1.ID = "V1"
v1.Label = "Node1"
v1.Color = "blue2"
g.AddVertex(&v1)
var v2 dot.VertexDescription
v2.ID = "V2"
v2.Label = "Node2"
v2.Color = "blue1"
g.AddVertex(&v2)
g.AddEdge(v1, v2, true)
g.WriteDot()
output:
digraph MyGraph {
V1 [label="Node1" color="blue2"]
V2 [label="Node2" color="blue1"]
V1 -> V2
}
Contribute
Currently attribute support is barebones. Only attributes "label" and "color" are implemented. PRs welcome to extend this or add other features. Check the issues for proposals in flight, or this reference http://www.graphviz.org/pdf/dotguide.pdf for new ideas.
License
MIT © Protocol Labs, Inc
# Functions
NewGraph returns a new dot-file graph object given the provided name.
# Structs
EdgeDescription is an element containing all the information needed to fully describe a dot-file edge.
Graph is the graphviz dot-file graph representation.
Literal is an element consisting of the corresponding literal string printed in the dot-file.
VertexDescription is an element containing all the information needed to fully describe a dot-file vertex.
# Interfaces
Element captures the information of a dot-file element, typically corresoponding to one line of the file.