gorgonia.org/gorgonia@v0.9.17/encoding/dot/graph.go (about) 1 package dot 2 3 import ( 4 "gonum.org/v1/gonum/graph" 5 "gonum.org/v1/gonum/graph/encoding" 6 gonumDot "gonum.org/v1/gonum/graph/encoding/dot" 7 ) 8 9 // This structures handles the toplevel graph attributes 10 type dotGraph struct { 11 graph.Directed 12 subs []gonumDot.Graph 13 } 14 15 // DOTAttributers to specify the top-level graph attributes for the graphviz generation 16 func (g dotGraph) DOTAttributers() (graph, node, edge encoding.Attributer) { 17 // Create a special attribute "rank" to place the input at the same level in the graph 18 19 graphAttributes := attributer{ 20 encoding.Attribute{ 21 Key: "rankdir", 22 Value: "TB", 23 }, 24 } 25 nodeAttributes := attributer{ 26 encoding.Attribute{ 27 Key: "style", 28 Value: "rounded", 29 }, 30 encoding.Attribute{ 31 Key: "fontsize", 32 Value: "10", 33 }, 34 encoding.Attribute{ 35 Key: "shape", 36 Value: "none", 37 }, 38 } 39 return graphAttributes, nodeAttributes, attributer{} 40 } 41 42 // Structure fulfils the dot.Structurer interface. 43 func (g dotGraph) Structure() []gonumDot.Graph { 44 return g.subs 45 }