pax_global_header 0000666 0000000 0000000 00000000064 14607264606 0014525 g ustar 00root root 0000000 0000000 52 comment=63b45f4bc1c03d491c59fd6cad5c54ce816819ef
dot-1.6.2/ 0000775 0000000 0000000 00000000000 14607264606 0012321 5 ustar 00root root 0000000 0000000 dot-1.6.2/.gitignore 0000664 0000000 0000000 00000000104 14607264606 0014304 0 ustar 00root root 0000000 0000000 /*.dot
/dotx/*.dot
/dotx/*.svg
/dotx/*.png
/*.png
.idea
coverage.out dot-1.6.2/.travis.yml 0000664 0000000 0000000 00000000321 14607264606 0014426 0 ustar 00root root 0000000 0000000 language: go
matrix:
include:
- go: "1.11.x"
script:
- go test -race -coverprofile=coverage.txt -covermode=atomic
after_success:
- bash <(curl -s https://codecov.io/bash)
env:
- GO111MODULE=on
dot-1.6.2/CHANGES.md 0000664 0000000 0000000 00000003201 14607264606 0013707 0 ustar 00root root 0000000 0000000 # Change history of the dot package
## v1.6.2
- fix issue #38 : incorrect handling of strict option (thx kiambogo)
## v1.6.1 - 2024-01-17
- deprecated MermaidShapeCirle => use MermaidShapeCircle
## v1.6.0 - 2023-07-30
- add Record builder
## v1.5.0 - 2023-06-20
- add GetID on Graph
## v1.4.0 - 2023-03-28
- add Composite extension
## v1.3.0 - 2023-02-21
- Escape/quote mermaid
- add FindNodeWithLabel
## v1.2.0 - 2022-11-18
- add BidirectionalEdge #28
## v1.1.0 - 2022-11-07
- add support for Mermaid graph out.
## v1.0.0 - 2022-06-22
- add support for port, see https://github.com/emicklei/dot/pull/25 (thx v-electrolux)
## v0.16.0 - 2021-05-04
- add DeleteNote, see https://github.com/emicklei/dot/pull/24
## v0.15.0 - 2020-10-30
- add Node initializer, see Issue #15
- add Edge initializer
## v0.14.0 - 2020-08-25
- add Attrs for conveniently adding multiple label=value attribute pairs.
## v0.13.0 - 2020-08-22
- add FindSubgraph
## v0.12.0 - 2020-08-20
- Added style methods to Edge to easily add bold,dotted and dashed lines. (#21)
## v0.11.0 - 2020-05-16
- add functionality to find node by id
- add function to find all nodes of a graph
## v0.10.2 - 2020-01-31
- Fix indexing subgraphs by label ; must use id. Issue #16
- Add Label(newLabel) to Graph
- Add Delete(key) to AttributesMap
- Use internal ids for subgraphs
## v0.10.0
- Allow setting same rank for a group of nodes
- Introduce Literal attribute type
- Introduce Node.Label(string) function
## v0.9.2 and earlier
- Add support for HTML attributes.
- fixed undirected transitions
- Change how node is printed, so that attributes only affect individual node
dot-1.6.2/LICENSE 0000664 0000000 0000000 00000002051 14607264606 0013324 0 ustar 00root root 0000000 0000000 Copyright(c) Ernest Micklei
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
dot-1.6.2/README.md 0000664 0000000 0000000 00000005705 14607264606 0013607 0 ustar 00root root 0000000 0000000 ## dot - little helper package in Go for the graphviz dot language
[](https://goreportcard.com/report/github.com/emicklei/dot)
[](https://pkg.go.dev/github.com/emicklei/dot)
[](https://codecov.io/gh/emicklei/dot)
[DOT language](http://www.graphviz.org/doc/info/lang.html)
package main
import (
"fmt"
"github.com/emicklei/dot"
)
// go run main.go | dot -Tpng > test.png && open test.png
func main() {
g := dot.NewGraph(dot.Directed)
n1 := g.Node("coding")
n2 := g.Node("testing a little").Box()
g.Edge(n1, n2)
g.Edge(n2, n1, "back").Attr("color", "red")
fmt.Println(g.String())
}
Output
digraph {
node [label="coding"]; n1;
node [label="testing a little",shape="box"]; n2;
n1 -> n2;
n2 -> n1 [color="red", label="back"];
}
Chaining edges
g.Node("A").Edge(g.Node("B")).Edge(g.Node("C"))
A -> B -> C
g.Node("D").BidirectionalEdge(g.Node("E"))
D <-> E
Subgraphs
s := g.Subgraph("cluster")
s.Attr("style", "filled")
Initializers
g := dot.NewGraph(dot.Directed)
g.NodeInitializer(func(n dot.Node) {
n.Attr("shape", "rectangle")
n.Attr("fontname", "arial")
n.Attr("style", "rounded,filled")
})
g.EdgeInitializer(func(e dot.Edge) {
e.Attr("fontname", "arial")
e.Attr("fontsize", "9")
e.Attr("arrowsize", "0.8")
e.Attr("arrowhead", "open")
})
HTML and Literal values
node.Attr("label", Literal(`"left-justified text\l"`))
graph.Attr("label", HTML("Hi"))
## cluster example

di := dot.NewGraph(dot.Directed)
outside := di.Node("Outside")
// A
clusterA := di.Subgraph("Cluster A", dot.ClusterOption{})
insideOne := clusterA.Node("one")
insideTwo := clusterA.Node("two")
// B
clusterB := di.Subgraph("Cluster B", dot.ClusterOption{})
insideThree := clusterB.Node("three")
insideFour := clusterB.Node("four")
// edges
outside.Edge(insideFour).Edge(insideOne).Edge(insideTwo).Edge(insideThree).Edge(outside)
See also `ext/Subsystem` type for creating composition hierarchies.
## record example
See `record_test.go#ExampleNode_NewRecordBuilder`.
## About dot attributes
https://graphviz.gitlab.io/doc/info/attrs.html
## display your graph
go run main.go | dot -Tpng > test.png && open test.png
## mermaid
Output a dot Graph using the [mermaid](https://mermaid-js.github.io/mermaid/#/README) syntax.
Only Graph and Flowchart are supported. See MermaidGraph and MermaidFlowchart.
```
g := dot.NewGraph(dot.Directed)
...
fmt.Println(dot.MermaidGraph(g, dot.MermaidTopToBottom))
```
## extensions
See also package `dot/dotx` for types that can help in constructing complex graphs.

### testing
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
(c) 2015-2023, http://ernestmicklei.com. MIT License.
dot-1.6.2/attr.go 0000664 0000000 0000000 00000003223 14607264606 0013622 0 ustar 00root root 0000000 0000000 package dot
// HTML renders the provided content as graphviz HTML. Use of this
// type is only valid for some attributes, like the 'label' attribute.
type HTML string
// Literal renders the provided value as is, without adding enclosing
// quotes, escaping newlines, quotations marks or any other characters.
// For example:
//
// node.Attr("label", Literal(`"left-justified text\l"`))
//
// allows you to left-justify the label (due to the \l at the end).
// The caller is responsible for enclosing the value in quotes and for
// proper escaping of special characters.
type Literal string
// AttributesMap holds attribute=value pairs.
type AttributesMap struct {
attributes map[string]interface{}
}
// Attrs sets multiple values for attributes (unless empty) taking a label,value list
// E.g Attrs("style","filled","fillcolor","red")
func (a AttributesMap) Attrs(labelvalues ...interface{}) {
if len(labelvalues)%2 != 0 {
panic("missing label or value ; must provide pairs")
}
for i := 0; i < len(labelvalues); i += 2 {
label := labelvalues[i].(string)
value := labelvalues[i+1]
a.Attr(label, value)
}
}
// Attr sets the value for an attribute (unless empty).
func (a AttributesMap) Attr(label string, value interface{}) {
if len(label) == 0 || value == nil {
return
}
if s, ok := value.(string); ok {
if len(s) > 0 {
a.attributes[label] = s
return
}
}
a.attributes[label] = value
}
// Value return the value added for this label.
func (a AttributesMap) Value(label string) interface{} {
return a.attributes[label]
}
// Delete removes the attribute value at key, if any
func (a AttributesMap) Delete(key string) {
delete(a.attributes, key)
}
dot-1.6.2/attr_test.go 0000664 0000000 0000000 00000001466 14607264606 0014670 0 ustar 00root root 0000000 0000000 package dot
import "testing"
func TestAttributesMap_Attrs(t *testing.T) {
g := NewGraph()
g.Attrs("l", "v", "l2", "v2")
if got, want := g.attributes["l"], "v"; got != want {
t.Errorf("got [%v:%T] want [%v:%T]", got, got, want, want)
}
if got, want := g.attributes["l2"], "v2"; got != want {
t.Errorf("got [%v:%T] want [%v:%T]", got, got, want, want)
}
}
func TestAttributesMap_AttrsMissingValue(t *testing.T) {
caught := false
defer func() {
if r := recover(); r != nil {
caught = true
}
}()
NewGraph().Attrs("l", "v", "l2")
if !caught {
t.Fail()
}
}
func TestAttributesMap_EmptyKey_NilValue(t *testing.T) {
g := NewGraph()
g.Attr("", "skip")
novalue := interface{}(nil)
if got, want := g.Value(""), novalue; got != want {
t.Errorf("got [%v:%T] want [%v:%T]", got, got, want, want)
}
}
dot-1.6.2/doc.go 0000664 0000000 0000000 00000000411 14607264606 0013411 0 ustar 00root root 0000000 0000000 // Package dot is a helper for producing graphs in DOT format (graphviz).
// It offers Graph,Node and Edge objects to construct simple and complex (e.g. nested) graphs.
//
// Copyright (c) Ernest Micklei. MIT License
package dot // import "github.com/emicklei/dot"
dot-1.6.2/doc/ 0000775 0000000 0000000 00000000000 14607264606 0013066 5 ustar 00root root 0000000 0000000 dot-1.6.2/doc/TestExampleSubsystemExternalGraph.svg 0000664 0000000 0000000 00000005030 14607264606 0022444 0 ustar 00root root 0000000 0000000
dot-1.6.2/doc/TestExampleSubsystemSameGraph.png 0000664 0000000 0000000 00000126321 14607264606 0021543 0 ustar 00root root 0000000 0000000 PNG
IHDR ] * R bKGD IDATxwXTg7RUA)b& bWDĂX7lm-YF͚Dqc7XE4",b2 e9:\WS30ys#`1B!&% B!w.B!5E!!BԀB!BP"BQ
]B!j@B!D
(tB!.B!5E!!BԀB!BP"BQqCVi_XB!Mo߾X`ewXB
ƪBit|@HB xxxСCQ!$.E!!BԀB!BP"BQ
]B!j@z*..DZzjK!P">3gb|B!EH=M6
{ٳ!.B@$A /bٲeBH5xDzBZ2.]7oB$^^^8y$=z]]]̜9R{L&D"Apppm]v
gΜ#Ə}\p ---7ZZZqadd1cƼqH@ `۶m055? 33Ȁ'
SZZǏcAxx8H$³gp BA__`
Bx|rcc111O><{{{֥KuQQg}]2???lmm }0{{{=zH.\ӓHcŋl֬Y,..1]]]6w\cQQQ{ ۸q#={6[d kӦ
?~<۱c2e
8q"߿eBGW9EYJ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