dot

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

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

func Marshal(g graph.Graph, name, prefix, indent string, strict bool) ([]byte, error)

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 Graph

type Graph interface {
	graph.Graph
	DOTID() string
}

Graph wraps named graph.Graph values.

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

type Porter interface {
	FromPort() (port, compass string)
	ToPort() (port, compass string)
}

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

type Subgrapher interface {
	Subgraph() graph.Graph
}

Subgrapher wraps graph.Node values that represent subgraphs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL