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

Method GetUpstream

sdk/go/graph/graph.go:111–126  ·  view source on GitHub ↗

GetUpstream returns all tasks that the given task depends on (transitively)

(taskID string)

Source from the content-addressed store, hash-verified

109
110// GetUpstream returns all tasks that the given task depends on (transitively)
111func (g *Graph) GetUpstream(taskID string) map[string]bool {
112 visited := make(map[string]bool)
113 var visit func(id string)
114 visit = func(id string) {
115 if visited[id] {
116 return
117 }
118 visited[id] = true
119 for _, depID := range g.RevAdjacency[id] {
120 visit(depID)
121 }
122 }
123 visit(taskID)
124 delete(visited, taskID) // Don't include the root task itself
125 return visited
126}
127
128// DetectCycles finds all cycles in the graph
129//

Callers 3

runGraphFunction · 0.95
handleGraphFunction · 0.95
TestGetUpstreamFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestGetUpstreamFunction · 0.76