Get all nodes at a particular level

        Arguments
        ---------
        relations : list[str]
            list of relations used to filter
169549
def get_level(self, level, relations=None, **args):
        
        g = self.get_filtered_graph(relations)
        nodes = self.get_roots(relations=relations, **args)
        for i in range(level):
            logger.info(" ITERATING TO LEVEL: {} NODES: {}".format(i, nodes))
            nodes = [c for n in nodes
                     for c in g.successors(n)]
        logger.info(" FINAL: {}".format(nodes))
        return nodes
107297
def _find_relations(self):
        """"""
        # Get all extractions
        extractions = \
            list(self.tree.execute("$.extractions[(@.@type is 'Extraction')]"))

        # Get relations from extractions
        relations = []
        for e in extractions:
            label_set = set(e.get('labels', []))
            # If this is a DirectedRelation
            if 'DirectedRelation' in label_set:
                self.relation_dict[e['@id']] = e
                subtype = e.get('subtype')
                if any(t in subtype for t in polarities.keys()):
                    relations.append((subtype, e))
            # If this is an Event or an Entity
            if {'Event', 'Entity'} & label_set:
                self.concept_dict[e['@id']] = e

        if not relations and not self.relation_dict:
            logger.info("No relations found.")
        else:
            logger.info('%d relations of types %s found'
                        % (len(relations), ', '.join(polarities.keys())))
            logger.info('%d relations in dict.' % len(self.relation_dict))
            logger.info('%d concepts found.' % len(self.concept_dict))
        return relations
463768
def get_children(self,node):
    
    if self.find_cycle() or self.__directionless:
      sys.stderr.write("ERROR: do cannot find a branch when there are cycles in the graph\n")
      sys.exit()
    v = self.__get_children(node.id)
    return [self.__nodes[i] for i in v]
630408
def nodes(self, alias, depth=10, bank_id=None):
        
        if bank_id:
            return self._root + self._safe_alias(alias) + '/child/nodes/' + bank_id + '?descendentlevels=' + str(depth)
        else:
            return self._root + self._safe_alias(alias) + '/root/nodes?descendentlevels=' + str(depth)
960948
def related(self):
        
        return [ch for ch in self.sentence.chunks 
                    if ch != self and intersects(unzip(0, ch.relations), unzip(0, self.relations))]
111506
def get_nodes(self):
        

        return [node for node in foundations.walkers.nodes_walker(self.model().root_node)]
70995
function depsForDeps(relations, levels) {
  // Get directories from BemDeps
  const dirs = bemDirs(relations);

  // Get all (with sub-) directories
  let allDirs = {};
  dirs.forEach((targetDir) => {
    allDirs[targetDir] = true;

    let subDir = path.dirname(targetDir);
    do {
      allDirs[subDir] = true;
      subDir = path.dirname(subDir);
    } while (path.dirname(subDir) !== subDir);
  });
  allDirs = Object.keys(allDirs);

  // Join dirs with levels
  const paths = levels.slice();
  levels.forEach((level) => {
    allDirs.forEach((dir) => {
      paths.push(path.join(level, dir));
    });
  });

  return Promise.resolve(paths);
  // Search for existing directories
  // return dirsExist(paths).then((result) => {
  //   return Object.keys(result).filter((dir) => {
  //     return true === result[dir];
  //   });
  // });
}
1341580
def get_roots(self, relations=None, prefix=None):
        
        g = self.get_filtered_graph(relations=relations, prefix=prefix)
        # note: we also eliminate any singletons, which includes obsolete classes
        roots = [n for n in g.nodes() if len(list(g.predecessors(n))) == 0 and len(list(g.successors(n))) > 0]
        return roots
1229060
public function getAll($relations = true)
    {
        $results = array_merge($this->data, [
            'fields' => $this->getFields(),
            'files' => $this->getFileFieldNames(),
            'json' => $this->getJsonFieldNames(),
            'listable' => $this->getListableFieldNames(),
            'detailable' => $this->getDetailableFieldNames(),
            'required' => $this->getRequiredFieldNames(),
            'slugable' => $this->getSlugableFieldNames(),
            'uuids' => $this->getUuidFieldNames(),
            'unique' => $this->getUniqueFieldNames()
        ]);

        return $results;
    }
690725
def relation_ids(self):
        
        if self.scope == scopes.GLOBAL:
            # the namespace is the relation name and this conv speaks for all
            # connected instances of that relation
            return hookenv.relation_ids(self.namespace)
        else:
            # the namespace is the relation ID
            return [self.namespace]
781745
def get_all_nodes(self):
        
        nodes = self.nodes.values()
        if nodes:
            return reduce(operator.add, nodes, list())
        else:
            return []
350331
def get_nodes(self, request, *args, **kwargs):
        
        # ListSerializerMixin.list returns a serializer object
        return (self.list(request, *args, **kwargs)).data
109728
def build_relation_predicate(relations: Strings) -> EdgePredicate:
    """"""
    if isinstance(relations, str):
        @edge_predicate
        def relation_predicate(edge_data: EdgeData) -> bool:
            """Pass for relations matching the enclosed value."""
            return edge_data[RELATION] == relations

    elif isinstance(relations, Iterable):
        relation_set = set(relations)

        @edge_predicate
        def relation_predicate(edge_data: EdgeData) -> bool:
            """Pass for relations matching the enclosed values."""
            return edge_data[RELATION] in relation_set

    else:
        raise TypeError

    return relation_predicate
454334
def _get_all_children(self,):
        
        res = ''
        if self.child_nodes:
            for c in self.child_nodes:
                res += ' child = ' + str(c) + '\n'
                if c.child_nodes:
                    for grandchild in c.child_nodes:
                        res += '   child = ' + str(grandchild) + '\n'
        else:
            res += ' child = None\n'
        return res
1297558
def relations_of(self, target, include_object=False):
        '''  '''
        relations = (target if isinstance(target, RamGraphDBNode) else self._get_item_node(target)).outgoing
        if include_object:
            for k in relations:
                for v in relations[k]:
                    if hasattr(v, 'obj'): # filter dead links
                        yield k, v.obj
        else:
            yield from relations
1116800
def connections_of(self, target):
        '''  '''
        return gen.chain( ((r,i) for i in self.find(target,r)) for r in self.relations_of(target) )
329600
def get_children(engine, parent_ids, rank='species', schema=None):
    

    if not parent_ids:
        return []

    nodes = schema + '.nodes' if schema else 'nodes'
    names = schema + '.names' if schema else 'names'

    cmd = ('select tax_id, tax_name, rank '
           'from {} join {} using (tax_id) '
           'where parent_id = :tax_id and is_primary').format(nodes, names)

    species = []
    for parent_id in parent_ids:
        result = engine.execute(sqlalchemy.sql.text(cmd), tax_id=parent_id)
        keys = list(result.keys())
        rows = [dict(list(zip(keys, row))) for row in result.fetchall()]
        for r in rows:
            if r['rank'] == rank and 'sp.' not in r['tax_name']:
                species.append(r)
        others = [r for r in rows if r['rank'] not in (rank, 'no_rank')]
        if others:
            _, s = get_children(engine, [r['tax_id'] for r in others])
            species.extend(s)

    return keys, species