stategraph

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

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
}

func New

func New() *Graph

func (*Graph) DependOn

func (g *Graph) DependOn(statement pipelines.OrderedPipelineStatement) error

func (*Graph) Dependencies

func (g *Graph) Dependencies(child string) NodeSet

func (*Graph) Dependents

func (g *Graph) Dependents(parent string) NodeSet

func (*Graph) DependsOn

func (g *Graph) DependsOn(child, parent string) bool

func (*Graph) HasDependent

func (g *Graph) HasDependent(parent, child string) bool

func (*Graph) Leaves

func (g *Graph) Leaves() []string

func (*Graph) TopoSorted

func (g *Graph) TopoSorted() []string

TopoSorted returns all the nodes in the graph in topological sort order. See also `Graph.TopoSortedLayers()`.

func (*Graph) TopoSortedLayers

func (g *Graph) TopoSortedLayers() [][]string

TopoSortedLayers returns a slice of all the graph nodes in topological sort order. That is, if `B` depends on `A`, then `A` is guaranteed to come before `B` in the sorted output. The graph is guaranteed to be cycle-free because cycles are detected while building the graph. Additionally, the output is grouped into "layers", which are guaranteed to not have any dependencies within each layer. This is useful, e.g. when building an execution plan for some DAG, in which case each element within each layer could be executed in parallel. If you do not need this layered property, use `Graph.TopoSorted()`, which flattens all elements.

type NodeSet

type NodeSet map[string]struct{}

NodeSet a node in this graph is just a string, so a nodeset is a map whose keys are the nodes that are present.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL