Documentation ¶
Overview ¶
Package gographviz provides parsing for the DOT grammar into an abstract syntax tree representing a graph, analysis of the abstract syntax tree into a more usable structure, and writing back of this structure into the DOT format.
Index ¶
- func Analyse(graph *ast.Graph, g Interface) error
- func Parse(buf []byte) (*ast.Graph, error)
- func ParseString(buf string) (*ast.Graph, error)
- type Attr
- type Attrs
- type Edge
- type Edges
- type Escape
- func (escape *Escape) AddAttr(parentGraph string, field, value string) error
- func (escape *Escape) AddEdge(src, dst string, directed bool, attrs map[string]string) error
- func (escape *Escape) AddNode(parentGraph string, name string, attrs map[string]string) error
- func (escape *Escape) AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error
- func (escape *Escape) AddSubGraph(parentGraph string, name string, attrs map[string]string) error
- func (escape *Escape) IsNode(name string) bool
- func (escape *Escape) IsSubGraph(name string) bool
- func (escape *Escape) SetName(name string) error
- type Graph
- func (g *Graph) AddAttr(parentGraph string, field string, value string) error
- func (g *Graph) AddEdge(src, dst string, directed bool, attrs map[string]string) error
- func (g *Graph) AddNode(parentGraph string, name string, attrs map[string]string) error
- func (g *Graph) AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error
- func (g *Graph) AddSubGraph(parentGraph string, name string, attrs map[string]string) error
- func (g *Graph) IsNode(name string) bool
- func (g *Graph) IsSubGraph(name string) bool
- func (g *Graph) RemoveNode(parentGraph string, name string) error
- func (g *Graph) RemoveSubGraph(parentGraph string, name string) error
- func (g *Graph) SetDir(dir bool) error
- func (g *Graph) SetName(name string) error
- func (g *Graph) SetStrict(strict bool) error
- func (g *Graph) String() string
- func (g *Graph) WriteAst() (*ast.Graph, error)
- type Interface
- type Node
- type Nodes
- type Relations
- type SubGraph
- type SubGraphs
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Analyse ¶
Analyse analyses an Abstract Syntax Tree representing a parsed graph into a newly created graph structure Interface.
Types ¶
type Attr ¶
type Attr string
Attr is an attribute key
const ( // Damping http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:Damping Damping Attr = "Damping" // K http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:K K Attr = "K" // URL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:URL URL Attr = "URL" // Background http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:_background Background Attr = "_background" // Area http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:area Area Attr = "area" // ArrowHead http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:arrowhead ArrowHead Attr = "arrowhead" // ArrowSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:arrowsize ArrowSize Attr = "arrowsize" // ArrowTail http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:arrowtail ArrowTail Attr = "arrowtail" // BB http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:bb BB Attr = "bb" // BgColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:bgcolor BgColor Attr = "bgcolor" // Center http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:center Center Attr = "center" // Charset http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:charset Charset Attr = "charset" // ClusterRank http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:clusterrank ClusterRank Attr = "clusterrank" // Color http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:color Color Attr = "color" // ColorScheme http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:colorscheme ColorScheme Attr = "colorscheme" // Comment http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:comment Comment Attr = "comment" // Compound http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:compound Compound Attr = "compound" // Concentrate http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:concentrate Concentrate Attr = "concentrate" // Constraint http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:constraint Constraint Attr = "constraint" // Decorate http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:decorate Decorate Attr = "decorate" // DefaultDist http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:defaultdist DefaultDist Attr = "defaultdist" // Dim http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dim Dim Attr = "dim" // Dimen http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dimen Dimen Attr = "dimen" // Dir http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dir Dir Attr = "dir" // DirEdgeConstraints http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dir DirEdgeConstraints Attr = "diredgeconstraints" // Distortion http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:distortion Distortion Attr = "distortion" // DPI http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dpi DPI Attr = "dpi" // EdgeURL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::edgeURL EdgeURL Attr = "edgeURL" // EdgeHREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::edgehref EdgeHREF Attr = "edgehref" // EdgeTarget http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::edgetarget EdgeTarget Attr = "edgetarget" // EdgeTooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::edgetooltip EdgeTooltip Attr = "edgetooltip" // Epsilon http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::epsilon Epsilon Attr = "epsilon" // ESep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::epsilon ESep Attr = "esep" // FillColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fillcolor FillColor Attr = "fillcolor" // FixedSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fixedsize FixedSize Attr = "fixedsize" // FontColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontcolor FontColor Attr = "fontcolor" // FontName http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontname FontName Attr = "fontname" // FontNames http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontnames FontNames Attr = "fontnames" // FontPath http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontpath FontPath Attr = "fontpath" // FontSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontsize FontSize Attr = "fontsize" // ForceLabels http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:forcelabels ForceLabels Attr = "forcelabels" // GradientAngle http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:gradientangle GradientAngle Attr = "gradientangle" // Group http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:group Group Attr = "group" // HeadURL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headURL HeadURL Attr = "headURL" // HeadLP http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:head_lp HeadLP Attr = "head_lp" // HeadClip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headclip HeadClip Attr = "headclip" // HeadHREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headhref HeadHREF Attr = "headhref" // HeadLabel http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headlabel HeadLabel Attr = "headlabel" // HeadPort http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headport HeadPort Attr = "headport" // HeadTarget http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headtarget HeadTarget Attr = "headtarget" // HeadTooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headtooltip HeadTooltip Attr = "headtooltip" // Height http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:height Height Attr = "height" // HREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:href HREF Attr = "href" // ID http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:id ID Attr = "id" // Image http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:image Image Attr = "image" // ImagePath http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:imagepath ImagePath Attr = "imagepath" // ImagePos https://graphviz.org/doc/info/attrs.html#d:imagepos ImagePos Attr = "imagepos" // ImageScale http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:imagescale ImageScale Attr = "imagescale" // InputScale http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:inputscale InputScale Attr = "inputscale" // Label http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:label Label Attr = "label" // LabelURL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelURL LabelURL Attr = "labelURL" // LabelScheme http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:label_scheme LabelScheme Attr = "label_scheme" // LabelAngle http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelangle LabelAngle Attr = "labelangle" // LabelDistance http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labeldistance LabelDistance Attr = "labeldistance" // LabelFloat http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelfloat LabelFloat Attr = "labelfloat" // LabelFontColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelfontcolor LabelFontColor Attr = "labelfontcolor" // LabelFontName http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelfontname LabelFontName Attr = "labelfontname" // LabelFontSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelfontsize LabelFontSize Attr = "labelfontsize" // LabelHREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelhref LabelHREF Attr = "labelhref" // LabelJust http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labeljust LabelJust Attr = "labeljust" // LabelLOC http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelloc LabelLOC Attr = "labelloc" // LabelTarget http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labeltarget LabelTarget Attr = "labeltarget" // LabelTooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labeltooltip LabelTooltip Attr = "labeltooltip" // Landscape http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:landscape Landscape Attr = "landscape" // Layer http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layer Layer Attr = "layer" // LayerListSep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layerlistsep LayerListSep Attr = "layerlistsep" // Layers http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layers Layers Attr = "layers" // LayerSelect http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layerselect LayerSelect Attr = "layerselect" // LayerSep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layersep LayerSep Attr = "layersep" // Layout http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layout Layout Attr = "layout" // Len http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:len Len Attr = "len" // Levels http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:levels Levels Attr = "levels" // LevelsGap http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:levelsgap LevelsGap Attr = "levelsgap" // LHead http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:lhead LHead Attr = "lhead" // LHeight http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:lheight LHeight Attr = "lheight" // LP http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:lp LP Attr = "lp" // LTail http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:ltail LTail Attr = "ltail" // LWidth http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:lwidth LWidth Attr = "lwidth" // Margin http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:margin Margin Attr = "margin" // MaxIter http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:maxiter MaxIter Attr = "maxiter" // MCLimit http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mclimit MCLimit Attr = "mclimit" // MinDist http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mindist MinDist Attr = "mindist" // MinLen http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mindist MinLen Attr = "minlen" // Mode http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mode Mode Attr = "mode" // Model http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:model Model Attr = "model" // Mosek http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mosek Mosek Attr = "mosek" // NewRank http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:newrank NewRank Attr = "newrank" // NodeSep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nodesep NodeSep Attr = "nodesep" // NoJustify http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nojustify NoJustify Attr = "nojustify" // Normalize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:normalize Normalize Attr = "normalize" // NoTranslate http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:notranslate NoTranslate Attr = "notranslate" // NSLimit http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nslimit NSLimit Attr = "nslimit" // NSLimit1 http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nslimit1 NSLimit1 Attr = "nslimit1" // Ordering http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nslimit1 Ordering Attr = "ordering" // Orientation http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:orientation Orientation Attr = "orientation" // OutputOrder http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:outputorder OutputOrder Attr = "outputorder" // Overlap http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:overlap Overlap Attr = "overlap" // OverlapScaling http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:overlap_scaling OverlapScaling Attr = "overlap_scaling" // OverlapShrink http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:overlap_shrink OverlapShrink Attr = "overlap_shrink" // Pack http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pack Pack Attr = "pack" // PackMode http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:packmode PackMode Attr = "packmode" // Pad http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pad Pad Attr = "pad" // Page http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:page Page Attr = "page" // PageDir http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pagedir PageDir Attr = "pagedir" // PenColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pencolor PenColor Attr = "pencolor" // PenWidth http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:penwidth PenWidth Attr = "penwidth" // Peripheries http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:peripheries Peripheries Attr = "peripheries" // Pin http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:peripheries Pin Attr = "pin" // Pos http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pos Pos Attr = "pos" // QuadTree http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:quadtree QuadTree Attr = "quadtree" // Quantum http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:quantum Quantum Attr = "quantum" // Rank http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rank Rank Attr = "rank" // RankDir http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rankdir RankDir Attr = "rankdir" // RankSep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:ranksep RankSep Attr = "ranksep" // Ratio http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:ratio Ratio Attr = "ratio" // Rects http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rects Rects Attr = "rects" // Regular http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:regular Regular Attr = "regular" // ReMinCross http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:remincross ReMinCross Attr = "remincross" // RepulsiveForce http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:repulsiveforce RepulsiveForce Attr = "repulsiveforce" // Resolution http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:resolution Resolution Attr = "resolution" // Root http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:root Root Attr = "root" // Rotate http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rotate Rotate Attr = "rotate" // Rotation http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rotation Rotation Attr = "rotation" // SameHead http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:samehead SameHead Attr = "samehead" // SameTail http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:sametail SameTail Attr = "sametail" // SamplePoints http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:samplepoints SamplePoints Attr = "samplepoints" // Scale http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:scale Scale Attr = "scale" // SearchSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:searchsize SearchSize Attr = "searchsize" // Sep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:sep Sep Attr = "sep" // Shape http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:shape Shape Attr = "shape" // ShapeFile http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:shapefile ShapeFile Attr = "shapefile" // ShowBoxes http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:showboxes ShowBoxes Attr = "showboxes" // Sides http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:sides Sides Attr = "sides" // Size http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:size Size Attr = "size" // Skew http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:skew Skew Attr = "skew" // Smoothing http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:smoothing Smoothing Attr = "smoothing" // SortV http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:sortv SortV Attr = "sortv" // Splines http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:splines Splines Attr = "splines" // Start http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:start Start Attr = "start" // Style http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:style Style Attr = "style" // StyleSheet http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:stylesheet StyleSheet Attr = "stylesheet" // TailURL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailURL TailURL Attr = "tailURL" // TailLP http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tail_lp TailLP Attr = "tail_lp" // TailClip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailclip TailClip Attr = "tailclip" // TailHREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailhref TailHREF Attr = "tailhref" // TailLabel http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:taillabel TailLabel Attr = "taillabel" // TailPort http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailport TailPort Attr = "tailport" // TailTarget http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailtarget TailTarget Attr = "tailtarget" // TailTooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailtooltip TailTooltip Attr = "tailtooltip" // Target http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:target Target Attr = "target" // Tooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tooltip Tooltip Attr = "tooltip" // TrueColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tooltip TrueColor Attr = "truecolor" // Vertices http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:vertices Vertices Attr = "vertices" // ViewPort http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:viewport ViewPort Attr = "viewport" // VoroMargin http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:voro_margin VoroMargin Attr = "voro_margin" // Weight http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:weight Weight Attr = "weight" // Width http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:width Width Attr = "width" // XDotVersion http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:xdotversion XDotVersion Attr = "xdotversion" // XLabel http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:xlabel XLabel Attr = "xlabel" // XLP http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:xlp XLP Attr = "xlp" // Z http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:z Z Attr = "z" // MinCross is not in the documentation, but found in the Ped_Lion_Share (lion_share.gv.txt) example MinCross Attr = "mincross" // SSize is not in the documentation, but found in the siblings.gv.txt example SSize Attr = "ssize" // Outline is not in the documentation, but found in the siblings.gv.txt example Outline Attr = "outline" // F is not in the documentation, but found in the transparency.gv.txt example F Attr = "f" )
type Attrs ¶
Attrs represents attributes for an Edge, Node or Graph.
type Edges ¶
type Edges struct { SrcToDsts map[string]map[string][]*Edge DstToSrcs map[string]map[string][]*Edge Edges []*Edge }
Edges represents a set of Edges.
type Escape ¶
type Escape struct {
*Graph
}
Escape is just a Graph that escapes some strings when required.
func NewEscape ¶
func NewEscape() *Escape
NewEscape returns a graph which will try to escape some strings when required
func (*Escape) AddAttr ¶
AddAttr adds an attribute and escapes the parentGraph, field and value, if needed.
func (*Escape) AddNode ¶
AddNode adds a node and escapes the parentGraph, name and attrs, if needed.
func (*Escape) AddPortEdge ¶
func (escape *Escape) AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error
AddPortEdge adds an edge with ports and escapes the src, dst and attrs, if needed.
func (*Escape) AddSubGraph ¶
AddSubGraph adds a subgraph and escapes the parentGraph, name and attrs, if needed.
func (*Escape) IsSubGraph ¶
IsSubGraph returns whether the, escaped if needed, name is a subgraph in the grahp.
type Graph ¶
type Graph struct { Attrs Attrs Name string Directed bool Strict bool Nodes *Nodes Edges *Edges SubGraphs *SubGraphs Relations *Relations }
Graph is the analysed representation of the Graph parsed from the DOT format.
func NewAnalysedGraph ¶
NewAnalysedGraph creates a Graph structure by analysing an Abstract Syntax Tree representing a parsed graph.
func NewGraph ¶
func NewGraph() *Graph
NewGraph creates a new empty graph, ready to be populated.
Example ¶
g := NewGraph() if err := g.SetName("G"); err != nil { panic(err) } if err := g.SetDir(true); err != nil { panic(err) } if err := g.AddNode("G", "Hello", nil); err != nil { panic(err) } if err := g.AddNode("G", "World", nil); err != nil { panic(err) } if err := g.AddEdge("Hello", "World", true, nil); err != nil { panic(err) } s := g.String() fmt.Println(s)
Output: digraph G { Hello->World; Hello; World; }
func Read ¶
Read parses and creates a new Graph from the data.
Example ¶
g, err := Read([]byte(`digraph G {Hello->World}`)) if err != nil { panic(err) } s := g.String() fmt.Println(s)
Output: digraph G { Hello->World; Hello; World; }
func (*Graph) AddEdge ¶
AddEdge adds an edge to the graph from node src to node dst. This does not imply the adding of missing nodes. If directed is set to true then SetDir(true) must also be called or there will be a syntax error in the output.
func (*Graph) AddNode ¶
AddNode adds a node to a graph/subgraph. If not subgraph exists use the name of the main graph. This does not imply the adding of a missing subgraph.
func (*Graph) AddPortEdge ¶
func (g *Graph) AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error
AddPortEdge adds an edge to the graph from node src to node dst. srcPort and dstPort are the port the node ports, leave as empty strings if it is not required. This does not imply the adding of missing nodes.
func (*Graph) AddSubGraph ¶
AddSubGraph adds a subgraph to a graph/subgraph.
func (*Graph) IsSubGraph ¶
IsSubGraph returns whether a given subgraph name exists as a subgraph in the graph.
func (*Graph) RemoveNode ¶
RemoveNode removes a node from the graph
func (*Graph) RemoveSubGraph ¶
RemoveSubGraph removes the subgraph including nodes
func (*Graph) SetStrict ¶
SetStrict sets whether a graph is strict. If the graph is strict then multiple edges are not allowed between the same pairs of nodes, see dot man page.
type Interface ¶
type Interface interface { SetStrict(strict bool) error SetDir(directed bool) error SetName(name string) error AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error AddEdge(src, dst string, directed bool, attrs map[string]string) error AddNode(parentGraph string, name string, attrs map[string]string) error AddAttr(parentGraph string, field, value string) error AddSubGraph(parentGraph string, name string, attrs map[string]string) error String() string }
Interface allows you to parse the graph into your own structure.
type Nodes ¶
Nodes represents a set of Nodes.
type Relations ¶
type Relations struct { ParentToChildren map[string]map[string]bool ChildToParents map[string]map[string]bool }
Relations represents the relations between graphs and nodes. Each node belongs the main graph or a subgraph.
func (*Relations) SortedChildren ¶
SortedChildren returns a list of sorted children of the given parent graph.