v0.6.1 Latest Latest

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

Go to latest
Published: Nov 15, 2023 License: GPL-3.0 Imports: 1 Imported by: 0



Package dag is used to verify and map out directed acyclic graph implementations. This helps us verify that user's task dependencies actually work as a DAG and avoid entering in any cycles.




This section is empty.


View Source
var (
	// ErrEntityNotFound is returned when a certain entity could not be located.
	ErrEntityNotFound = errors.New("dag: entity not found")

	// ErrEntityExists is returned when a certain entity was located but not meant to be.
	ErrEntityExists = errors.New("dag: entity already exists")

	// ErrPreconditionFailure is returned when there was a validation error with the parameters passed.
	ErrPreconditionFailure = errors.New("dag: parameters did not pass validation")

	// ErrEdgeCreatesCycle is returned when the introduction of an edge would create a cycle.
	ErrEdgeCreatesCycle = errors.New("dag: edge would create a cycle")


This section is empty.


type DAG

type DAG map[string]Node

func New

func New() DAG

func (DAG) AddEdge

func (dag DAG) AddEdge(from, to string) error

func (DAG) AddNode

func (dag DAG) AddNode(id string) error

func (DAG) Edges

func (dag DAG) Edges(id string) ([]Node, error)

func (DAG) Exists

func (dag DAG) Exists(id string) bool

func (DAG) String

func (dag DAG) String() string

type Node

type Node struct {
	ID    string
	Edges []Node

Jump to

Keyboard shortcuts

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