Documentation
¶
Overview ¶
Package dag implements a Directed Acyclic Graph data structure and relevant methods.
Index ¶
- type DAG
- func (d *DAG) AddEdge(src Vertex, dst Vertex) error
- func (d *DAG) AddEdgeSafe(src Vertex, dst Vertex) error
- func (d *DAG) AddVertex(v Vertex)
- func (d *DAG) DeleteEdge(src Vertex, dst Vertex)
- func (d *DAG) DeleteVertex(v Vertex)
- func (d *DAG) GetAncestors(v Vertex) (map[Vertex]bool, error)
- func (d *DAG) GetChildren(v Vertex) (map[Vertex]bool, error)
- func (d *DAG) GetDescendants(v Vertex) (map[Vertex]bool, error)
- func (d *DAG) GetLeafs() map[Vertex]bool
- func (d *DAG) GetOrder() int
- func (d *DAG) GetParents(v Vertex) (map[Vertex]bool, error)
- func (d *DAG) GetRoots() map[Vertex]bool
- func (d *DAG) GetSize() int
- func (d *DAG) GetVertices() map[Vertex]bool
- func (d *DAG) String() string
- type LoopError
- type Vertex
- type VertexUnknownError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAG ¶
type DAG struct {
// contains filtered or unexported fields
}
The DAG type implements a Directed Acyclic Graph.
func (*DAG) AddEdgeSafe ¶
Add an edge while preventing circles.
func (*DAG) DeleteVertex ¶
Delete a vertex including all inbound and outbound edges.
func (*DAG) GetAncestors ¶
Return all Ancestors of the given vertex.
func (*DAG) GetChildren ¶
Return all children of the given vertex.
func (*DAG) GetDescendants ¶
Return all Descendants of the given vertex.
func (*DAG) GetParents ¶
Return all parents of the given vertex.
type LoopError ¶
type LoopError struct {
// contains filtered or unexported fields
}
Error type to describe loop errors (i.e. errors that where raised to prevent establishing loops in the graph).
type VertexUnknownError ¶
type VertexUnknownError struct {
// contains filtered or unexported fields
}
Error type to describe the situation, that a given vertex does not exit in the graph.
func (VertexUnknownError) Error ¶
func (e VertexUnknownError) Error() string
Implements the error interface.
Click to show internal directories.
Click to hide internal directories.