dot

package
v0.0.0-...-79d4ce4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(g graph.Graph) []byte

Marshal returns the DOT encoding for the graph g

func Unmarshal

func Unmarshal(b []byte) *simple.DirectedGraph

Unmarshal reads a slice of bytes containing a dot encoded graph and returns a *simple.DirectedGraph with edges and nodes containing attributes

Types

type Graph

type Graph struct {
	*simple.DirectedGraph
}

Graph ensures dotEdge and Node types are created when needed.

func (Graph) GetNodeByDOTID

func (g Graph) GetNodeByDOTID(DOTID string) graph.Node

GetNodeByDOTID gets a Node by it's DOT ID.

func (Graph) NewEdge

func (g Graph) NewEdge(from, to graph.Node) graph.Edge

NewNode returns a new Edge to be added to g. The Edge contains the attributes.

func (Graph) NewNode

func (g Graph) NewNode() graph.Node

NewNode returns a new Node to be added to g. The Node contains the attributes.

type Node

type Node struct {
	graph.Node
	// contains filtered or unexported fields
}

Node handles basic DOT serialisation and deserialisation

func (*Node) Attribute

func (n *Node) Attribute(key string) (string, error)

Attribute gets a DOT attribute.

func (*Node) Attributes

func (n *Node) Attributes() []encoding.Attribute

Attributes gets the slice of attributes defined for the node.

func (*Node) DOTID

func (n *Node) DOTID() string

DOTID gets the DOT attribute.

func (*Node) SetAttribute

func (n *Node) SetAttribute(attr encoding.Attribute) error

SetAttribute sets a DOT attribute.

func (*Node) SetDOTID

func (n *Node) SetDOTID(id string)

SetDOTID sets the DOT ID.

Jump to

Keyboard shortcuts

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