code: def traverse_nodes(self, qids, up=True, down=False, **args):
          
          g = self.get_filtered_graph(**args)
          nodes = set()
          for id in qids:
              # reflexive - always add self
              nodes.add(id)
              if down:
                  nodes.update(nx.descendants(g, id))
              if up:
                  nodes.update(nx.ancestors(g, id))
          return nodes
docs: Traverse (optionally) up and (optionally) down from an input set of nodes
  
          Arguments
          ---------
          qids : list[str]
              list of seed node IDs to start from
          up : bool
              if True, include ancestors
          down : bool
              if True, include descendants
          relations : list[str]
              list of relations used to filter
  
          Return
          ------
          list[str]
              nodes reachable from qids