Documentation ¶
Overview ¶
Package dot provides an abstraction for painlessly building and printing graphviz dot-files
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EdgeDescription ¶
type EdgeDescription struct { From VertexDescription To VertexDescription Directed bool }
EdgeDescription is an element containing all the information needed to fully describe a dot-file edge
type Element ¶
Element captures the information of a dot-file element, typically corresoponding to one line of the file
type Graph ¶
Graph is the graphviz dot-file graph representation.
func (*Graph) AddComment ¶
AddComment interprets the given argument as the text of a comment and schedules the comment to be written in the output dotfile
func (*Graph) AddEdge ¶
func (graph *Graph) AddEdge(v1 *VertexDescription, v2 *VertexDescription, directed bool)
AddEdge constructs an edgedescription connecting the two vertices given as parameters and schedules this element to be written in the output dotfile
Example ¶
buf := new(bytes.Buffer) g := NewGraph("testGraph") vTo := &VertexDescription{ ID: "vTo", } vFrom := &VertexDescription{ ID: "vFrom", } g.AddEdge(vTo, vFrom, true) g.WriteDot(buf) s := buf.String() lines := strings.Split(s, "\n") fmt.Printf("%d\n", len(lines)) if len(lines) < 3 { return } fmt.Println(lines[2])
Output: 5 vTo -> vFrom
func (*Graph) AddNewLine ¶
func (graph *Graph) AddNewLine()
AddNewLine schedules a newline to be written in the output dotfile
func (*Graph) AddVertex ¶
func (graph *Graph) AddVertex(v *VertexDescription)
AddVertex schedules the vertexdescription to be written in the output dotfile
type Literal ¶
type Literal struct {
Line string
}
Literal is an element consisting of the corresponding literal string printed in the dot-file
type VertexDescription ¶
VertexDescription is an element containing all the information needed to fully describe a dot-file vertex