package graphfmt
import "golang.org/x/tools/internal/graph/graphfmt"
Package graphfmt serializes graphs to external representations.
Index ¶
- type Dot
- func (d Dot[NodeID]) SVG(w io.Writer, g graph.Graph[NodeID]) error
- func (d Dot[NodeID]) Sprint(g graph.Graph[NodeID]) string
- type DotAttr
- type DotCluster
- type DotLiteral
Types ¶
type Dot ¶
type Dot[NodeID comparable] struct { // Name is the name given to the graph. Usually this can be // left blank. Name string // Label returns the string to use as a label for the given // node. If nil, nodes are labeled with their node numbers. Label func(node NodeID) string // NodeAttrs, if non-nil, returns a set of attributes for a // node. If this includes a "label" attribute, it overrides // the label returned by Label. NodeAttrs func(node NodeID) []DotAttr // EdgeAttrs, if non-nil, returns a set of attributes for an // edge. EdgeAttrs func(from, to NodeID) []DotAttr // ClusterOf, if non-nil, returns the cluster of a node, or nil if the node // should not be in a cluster. Multiple nodes with the same cluster will be // arranged together and enclosed in a box. ClusterOf func(node NodeID) *DotCluster }
Dot contains options for generating a Graphviz Dot graph from a graph.Graph.
func (Dot[NodeID]) SVG ¶
SVG attempts to render g to an SVG.
func (Dot[NodeID]) Sprint ¶
Sprint returns the Dot form of g as a string.
type DotAttr ¶
type DotAttr struct {
Name string
// Val is the value of this attribute. It may be a string
// (which will be escaped), bool, int, uint, float64 or
// DotLiteral.
Val any
}
DotAttr is an attribute for a Dot node or edge.
type DotCluster ¶
DotCluster represents a cluster of nodes arranged together.
type DotLiteral ¶
type DotLiteral string
DotLiteral is a string literal that should be passed to dot unescaped.
Source Files ¶
dot.go
- Version
- v0.44.0 (latest)
- Published
- Apr 9, 2026
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 hour ago –
Tools for package owners.