Documentation
¶
Overview ¶
Package graph provides a directed graph implementation.
Index ¶
- type Graph
- func (g *Graph) AckChange()
- func (g *Graph) Exists(n *Node) bool
- func (g *Graph) HasChanged() bool
- func (g *Graph) NewConnection(from, to *Node) error
- func (g *Graph) NewNode(v interface{}) *Node
- func (g *Graph) RemoveConnection(from, to *Node) error
- func (g *Graph) RemoveNode(n *Node) error
- func (g *Graph) Size() int
- func (g *Graph) Sorted() [][]*Node
- type Node
- type NotInGraphError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is a directed graph.
func (*Graph) AckChange ¶
func (g *Graph) AckChange()
AckChange acknowledges changes to the Graph, resetting the dirty flag.
func (*Graph) HasChanged ¶
HasChanged returns whether or not the Graph state is dirty.
func (*Graph) NewConnection ¶
NewConnection creates a connection between two Nodes.
func (*Graph) RemoveConnection ¶
RemoveConnection removes a connection between two Nodes.
func (*Graph) RemoveNode ¶
RemoveNode removes a Node from the Graph.
type Node ¶
type Node struct { Value interface{} // contains filtered or unexported fields }
Node is a member of a Graph
func (*Node) InNeighborCount ¶
InNeighborCount returns the count of inbound neighbors
func (*Node) InNeighbors ¶
InNeighbors returns only neighboring Nodes with an inbound connection to this Node
func (*Node) NeighborCount ¶
NeighborCount returns the total neighbor count
func (*Node) OutNeighborCount ¶
OutNeighborCount returns the count of outbound neighbors
func (*Node) OutNeighbors ¶
OutNeighbors returns only neighboring Nodes with an outbound connection from this Node
type NotInGraphError ¶
type NotInGraphError struct {
Node *Node
}
NotInGraphError is an error that will be returned if a Node cannot be found in a Graph
func (NotInGraphError) Error ¶
func (n NotInGraphError) Error() string