gographviz: github.com/awalterschulze/gographviz Index | Examples | Files | Directories

package gographviz

import "github.com/awalterschulze/gographviz"

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.



Package Files

analyse.go attr.go attrs.go catch.go edges.go escape.go gographviz.go graph.go nodes.go relations.go subgraphs.go write.go

func Analyse Uses

func Analyse(graph *ast.Graph, g Interface) error

Analyse analyses an Abstract Syntax Tree representing a parsed graph into a newly created graph structure Interface.

func Parse Uses

func Parse(buf []byte) (*ast.Graph, error)

Parse parses the buffer into a abstract syntax tree representing the graph.

func ParseString Uses

func ParseString(buf string) (*ast.Graph, error)

ParseString parses the buffer into a abstract syntax tree representing the graph.

type Attr Uses

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"
    // 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"

func NewAttr Uses

func NewAttr(key string) (Attr, error)

NewAttr creates a new attribute key by checking whether it is a valid key

type Attrs Uses

type Attrs map[Attr]string

Attrs represents attributes for an Edge, Node or Graph.

func NewAttrs Uses

func NewAttrs(m map[string]string) (Attrs, error)

NewAttrs creates an empty Attributes type.

func (Attrs) Add Uses

func (attrs Attrs) Add(field string, value string) error

Add adds an attribute name and value.

func (Attrs) Ammend Uses

func (attrs Attrs) Ammend(more Attrs)

Ammend only adds the missing attributes to attrs Attrs type.

func (Attrs) Copy Uses

func (attrs Attrs) Copy() Attrs

Copy returns a copy of the attributes map

func (Attrs) Extend Uses

func (attrs Attrs) Extend(more Attrs)

Extend adds the attributes into attrs Attrs type overwriting duplicates.

type Edge Uses

type Edge struct {
    Src     string
    SrcPort string
    Dst     string
    DstPort string
    Dir     bool
    Attrs   Attrs

Edge represents an Edge.

type Edges Uses

type Edges struct {
    SrcToDsts map[string]map[string][]*Edge
    DstToSrcs map[string]map[string][]*Edge
    Edges     []*Edge

Edges represents a set of Edges.

func NewEdges Uses

func NewEdges() *Edges

NewEdges creates a blank set of Edges.

func (*Edges) Add Uses

func (edges *Edges) Add(edge *Edge)

Add adds an Edge to the set of Edges.

func (Edges) Sorted Uses

func (edges Edges) Sorted() []*Edge

Sorted returns a sorted list of Edges.

type Escape Uses

type Escape struct {

Escape is just a Graph that escapes some strings when required.

func NewEscape Uses

func NewEscape() *Escape

NewEscape returns a graph which will try to escape some strings when required

func (*Escape) AddAttr Uses

func (escape *Escape) AddAttr(parentGraph string, field, value string) error

AddAttr adds an attribute and escapes the parentGraph, field and value, if needed.

func (*Escape) AddEdge Uses

func (escape *Escape) AddEdge(src, dst string, directed bool, attrs map[string]string) error

AddEdge adds an edge and escapes the src, dst and attrs, if needed.

func (*Escape) AddNode Uses

func (escape *Escape) AddNode(parentGraph string, name string, attrs map[string]string) error

AddNode adds a node and escapes the parentGraph, name and attrs, if needed.

func (*Escape) AddPortEdge Uses

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 Uses

func (escape *Escape) AddSubGraph(parentGraph string, name string, attrs map[string]string) error

AddSubGraph adds a subgraph and escapes the parentGraph, name and attrs, if needed.

func (*Escape) IsNode Uses

func (escape *Escape) IsNode(name string) bool

IsNode returns whether the, escaped if needed, name is a node in the graph.

func (*Escape) IsSubGraph Uses

func (escape *Escape) IsSubGraph(name string) bool

IsSubGraph returns whether the, escaped if needed, name is a subgraph in the grahp.

func (*Escape) SetName Uses

func (escape *Escape) SetName(name string) error

SetName sets the graph name and escapes it, if needed.

type Graph Uses

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 Uses

func NewAnalysedGraph(graph *ast.Graph) (*Graph, error)

NewAnalysedGraph creates a Graph structure by analysing an Abstract Syntax Tree representing a parsed graph.

func NewGraph Uses

func NewGraph() *Graph

NewGraph creates a new empty graph, ready to be populated.


g := NewGraph()
if err := g.SetName("G"); err != nil {
if err := g.SetDir(true); err != nil {
if err := g.AddNode("G", "Hello", nil); err != nil {
if err := g.AddNode("G", "World", nil); err != nil {
if err := g.AddEdge("Hello", "World", true, nil); err != nil {
s := g.String()


digraph G {


func Read Uses

func Read(buf []byte) (*Graph, error)

Read parses and creates a new Graph from the data.


g, err := Read([]byte(`digraph G {Hello->World}`))
if err != nil {
s := g.String()


digraph G {


func (*Graph) AddAttr Uses

func (g *Graph) AddAttr(parentGraph string, field string, value string) error

AddAttr adds an attribute to a graph/subgraph.

func (*Graph) AddEdge Uses

func (g *Graph) AddEdge(src, dst string, directed bool, attrs map[string]string) error

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 Uses

func (g *Graph) AddNode(parentGraph string, name string, attrs map[string]string) error

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 Uses

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 Uses

func (g *Graph) AddSubGraph(parentGraph string, name string, attrs map[string]string) error

AddSubGraph adds a subgraph to a graph/subgraph.

func (*Graph) IsNode Uses

func (g *Graph) IsNode(name string) bool

IsNode returns whether a given node name exists as a node in the graph.

func (*Graph) IsSubGraph Uses

func (g *Graph) IsSubGraph(name string) bool

IsSubGraph returns whether a given subgraph name exists as a subgraph in the graph.

func (*Graph) RemoveNode Uses

func (g *Graph) RemoveNode(parentGraph string, name string) error

RemoveNode removes a node from the graph

func (*Graph) RemoveSubGraph Uses

func (g *Graph) RemoveSubGraph(parentGraph string, name string) error

RemoveSubGraph removes the subgraph including nodes

func (*Graph) SetDir Uses

func (g *Graph) SetDir(dir bool) error

SetDir sets whether the graph is directed (true) or undirected (false).

func (*Graph) SetName Uses

func (g *Graph) SetName(name string) error

SetName sets the graph name.

func (*Graph) SetStrict Uses

func (g *Graph) SetStrict(strict bool) error

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.

func (*Graph) String Uses

func (g *Graph) String() string

String returns a DOT string representing the Graph.

func (*Graph) WriteAst Uses

func (g *Graph) WriteAst() (*ast.Graph, error)

WriteAst creates an Abstract Syntrax Tree from the Graph.

type Interface Uses

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 Node Uses

type Node struct {
    Name  string
    Attrs Attrs

Node represents a Node.

type Nodes Uses

type Nodes struct {
    Lookup map[string]*Node
    Nodes  []*Node

Nodes represents a set of Nodes.

func NewNodes Uses

func NewNodes() *Nodes

NewNodes creates a new set of Nodes.

func (*Nodes) Add Uses

func (nodes *Nodes) Add(node *Node)

Add adds a Node to the set of Nodes, extending the attributes of an already existing node.

func (*Nodes) Remove Uses

func (nodes *Nodes) Remove(name string) error

Remove removes a node

func (Nodes) Sorted Uses

func (nodes Nodes) Sorted() []*Node

Sorted returns a sorted list of nodes.

type Relations Uses

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 NewRelations Uses

func NewRelations() *Relations

NewRelations creates an empty set of relations.

func (*Relations) Add Uses

func (relations *Relations) Add(parent string, child string)

Add adds a node to a parent graph.

func (*Relations) Remove Uses

func (relations *Relations) Remove(parent string, child string)

Remove removes relation

func (*Relations) SortedChildren Uses

func (relations *Relations) SortedChildren(parent string) []string

SortedChildren returns a list of sorted children of the given parent graph.

type SubGraph Uses

type SubGraph struct {
    Attrs Attrs
    Name  string

SubGraph represents a Subgraph.

func NewSubGraph Uses

func NewSubGraph(name string) *SubGraph

NewSubGraph creates a new Subgraph.

type SubGraphs Uses

type SubGraphs struct {
    SubGraphs map[string]*SubGraph

SubGraphs represents a set of SubGraphs.

func NewSubGraphs Uses

func NewSubGraphs() *SubGraphs

NewSubGraphs creates a new blank set of SubGraphs.

func (*SubGraphs) Add Uses

func (subgraphs *SubGraphs) Add(name string)

Add adds and creates a new Subgraph to the set of SubGraphs.

func (*SubGraphs) Remove Uses

func (subgraphs *SubGraphs) Remove(name string)

Remove removes a subgraph

func (*SubGraphs) Sorted Uses

func (subgraphs *SubGraphs) Sorted() []*SubGraph

Sorted returns a sorted list of SubGraphs.


astAbstract Syntax Tree representing the DOT grammar
internal/parserA parser for the DOT grammar.

Package gographviz imports 7 packages (graph) and is imported by 97 packages. Updated 2020-06-27. Refresh now. Tools for package owners.