Documentation ¶
Index ¶
- Variables
- func Diff(a, b *Graph) []string
- type Graph
- func (g *Graph) AddNodes(nodes ...Node) error
- func (g *Graph) Connect(from, to Node) error
- func (g *Graph) Cycles() (cycles [][]Node)
- func (g *Graph) Incoming(n Node) (nodes map[Node]struct{}, err error)
- func (g *Graph) IsLeaf(n Node) (bool, error)
- func (g *Graph) IsRoot(n Node) (bool, error)
- func (g *Graph) Outgoing(n Node) (nodes map[Node]struct{}, err error)
- func (g *Graph) StronglyConnectedComponents() (components [][]Node)
- func (g *Graph) TopologicalSort() []Node
- func (g *Graph) Walk(fn VisitFunc)
- func (g *Graph) WalkFrom(node Node, fn VisitFunc) error
- type Node
- type VisitFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDuplicateNode is returned when a node is attempted to // be inserted when it is already present ErrDuplicateNode = errors.New("node already exists in graph") // ErrMissingNode is returned when a node is reference which // does not exist within the graph ErrMissingNode = errors.New("node is not present in graph") )
Functions ¶
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is a graph datastructure which contains nodes with directed edges between them
func (*Graph) Outgoing ¶
Outgoing returns a set of nodes which are directed to from the provided node
func (*Graph) StronglyConnectedComponents ¶
StronglyConnectedComponents returns the set of strongly connected components within the graph
func (*Graph) TopologicalSort ¶
TopologicalSort returns the set of nodes within the graph topologically sorted
Click to show internal directories.
Click to hide internal directories.