Documentation
¶
Index ¶
- type Builder
- func (b *Builder) Build(nodes []domain.Node) (*domain.Graph, error)
- func (b *Builder) BuildDependencyMap(g *domain.Graph) map[string][]string
- func (b *Builder) BuildReverseIndex(g *domain.Graph) map[string][]string
- func (b *Builder) DetectCycle(g *domain.Graph) (bool, []string)
- func (b *Builder) TopologicalSort(g *domain.Graph) ([]domain.Node, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct{}
Builder constructs dependency graphs from nodes.
func (*Builder) Build ¶
Build creates a Graph from a slice of nodes. Returns an error if duplicate node IDs are found.
func (*Builder) BuildDependencyMap ¶
BuildDependencyMap creates a map of node dependencies. For each node, returns a list of node IDs it depends on (via Refs.Uses). Related refs are NOT considered dependencies.
func (*Builder) BuildReverseIndex ¶
BuildReverseIndex creates a reverse reference index. For each node, returns a list of node IDs that reference it (via Uses or Related). This is useful for finding all nodes that depend on or are related to a given node.
func (*Builder) DetectCycle ¶
DetectCycle checks for circular dependencies in the graph. Returns true and the cycle path if a cycle is found, false and nil otherwise.
func (*Builder) TopologicalSort ¶
TopologicalSort returns nodes sorted in dependency order. Nodes with no dependencies come first; nodes appear only after all their dependencies. Returns an error if the graph contains a cycle.