Documentation ¶
Overview ¶
Package dag provides the Directed-Acyclic-Graph (DAG) primitives required by Terramate. The nodes can be added by providing both the descendants and ancestors of each node but only the descendant -> ancestors relationship is kept.
Index ¶
- Constants
- type DAG
- func (d *DAG) AddNode(id ID, value interface{}, descendants, ancestors []ID) error
- func (d *DAG) AncestorsOf(id ID) []ID
- func (d *DAG) HasCycle(id ID) bool
- func (d *DAG) IDs() []ID
- func (d *DAG) Node(id ID) (interface{}, error)
- func (d *DAG) Order() []ID
- func (d *DAG) Validate() (reason string, err error)
- type ID
- type Visited
Constants ¶
View Source
const ( ErrDuplicateNode errors.Kind = "duplicate node" ErrNodeNotFound errors.Kind = "node not found" ErrCycleDetected errors.Kind = "cycle detected" )
Errors returned by operations on the DAG.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAG ¶
type DAG struct {
// contains filtered or unexported fields
}
DAG is a Directed-Acyclic Graph
func (*DAG) AddNode ¶
AddNode adds a new node to the dag. The lists of descendants and ancestors defines its edge. The value is anything related to the node that needs to be retrieved later when processing the DAG.
func (*DAG) AncestorsOf ¶
AncestorsOf returns the list of ancestor node ids of the given id.
Click to show internal directories.
Click to hide internal directories.