dag

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeMissing = errors.New("node not found")
	ErrSelfLoop    = errors.New("self-loop not allowed")
	ErrNotADAG     = errors.New("graph contains a cycle (not a DAG)")
)

Functions

This section is empty.

Types

type ErrCycle

type ErrCycle struct {
	Path []string
}

func (ErrCycle) Error

func (e ErrCycle) Error() string

type G

type G[T fmt.Stringer] interface {
	AddNode(T)
	AddEdge(T, T) error
	TopoSort() ([]T, error)
	DetectFirstCycle() []T
}

G is a directed acyclic graph.

func New

func New[T fmt.Stringer]() G[T]

Jump to

Keyboard shortcuts

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