MCPcopy Create free account
hub / github.com/driangle/taskmd / GetDownstream

Method GetDownstream

sdk/go/graph/graph.go:93–108  ·  view source on GitHub ↗

GetDownstream returns all tasks that depend on the given task (transitively)

(taskID string)

Source from the content-addressed store, hash-verified

91
92// GetDownstream returns all tasks that depend on the given task (transitively)
93func (g *Graph) GetDownstream(taskID string) map[string]bool {
94 visited := make(map[string]bool)
95 var visit func(id string)
96 visit = func(id string) {
97 if visited[id] {
98 return
99 }
100 visited[id] = true
101 for _, dependentID := range g.Adjacency[id] {
102 visit(dependentID)
103 }
104 }
105 visit(taskID)
106 delete(visited, taskID) // Don't include the root task itself
107 return visited
108}
109
110// GetUpstream returns all tasks that the given task depends on (transitively)
111func (g *Graph) GetUpstream(taskID string) map[string]bool {

Callers 4

runGraphFunction · 0.95
handleGraphFunction · 0.95
TestGetDownstreamFunction · 0.95
ComputeDownstreamInfoFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestGetDownstreamFunction · 0.76