GetDownstream returns all tasks that depend on the given task (transitively)
(taskID string)
| 91 | |
| 92 | // GetDownstream returns all tasks that depend on the given task (transitively) |
| 93 | func (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) |
| 111 | func (g *Graph) GetUpstream(taskID string) map[string]bool { |
no outgoing calls