dag

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNodeNotFound

func IsNodeNotFound(err error) bool

Types

type DAG

type DAG struct {
	// contains filtered or unexported fields
}

func NewDAG

func NewDAG(opts ...Opt) *DAG

func (*DAG) AddEdge

func (d *DAG) AddEdge(parent NodeID, child NodeID) error

func (*DAG) AddNode

func (d *DAG) AddNode(node Node) error

func (*DAG) Children

func (d *DAG) Children(n NodeID) []Node

Children return all children of the node.

func (*DAG) GetNode

func (d *DAG) GetNode(n NodeID) (Node, error)

func (*DAG) GetNodes

func (d *DAG) GetNodes(field Field, label NodeLabel) []Node

GetNodes returns a list of nodes. Indexes are required in the constructor

func (*DAG) Parents

func (d *DAG) Parents(n NodeID) []Node

Parents return all parents of the node.

func (*DAG) Validate

func (d *DAG) Validate() bool

Validate validates the DAG. A DAG is valid if it has no cycles.

type Field

type Field = string

type FieldIndexer

type FieldIndexer struct {
	// contains filtered or unexported fields
}

func WithFieldIndexer

func WithFieldIndexer(f Field, e IndexerFunc) *FieldIndexer

func (FieldIndexer) ApplyTo

func (f FieldIndexer) ApplyTo(opts *Options)

type IndexerFunc

type IndexerFunc func(Node) []NodeLabel

type Node

type Node interface {
	ID() NodeID
}

type NodeID

type NodeID = string

type NodeLabel

type NodeLabel = string

type Opt

type Opt interface {
	// ApplyTo applies this configuration to the given options.
	ApplyTo(*Options)
}

type Options

type Options struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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