Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DotEdgeSpec ¶
type DotEdgeSpec struct { FromNodeName string ToNodeName string Tooltip string Style string Color string }
DotEdgeSpec is the specification for an edge in DOT graph
type DotNodeSpec ¶
type DotNodeSpec struct { // id of the node Name string // display text of the node DisplayName string Tooltip string Shape string Style string FillColor string }
DotNodeSpec is the specification for a node in a DOT graph
type Edge ¶
type Edge[NT NodeConstrain] struct { From NT To NT }
type EdgeSpecFunc ¶
type EdgeSpecFunc[T NodeConstrain] func(from, to T) *DotEdgeSpec
EdgeSpecFunc is a function that returns the DOT specification for an edge.
type Graph ¶
type Graph[NT NodeConstrain] struct { // contains filtered or unexported fields }
Graph hold the nodes and edges of a graph
func NewGraph ¶
func NewGraph[NT NodeConstrain](edgeSpecFunc EdgeSpecFunc[NT]) *Graph[NT]
NewGraph creates a new graph
func (*Graph[NT]) ToDotGraph ¶
https://en.wikipedia.org/wiki/DOT_(graph_description_language)
func (*Graph[NT]) TopologicalSort ¶ added in v0.2.0
func (g *Graph[NT]) TopologicalSort() []NT
type GraphCodeError ¶
type GraphCodeError string
const ( ErrDuplicateNode GraphCodeError = "node with same key already exists in this graph" ErrConnectNotExistingNode GraphCodeError = "node to connect does not exist in this graph" )
func (GraphCodeError) Error ¶
func (ge GraphCodeError) Error() string
type GraphError ¶
type GraphError struct { Code GraphCodeError Message string }
func NewGraphError ¶
func NewGraphError(code GraphCodeError, message string) *GraphError
func (*GraphError) Error ¶
func (ge *GraphError) Error() string
func (*GraphError) Unwrap ¶
func (ge *GraphError) Unwrap() error
type NodeConstrain ¶
type NodeConstrain interface { // Name of the node, should be unique in the graph GetName() string // DotSpec returns the dot spec for this node DotSpec() *DotNodeSpec }
NodeConstrain is a constraint for a node in a graph
Click to show internal directories.
Click to hide internal directories.