Documentation ¶
Overview ¶
Package dag implements a Directed Acyclic Graph for Package dependencies.
Index ¶
- type DAG
- type MapDag
- func (d *MapDag) AddEdge(from string, to Node) (bool, error)
- func (d *MapDag) AddEdges(edges map[string][]Node) ([]Node, error)
- func (d *MapDag) AddNode(node Node) error
- func (d *MapDag) AddNodes(nodes ...Node) error
- func (d *MapDag) AddOrUpdateNodes(nodes ...Node)
- func (d *MapDag) GetNode(identifier string) (Node, error)
- func (d *MapDag) Init(nodes []Node) ([]Node, error)
- func (d *MapDag) NodeExists(identifier string) bool
- func (d *MapDag) NodeNeighbors(identifier string) ([]Node, error)
- func (d *MapDag) Sort() ([]string, error)
- func (d *MapDag) TraceNode(identifier string) (map[string]Node, error)
- type NewDAGFn
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAG ¶
type DAG interface { Init(nodes []Node) ([]Node, error) AddNode(Node) error AddNodes(...Node) error AddOrUpdateNodes(...Node) GetNode(identifier string) (Node, error) AddEdge(from string, to Node) (bool, error) AddEdges(edges map[string][]Node) ([]Node, error) NodeExists(identifier string) bool NodeNeighbors(identifier string) ([]Node, error) TraceNode(identifier string) (map[string]Node, error) Sort() ([]string, error) }
DAG is a Directed Acyclic Graph.
type MapDag ¶
type MapDag struct {
// contains filtered or unexported fields
}
MapDag is a directed acyclic graph implementation that uses a map for its underlying data structure.
func (*MapDag) AddOrUpdateNodes ¶
AddOrUpdateNodes adds new nodes or updates the existing ones with the same identifier.
func (*MapDag) Init ¶
Init initializes a MapDag and implies missing destination nodes. Any implied nodes are returned. Any existing nodes are cleared.
func (*MapDag) NodeExists ¶
NodeExists checks whether a node exists.
func (*MapDag) NodeNeighbors ¶
NodeNeighbors returns a node's neighbors.
Click to show internal directories.
Click to hide internal directories.