dot

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2016 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

The dot package contains utilities for working with DOT graphs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	// Name of source node.
	Source string

	// Name of dest node.
	Dest string

	// List of K/V attributes for this edge.
	Attrs map[string]string
}

An Edge in a DOT graph, as expressed by recording the Name of the Node at each end.

func NewEdge

func NewEdge(src, dst string, attrs map[string]string) *Edge

func (*Edge) String

func (e *Edge) String() string

Returns the DOT representation of this Edge.

type Graph

type Graph struct {
	// Whether this is a "digraph" or just a "graph"
	Directed bool

	// Used for K/V settings in the DOT
	Attrs map[string]string

	Nodes     []*Node
	Edges     []*Edge
	Subgraphs []*Subgraph
	// contains filtered or unexported fields
}

Graph is a representation of a drawable DOT graph.

func NewGraph

func NewGraph(attrs map[string]string) *Graph

Creates a properly initialized DOT Graph.

func (*Graph) AddAttr

func (g *Graph) AddAttr(k, v string)

func (*Graph) AddEdge

func (g *Graph) AddEdge(e *Edge)

func (*Graph) AddEdgeBetween

func (g *Graph) AddEdgeBetween(src, dst string, attrs map[string]string) error

Adds an edge between two Nodes.

Note this does not do any verification of the existence of these nodes, which means that any strings you provide that are not existing nodes will result in extra auto-defined nodes in your resulting DOT.

func (*Graph) AddNode

func (g *Graph) AddNode(n *Node)

func (*Graph) AddSubgraph

func (g *Graph) AddSubgraph(name string) *Subgraph

Initializes a Subgraph with the provided name, attaches is to this Graph, and returns it.

func (*Graph) Bytes added in v0.7.9

func (g *Graph) Bytes() []byte

Returns the DOT representation of this Graph.

func (*Graph) GetNode

func (g *Graph) GetNode(name string) (*Node, error)

Look up a node by name

func (*Graph) String

func (g *Graph) String() string

Returns the DOT representation of this Graph.

type Node

type Node struct {
	Name  string
	Attrs map[string]string
}

A Node in a DOT graph.

func NewNode

func NewNode(n string, attrs map[string]string) *Node

func (*Node) String

func (n *Node) String() string

Returns the DOT representation of this Node.

type Subgraph

type Subgraph struct {
	Graph
	Name    string
	Parent  *Graph
	Cluster bool
}

Subgraph is a Graph that lives inside a Parent graph, and contains some additional parameters to control how it is drawn.

Jump to

Keyboard shortcuts

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