MCPcopy Index your code
hub / github.com/coder/coder / ToDOT

Method ToDOT

agent/unit/graph.go:159–174  ·  view source on GitHub ↗

ToDOT exports the graph to DOT format for visualization

(name string)

Source from the content-addressed store, hash-verified

157
158// ToDOT exports the graph to DOT format for visualization
159func (g *Graph[EdgeType, VertexType]) ToDOT(name string) (string, error) {
160 g.mu.RLock()
161 defer g.mu.RUnlock()
162
163 if g.gonumGraph == nil {
164 return "", xerrors.New("graph is not initialized")
165 }
166
167 // Marshal the graph to DOT format
168 dotBytes, err := dot.Marshal(g.gonumGraph, name, "", " ")
169 if err != nil {
170 return "", xerrors.Errorf("failed to marshal graph to DOT: %w", err)
171 }
172
173 return string(dotBytes), nil
174}

Callers 3

assertDOTGraphFunction · 0.80
TestGraphThreadSafetyFunction · 0.80
ExportDOTMethod · 0.80

Calls 3

NewMethod · 0.65
MarshalMethod · 0.45
ErrorfMethod · 0.45

Tested by 2

assertDOTGraphFunction · 0.64
TestGraphThreadSafetyFunction · 0.64