Documentation ¶
Index ¶
- type Graph
- func (g *Graph) AddDependency(from, to string) error
- func (g *Graph) AddNode(s string)
- func (g *Graph) DependenciesOf(s string) ([]string, error)
- func (g *Graph) DependentsOf(s string) ([]string, error)
- func (g *Graph) DirectDependenciesOf(s string) ([]string, error)
- func (g *Graph) DirectDependentsOf(s string) ([]string, error)
- func (g *Graph) HasNode(s string) bool
- func (g *Graph) Len() int
- func (g *Graph) OverallOrder() ([]string, error)
- func (g *Graph) RemoveDependency(from, to string)
- func (g *Graph) RemoveNode(s string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph implements a simple dependency graph.
func (*Graph) AddDependency ¶
AddDependency adds a dependency between two nodes. If either node doesn't exist an error is returned.
func (*Graph) DependenciesOf ¶
DependenciesOf returns the nodes that the specified node depends on (transitively). Returns an error if the specified node doesn't exist or a dependency cycle is detected.
func (*Graph) DependentsOf ¶
DependentsOf returns the nodes that depend on the specified node (transitively). Returns an error if the specified node doesn't exist or a dependency cycle is detected.
func (*Graph) DirectDependenciesOf ¶
DirectDependenciesOf returns the nodes that are the direct dependencies of the specified node. Returns an error if the specified node doesn't exist.
func (*Graph) DirectDependentsOf ¶
DirectDependentsOf returns the nodes that directly depend on the specified node. Returns an error if the specified node doesn't exist.
func (*Graph) OverallOrder ¶
OverallOrder returns the overall processing order for the dependency graph. Returns an error if a dependency cycle is detected.
func (*Graph) RemoveDependency ¶
RemoveDependency removes a dependency between two nodes. If either node doesn't exist no error is returned.
func (*Graph) RemoveNode ¶
RemoveNode removes the specified string from the graph if it is present.