gonum: gonum.org/v1/gonum/graph/formats/dot/ast Index | Files

package ast

import "gonum.org/v1/gonum/graph/formats/dot/ast"

Package ast declares the types used to represent abstract syntax trees of Graphviz DOT graphs.

Index

Package Files

ast.go doc.go

type Attr Uses

type Attr struct {
    // Attribute key.
    Key string
    // Attribute value.
    Val string
}

An Attr represents an attribute.

Examples.

rank=same

func (*Attr) String Uses

func (a *Attr) String() string

String returns the string representation of the attribute.

type AttrStmt Uses

type AttrStmt struct {
    // Graph component kind to which the attributes are assigned.
    Kind Kind
    // Attributes.
    Attrs []*Attr
}

An AttrStmt represents an attribute statement.

Examples.

graph [rankdir=LR]
node [color=blue fillcolor=red]
edge [minlen=1]

func (*AttrStmt) String Uses

func (a *AttrStmt) String() string

String returns the string representation of the attribute statement.

type CompassPoint Uses

type CompassPoint uint

CompassPoint specifies the set of compass points.

const (
    CompassPointNone      CompassPoint = iota //
    CompassPointNorth                         // n
    CompassPointNorthEast                     // ne
    CompassPointEast                          // e
    CompassPointSouthEast                     // se
    CompassPointSouth                         // s
    CompassPointSouthWest                     // sw
    CompassPointWest                          // w
    CompassPointNorthWest                     // nw
    CompassPointCenter                        // c
    CompassPointDefault                       // _
)

Compass points.

func (CompassPoint) String Uses

func (c CompassPoint) String() string

String returns the string representation of the compass point.

type Edge Uses

type Edge struct {
    // Directed edge.
    Directed bool
    // Destination vertex.
    Vertex Vertex
    // Outgoing edge; or nil if none.
    To  *Edge
}

An Edge represents an edge between two vertices.

func (*Edge) String Uses

func (e *Edge) String() string

String returns the string representation of the edge.

type EdgeStmt Uses

type EdgeStmt struct {
    // Source vertex.
    From Vertex
    // Outgoing edge.
    To  *Edge
    // Edge attributes.
    Attrs []*Attr
}

An EdgeStmt represents an edge statement.

Examples.

A -> B
A -> {B C}
A -> B -> C

func (*EdgeStmt) String Uses

func (e *EdgeStmt) String() string

String returns the string representation of the edge statement.

type File Uses

type File struct {
    // Graphs.
    Graphs []*Graph
}

A File represents a DOT file.

Examples.

digraph G {
   A -> B
}
graph H {
   C - D
}

func (*File) String Uses

func (f *File) String() string

String returns the string representation of the file.

type Graph Uses

type Graph struct {
    // Strict graph; multi-edges forbidden.
    Strict bool
    // Directed graph.
    Directed bool
    // Graph ID; or empty if anonymous.
    ID  string
    // Graph statements.
    Stmts []Stmt
}

A Graph represents a directed or an undirected graph.

Examples.

digraph G {
   A -> {B C}
   B -> C
}

func (*Graph) String Uses

func (g *Graph) String() string

String returns the string representation of the graph.

type Kind Uses

type Kind uint

Kind specifies the set of graph components to which attribute statements may be assigned.

const (
    GraphKind Kind = iota // graph
    NodeKind              // node
    EdgeKind              // edge
)

Graph component kinds.

func (Kind) String Uses

func (k Kind) String() string

String returns the string representation of the graph component kind.

type Node Uses

type Node struct {
    // Node ID.
    ID  string
    // Node port; or nil if none.
    Port *Port
}

A Node represents a node vertex.

Examples.

A
A:nw

func (*Node) String Uses

func (n *Node) String() string

String returns the string representation of the node.

type NodeStmt Uses

type NodeStmt struct {
    // Node.
    Node *Node
    // Node attributes.
    Attrs []*Attr
}

A NodeStmt represents a node statement.

Examples.

A [color=blue]

func (*NodeStmt) String Uses

func (e *NodeStmt) String() string

String returns the string representation of the node statement.

type Port Uses

type Port struct {
    // Port ID; or empty if none.
    ID  string
    // Compass point.
    CompassPoint CompassPoint
}

A Port specifies where on a node an edge should be aimed.

func (*Port) String Uses

func (p *Port) String() string

String returns the string representation of the port.

type Stmt Uses

type Stmt interface {
    fmt.Stringer
    // contains filtered or unexported methods
}

A Stmt represents a statement, and has one of the following underlying types.

*NodeStmt
*EdgeStmt
*AttrStmt
*Attr
*Subgraph

type Subgraph Uses

type Subgraph struct {
    // Subgraph ID; or empty if none.
    ID  string
    // Subgraph statements.
    Stmts []Stmt
}

A Subgraph represents a subgraph vertex.

Examples.

subgraph S {A B C}

func (*Subgraph) String Uses

func (s *Subgraph) String() string

String returns the string representation of the subgraph.

type Vertex Uses

type Vertex interface {
    fmt.Stringer
    // contains filtered or unexported methods
}

A Vertex represents a vertex, and has one of the following underlying types.

*Node
*Subgraph

Package ast imports 2 packages (graph) and is imported by 5 packages. Updated 2019-01-30. Refresh now. Tools for package owners.