Documentation
¶
Index ¶
- Variables
- type Graph
- func (g *Graph) AddEdge(from string, to string) error
- func (g *Graph) AddVertex(key string) error
- func (g *Graph) GetVertex(key string) *Vertex
- func (g *Graph) Leaves() []*Vertex
- func (g *Graph) RemoveVertex(key string)
- func (g *Graph) Roots() []*Vertex
- func (g *Graph) TopologicalKeysFromLeaves() ([]string, error)
- func (g *Graph) TopologicalKeysFromRoots() ([]string, error)
- type Graphable
- type Vertex
- type Vertices
Constants ¶
This section is empty.
Variables ¶
var ErrVertexAlreadyExists = errors.New("vertex already exists in graph")
var ErrVertexNotFoundForEdge = errors.New("vertex not found for edge")
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
func (*Graph) AddEdge ¶
AddEdge adds an edge between 2 vertices in the graph. 'from' is the parent, and 'to' is the child. It fills in both sides, so we'll add a child to the parent 'from' pointing at 'to'. And we'll add a parent to the child 'to' pointing at 'from'. TODO: Check for cycles here to ensure its acylic.