@@ -8,57 +8,57 @@ import (
88
99type dotVizer struct {}
1010
11- // DotGraph represents a graph in DOT format
12- type DotGraph struct {
11+ // dotGraph represents a graph in DOT format
12+ type dotGraph struct {
1313 name string
1414 isSubgraph bool
15- nodes map [string ]* DotNode
16- edges []* DotEdge
15+ nodes map [string ]* dotNode
16+ edges []* dotEdge
1717 attributes map [string ]string
18- subgraphs []* DotGraph
18+ subgraphs []* dotGraph
1919 indent string
2020}
2121
22- // DotNode represents a node in DOT format
23- type DotNode struct {
22+ // dotNode represents a node in DOT format
23+ type dotNode struct {
2424 id string
2525 attributes map [string ]string
2626}
2727
28- // DotEdge represents an edge in DOT format
29- type DotEdge struct {
30- from * DotNode
31- to * DotNode
28+ // dotEdge represents an edge in DOT format
29+ type dotEdge struct {
30+ from * dotNode
31+ to * dotNode
3232 attributes map [string ]string
3333}
3434
35- func newDotGraph (name string ) * DotGraph {
36- return & DotGraph {
35+ func newDotGraph (name string ) * dotGraph {
36+ return & dotGraph {
3737 name : name ,
3838 isSubgraph : false ,
39- nodes : make (map [string ]* DotNode ),
40- edges : make ([]* DotEdge , 0 ),
39+ nodes : make (map [string ]* dotNode ),
40+ edges : make ([]* dotEdge , 0 ),
4141 attributes : make (map [string ]string ),
42- subgraphs : make ([]* DotGraph , 0 ),
42+ subgraphs : make ([]* dotGraph , 0 ),
4343 indent : "" ,
4444 }
4545}
4646
47- func (g * DotGraph ) CreateNode (name string ) * DotNode {
47+ func (g * dotGraph ) CreateNode (name string ) * dotNode {
4848 if node , exists := g .nodes [name ]; exists {
4949 return node
5050 }
5151
52- node := & DotNode {
52+ node := & dotNode {
5353 id : name ,
5454 attributes : make (map [string ]string ),
5555 }
5656 g .nodes [name ] = node
5757 return node
5858}
5959
60- func (g * DotGraph ) CreateEdge (from , to * DotNode , label string ) * DotEdge {
61- edge := & DotEdge {
60+ func (g * dotGraph ) CreateEdge (from , to * dotNode , label string ) * dotEdge {
61+ edge := & dotEdge {
6262 from : from ,
6363 to : to ,
6464 attributes : make (map [string ]string ),
@@ -70,21 +70,21 @@ func (g *DotGraph) CreateEdge(from, to *DotNode, label string) *DotEdge {
7070 return edge
7171}
7272
73- func (g * DotGraph ) SubGraph (name string ) * DotGraph {
74- subgraph := & DotGraph {
73+ func (g * dotGraph ) SubGraph (name string ) * dotGraph {
74+ subgraph := & dotGraph {
7575 name : name ,
7676 isSubgraph : true ,
77- nodes : make (map [string ]* DotNode ),
78- edges : make ([]* DotEdge , 0 ),
77+ nodes : make (map [string ]* dotNode ),
78+ edges : make ([]* dotEdge , 0 ),
7979 attributes : make (map [string ]string ),
80- subgraphs : make ([]* DotGraph , 0 ),
80+ subgraphs : make ([]* dotGraph , 0 ),
8181 indent : g .indent + " " ,
8282 }
8383 g .subgraphs = append (g .subgraphs , subgraph )
8484 return subgraph
8585}
8686
87- func (g * DotGraph ) String () string {
87+ func (g * dotGraph ) String () string {
8888 var sb strings.Builder
8989
9090 if g .isSubgraph {
@@ -113,7 +113,7 @@ func (g *DotGraph) String() string {
113113 return sb .String ()
114114}
115115
116- func (node * DotNode ) Format (indent string ) string {
116+ func (node * dotNode ) Format (indent string ) string {
117117 attrs := formatAttributes (node .attributes )
118118
119119 if attrs == "" {
@@ -123,7 +123,7 @@ func (node *DotNode) Format(indent string) string {
123123 return indent + quote (node .id ) + " [" + attrs + "];\n "
124124}
125125
126- func (edge * DotEdge ) Format (indent string ) string {
126+ func (edge * dotEdge ) Format (indent string ) string {
127127 from := edge .from .id
128128 to := edge .to .id
129129
@@ -153,11 +153,11 @@ func formatAttributes(attrs map[string]string) string {
153153}
154154
155155// visualizeG recursively visualizes the graph and its subgraphs in DOT format
156- func (v * dotVizer ) visualizeG (g * eGraph , parentGraph * DotGraph ) error {
156+ func (v * dotVizer ) visualizeG (g * eGraph , parentGraph * dotGraph ) error {
157157 graph := parentGraph
158158 graph .attributes ["rankdir" ] = "LR"
159159
160- nodeMap := make (map [string ]* DotNode )
160+ nodeMap := make (map [string ]* dotNode )
161161
162162 for _ , node := range g .nodes {
163163 color := "black"
0 commit comments