Documentation ¶
Overview ¶
Package dot implements GraphViz DOT marshaling of graphs.
See the GraphViz DOT Guide and the DOT grammar for more information on using specific aspects of the DOT language:
DOT Guide: http://www.graphviz.org/Documentation/dotguide.pdf
DOT grammar: http://www.graphviz.org/doc/info/lang.html
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal returns the DOT encoding for the graph g, applying the prefix and indent to the encoding. Name is used to specify the graph name. If name is empty and g implements Graph, the returned string from DOTID will be used. If strict is true the output bytes will be prefixed with the DOT "strict" keyword.
Graph serialization will work for a graph.Graph without modification, however, advanced GraphViz DOT features provided by Marshal depend on implementation of the Node, Attributer, Porter, Attributers, Structurer, Subgrapher and Graph interfaces.
Types ¶
type Attribute ¶
type Attribute struct {
Key, Value string
}
Attribute is a DOT language key value attribute pair.
type Attributer ¶
type Attributer interface {
DOTAttributes() []Attribute
}
Attributer defines graph.Node or graph.Edge values that can specify DOT attributes.
type Attributers ¶
type Attributers interface {
DOTAttributers() (graph, node, edge Attributer)
}
Attributers are graph.Graph values that specify top-level DOT attributes.
type Node ¶
type Node interface { // DOTID returns a DOT node ID. // // An ID is one of the following: // // - a string of alphabetic ([a-zA-Z\x80-\xff]) characters, underscores ('_'). // digits ([0-9]), not beginning with a digit. // - a numeral [-]?(.[0-9]+ | [0-9]+(.[0-9]*)?). // - a double-quoted string ("...") possibly containing escaped quotes (\"). // - an HTML string (<...>). DOTID() string }
Node is a DOT graph node.
type Porter ¶
Porter defines the behavior of graph.Edge values that can specify connection ports for their end points. The returned port corresponds to the the DOT node port to be used by the edge, compass corresponds to DOT compass point to which the edge will be aimed.
type Structurer ¶
type Structurer interface {
Structure() []Graph
}
Structurer represents a graph.Graph that can define subgraphs.
type Subgrapher ¶
Subgrapher wraps graph.Node values that represent subgraphs.