Discover Packages
github.com/herd-os/herd
internal
dag
package
Version:
v0.2.13
Opens a new window with list of versions in this module.
Published: Mar 31, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
type CycleError struct {
Nodes []int
}
CycleError indicates a cycle was detected in the DAG.
DAG represents a directed acyclic graph of tasks.
New creates an empty DAG.
func (d *DAG ) AddEdge(from, to int )
AddEdge adds a dependency: `from` depends on `to`.
AddNode adds a node to the graph.
Tiers returns nodes grouped into execution tiers using Kahn's algorithm.
Tier 0 = nodes with no dependencies, Tier N+1 = nodes whose deps are all in tiers <= N.
Returns an error if the graph contains a cycle.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.