Documentation
¶
Overview ¶
Package graph is the pure, kind-agnostic dependsOn DAG: no Kubernetes, no I/O. It derives strongly connected components (cycles), transitive ancestors, and unknown (dangling) edge targets from a flat edge map of adapter.NodeRef.
Index ¶
- type Graph
- func (g *Graph) Cycles() [][]adapter.NodeRef
- func (g *Graph) DependsOn(ref adapter.NodeRef) []adapter.NodeRef
- func (g *Graph) InCycle(ref adapter.NodeRef) bool
- func (g *Graph) Nodes() iter.Seq[adapter.NodeRef]
- func (g *Graph) TransitiveAncestors(ref adapter.NodeRef) []adapter.NodeRef
- func (g *Graph) Unknown() []adapter.NodeRef
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
}
Graph is the derived dependsOn graph. It is immutable after Build except for the TransitiveAncestors memoization cache, which is safe for concurrent use.
func Build ¶
Build constructs the DAG from nodes and their dependsOn edges. Edges to refs absent from nodes are auto-registered as external nodes (retrievable via Unknown()); the caller decides their semantics. Build never fails: cycles are reported, not errors.
func (*Graph) Cycles ¶
Cycles returns the strongly connected components with len > 1 (plus self-loops). Each member list is sorted by String(); the outer list is sorted by its first member.
func (*Graph) DependsOn ¶
DependsOn returns ref's direct dependencies, deduplicated and sorted by String(). It returns nil for a ref unknown to the graph.
func (*Graph) InCycle ¶
InCycle reports whether ref belongs to, or transitively depends on, a cycle.
func (*Graph) Nodes ¶
Nodes returns every node known to the graph (both supplied and external), in deterministic (String()-sorted) order.
func (*Graph) TransitiveAncestors ¶
TransitiveAncestors returns every ancestor reachable via dependsOn (memoized), deduplicated and sorted by String().