class_docstr: Really simple unweighted directed graph data structure to track dependencies.
  
  The API is pretty much the same as networkx so if you add something just
  copy their API.
class_docstr_tok: ["Really","simple","unweighted","directed","graph","data","structure","to","track","dependencies",".","The","API","is","pretty","much","the","same","as","networkx","so","if","you","add","something","just","copy","their","API","."]
docstr: Returns a subgraph rooted at src that shows all the paths to dst.
docstr_tok: ["Returns","a","subgraph","rooted","at","src","that","shows","all","the","paths","to","dst","."]
code: def all_paths(self, src: str, dst: str):
      """Returns a subgraph rooted at src that shows all the paths to dst."""
  
      result_graph = DiGraph()
      # First compute forward transitive closure of src (all things reachable from src).
      forward_reachable_from_src = self.forward_transitive_closure(src)
  
      if dst not in forward_reachable_from_src:
          return result_graph
  
      # Second walk the reverse dependencies of dst, adding each node to
      # the output graph iff it is also present in forward_reachable_from_src.
      # we don't use backward_transitive_closures for optimization purposes
      working_set = deque(dst)
      while len(working_set) > 0:
          cur = working_set.popleft()
          for n in self.predecessors(cur):
              if n in forward_reachable_from_src:
                  result_graph.add_edge(n, cur)
                  # only explore further if its reachable from src
                  working_set.append(n)
  
      return result_graph.to_dot()
  
file_path: pytorch/torch/package/_digraph.py
imports: from collections import deque
  from typing import List, Set
label_desc: Use image node_id 12 for calling the DiGraph obj's underlying member method code with example usage: obj.all_paths(src, dst) and returns: result_graph, result_graph