Documentation
¶
Index ¶
- type ErrVertexAlreadyExists
- type ErrVertexNotFoundForEdge
- 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 ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrVertexAlreadyExists ¶
type ErrVertexAlreadyExists struct {
Key string
}
func (ErrVertexAlreadyExists) Error ¶
func (err ErrVertexAlreadyExists) Error() string
type ErrVertexNotFoundForEdge ¶
func (ErrVertexNotFoundForEdge) Error ¶
func (err ErrVertexNotFoundForEdge) Error() string
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.
func (*Graph) RemoveVertex ¶
func (*Graph) TopologicalKeysFromLeaves ¶
func (*Graph) TopologicalKeysFromRoots ¶
Click to show internal directories.
Click to hide internal directories.