dag

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dag implements a small directed acyclic graph: build, topological level grouping, cycle detection, descendant traversal. Nothing Tekton-specific lives here.

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) AddEdge

func (g *Graph) AddEdge(u, v string)

AddEdge records u→v. Both endpoints must exist; missing endpoints surface as errors at Levels() time.

func (*Graph) AddNode

func (g *Graph) AddNode(n string)

func (*Graph) Descendants

func (g *Graph) Descendants(start string) []string

Descendants returns all nodes reachable from start (excluding start itself).

func (*Graph) Levels

func (g *Graph) Levels() ([][]string, error)

Levels groups nodes into execution levels: level 0 has no incoming edges; level i+1 has all nodes whose deps are all in levels 0..i. Returns an error if a cycle is detected or an edge references an unknown node.

func (*Graph) Nodes

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

Nodes returns all node names, sorted.

Jump to

Keyboard shortcuts

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