Documentation
¶
Index ¶
- Variables
- type AttributesMap
- type ClusterOption
- type Edge
- type Graph
- func (g *Graph) AddToSameRank(group string, nodes ...Node)
- func (g *Graph) Edge(fromNode, toNode Node, labels ...string) Edge
- func (g *Graph) FindEdges(fromNode, toNode Node) (found []Edge)
- func (g *Graph) ID(newID string) *Graph
- func (g Graph) IndentedWrite(w *IndentWriter)
- func (g *Graph) Label(label string) *Graph
- func (g *Graph) Node(id string) Node
- func (g *Graph) Root() *Graph
- func (g Graph) String() string
- func (g *Graph) Subgraph(id string, options ...GraphOption) *Graph
- func (g Graph) Write(w io.Writer)
- type GraphOption
- type GraphTypeOption
- type HTML
- type IndentWriter
- func (i *IndentWriter) BackIndent()
- func (i *IndentWriter) Indent()
- func (i *IndentWriter) IndentWhile(block func())
- func (i *IndentWriter) NewLine()
- func (i *IndentWriter) NewLineIndentWhile(block func())
- func (i *IndentWriter) Write(data []byte) (n int, err error)
- func (i *IndentWriter) WriteString(s string) (n int, err error)
- type Literal
- type Node
Constants ¶
This section is empty.
Variables ¶
var ( Strict = GraphTypeOption{"strict"} Undirected = GraphTypeOption{"graph"} Directed = GraphTypeOption{"digraph"} Sub = GraphTypeOption{"subgraph"} )
Functions ¶
This section is empty.
Types ¶
type AttributesMap ¶
type AttributesMap struct {
// contains filtered or unexported fields
}
AttributesMap holds attribute=value pairs.
func (AttributesMap) Attr ¶
func (a AttributesMap) Attr(label string, value interface{})
Attr sets the value for an attribute (unless empty).
func (AttributesMap) Delete ¶ added in v0.10.2
func (a AttributesMap) Delete(key string)
Delete removes the attribute value at key, if any
func (AttributesMap) Value ¶
func (a AttributesMap) Value(label string) interface{}
Value return the value added for this label.
type ClusterOption ¶
type ClusterOption struct{}
func (ClusterOption) Apply ¶
func (o ClusterOption) Apply(g *Graph)
type Edge ¶
type Edge struct {
AttributesMap
// contains filtered or unexported fields
}
Edge represents a graph edge between two Nodes.
func (Edge) Edge ¶
Edge returns a new Edge between the "to" node of this Edge and the argument Node.
type Graph ¶
type Graph struct {
AttributesMap
// contains filtered or unexported fields
}
Graph represents a dot graph with nodes and edges.
func NewGraph ¶
func NewGraph(options ...GraphOption) *Graph
NewGraph return a new initialized Graph.
func (*Graph) AddToSameRank ¶
AddToSameRank adds the given nodes to the specified rank group, forcing them to be rendered in the same row
func (*Graph) Edge ¶
Edge creates a new edge between two nodes. Nodes can be have multiple edges to the same other node (or itself). If one or more labels are given then the "label" attribute is set to the edge.
func (*Graph) FindEdges ¶
FindEdges finds all edges in the graph that go from the fromNode to the toNode. Otherwise, returns an empty slice.
func (Graph) IndentedWrite ¶
func (g Graph) IndentedWrite(w *IndentWriter)
IndentedWrite write the graph to a writer using simple TAB indentation.
func (*Graph) Node ¶
Node returns the node created with this id or creates a new node if absent. The node will have a label attribute with the id as its value. Use Label() to overwrite this. This method can be used as both a constructor and accessor. not thread safe!
type GraphOption ¶
type GraphOption interface {
Apply(*Graph)
}
type GraphTypeOption ¶
type GraphTypeOption struct {
Name string
}
func (GraphTypeOption) Apply ¶
func (o GraphTypeOption) Apply(g *Graph)
type HTML ¶
type HTML string
HTML renders the provided content as graphviz HTML. Use of this type is only valid for some attributes, like the 'label' attribute.
type IndentWriter ¶
type IndentWriter struct {
// contains filtered or unexported fields
}
func NewIndentWriter ¶
func NewIndentWriter(w io.Writer) *IndentWriter
func (*IndentWriter) BackIndent ¶
func (i *IndentWriter) BackIndent()
func (*IndentWriter) Indent ¶
func (i *IndentWriter) Indent()
func (*IndentWriter) IndentWhile ¶
func (i *IndentWriter) IndentWhile(block func())
func (*IndentWriter) NewLine ¶
func (i *IndentWriter) NewLine()
func (*IndentWriter) NewLineIndentWhile ¶
func (i *IndentWriter) NewLineIndentWhile(block func())
func (*IndentWriter) Write ¶
func (i *IndentWriter) Write(data []byte) (n int, err error)
Write makes it an io.Writer
func (*IndentWriter) WriteString ¶
func (i *IndentWriter) WriteString(s string) (n int, err error)
type Literal ¶
type Literal string
Literal renders the provided value as is, without adding enclosing quotes, escaping newlines, quotations marks or any other characters. For example:
node.Attr("label", Literal(`"left-justified text\l"`))
allows you to left-justify the label (due to the \l at the end). The caller is responsible for enclosing the value in quotes and for proper escaping of special characters.
type Node ¶
type Node struct {
AttributesMap
// contains filtered or unexported fields
}
Node represents a dot Node.

