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 ¶
- type Attr
- type AttrStmt
- type CompassPoint
- type Edge
- type EdgeStmt
- type File
- type Graph
- type Kind
- type Node
- type NodeStmt
- type Port
- type Stmt
- type Subgraph
- type Vertex
Types ¶
type Attr ¶
An Attr represents an attribute.
Examples.
rank=same
func (*Attr) String ¶
String returns the string representation of the attribute.
type AttrStmt ¶
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 ¶
String returns the string representation of the attribute statement.
type CompassPoint ¶
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 ¶
func (c CompassPoint) String() string
String returns the string representation of the compass point.
type Edge ¶
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 ¶
String returns the string representation of the edge.
type EdgeStmt ¶
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 ¶
String returns the string representation of the edge statement.
type File ¶
type File struct {
// Graphs.
Graphs []*Graph
}
A File represents a DOT file.
Examples.
digraph G {
A -> B
}
graph H {
C - D
}
func (*File) String ¶
String returns the string representation of the file.
type Graph ¶
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 ¶
String returns the string representation of the graph.
type Kind ¶
type Kind uint
Kind specifies the set of graph components to which attribute statements may be assigned.
Graph component kinds.
func (Kind) String ¶
String returns the string representation of the graph component kind.
type Node ¶
A Node represents a node vertex.
Examples.
A A:nw
func (*Node) String ¶
String returns the string representation of the node.
type NodeStmt ¶
A NodeStmt represents a node statement.
Examples.
A [color=blue]
func (*NodeStmt) String ¶
String returns the string representation of the node statement.
type Port ¶
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 ¶
String returns the string representation of the port.
type Stmt ¶
A Stmt represents a statement, and has one of the following underlying types.
*NodeStmt *EdgeStmt *AttrStmt *Attr *Subgraph
type Subgraph ¶
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 ¶
String returns the string representation of the subgraph.
type Vertex ¶
A Vertex represents a vertex, and has one of the following underlying types.
*Node *Subgraph
Source Files ¶
ast.go doc.go
- Version
- v0.16.0 (latest)
- Published
- Mar 21, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 2 weeks ago –
Tools for package owners.