Documentation
¶
Overview ¶
Package graph builds and analyzes task dependency graphs.
It detects cycles, computes upstream/downstream relationships, and generates visualization output in ASCII, Mermaid, and Graphviz formats.
Index ¶
- type ASCIIFormatter
- type Graph
- func (g *Graph) DetectCycles() [][]string
- func (g *Graph) FilterTasks(taskIDs map[string]bool) *Graph
- func (g *Graph) GetDownstream(taskID string) map[string]bool
- func (g *Graph) GetUpstream(taskID string) map[string]bool
- func (g *Graph) ToASCII(rootTaskID string, downstream bool, f *ASCIIFormatter) string
- func (g *Graph) ToDot(focusTaskID string) string
- func (g *Graph) ToJSON() map[string]any
- func (g *Graph) ToMermaid(focusTaskID string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASCIIFormatter ¶
type ASCIIFormatter struct {
FormatID func(id string) string
FormatTitle func(title, status string) string
FormatStatusIndicator func(indicator, status string) string
FormatConnector func(connector string) string
FormatReference func(text string) string
}
ASCIIFormatter provides optional formatting callbacks for ASCII tree output. When nil or when a field is nil, the corresponding text is returned unmodified.
type Graph ¶
type Graph struct {
Tasks []*model.Task
TaskMap map[string]*model.Task
Adjacency map[string][]string // task ID -> list of dependent task IDs
RevAdjacency map[string][]string // task ID -> list of dependency task IDs
}
Graph represents a task dependency graph
func (*Graph) DetectCycles ¶
DetectCycles finds all cycles in the graph
func (*Graph) FilterTasks ¶
FilterTasks creates a subgraph with only the specified task IDs
func (*Graph) GetDownstream ¶
GetDownstream returns all tasks that depend on the given task (transitively)
func (*Graph) GetUpstream ¶
GetUpstream returns all tasks that the given task depends on (transitively)
func (*Graph) ToASCII ¶
func (g *Graph) ToASCII(rootTaskID string, downstream bool, f *ASCIIFormatter) string
ToASCII generates an ASCII tree representation. An optional ASCIIFormatter applies styling callbacks; pass nil for plain text.