Get the group of nodes associated to a given node.

@param u the node
@return the associated group of nodes if exists. An empty set otherwise
2729
public Collection<Node> getAssociatedPGroup(Node u) {
        for (Collection<Node> pGrp : pGroups) {
            if (pGrp.contains(u)) {
                return pGrp;
            }
        }
        return Collections.emptySet();
    }
221284
function(nodes) {
			var node, groups = [];

			function containedby(target, others) {
				return others.some(function(other) {
					return gui.DOMPlugin.contains(other, target);
				});
			}
			while ((node = nodes.pop())) {
				if (!containedby(node, nodes)) {
					groups.push(node);
				}
			}
			return groups;
		}
1150367
function nodes(){
    var nodeSet = {};
    Object.keys(edges).forEach(function (u){
      nodeSet[u] = true;
      edges[u].forEach(function (v){
        nodeSet[v] = true;
      });
    });
    return Object.keys(nodeSet);
  }
965287
@Override
    public Set<Node> getUsersForGroup(Node group) {
		Set<Node> users = new TreeSet<>();
		try {
			String query = "(" + groupIdentifyer + "=" + group.getName() + ")";
			SearchResult searchResult;
			Attributes attributes;
			SearchControls controls = new SearchControls();
			controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
			NamingEnumeration<SearchResult> results = ctx.search("", query, controls);
			Node user;
			while (results.hasMore()) {
				searchResult = results.next();
				attributes = searchResult.getAttributes();
				NamingEnumeration<?> members = attributes.get(groupMemberAttribut).getAll();
				while (members.hasMoreElements()) {
					String memberDN = (String) members.nextElement();
					String uid = getIdentifyerValueFromDN(memberDN);
					user = getUser(uid);
					user.setDn(memberDN);
					users.add(user);
				}
			}
		} catch (NamingException ex) {
			handleNamingException(group, ex);
		}
		return users;
	}
260311
private void groupByDOM(AreaImpl root)
    {
        if (root.getChildCount() > 1)
            findSuperAreas(root, 1);
        for (int i = 0; i < root.getChildCount(); i++)
            groupByDOM((AreaImpl) root.getChildAt(i));
    }
906754
public List<Node> getConnectedNodes() {
        List<Node> nodes = new ArrayList<>();
        for (Link l : links) {
            if (l.getElement() instanceof Node) {
                nodes.add((Node) l.getElement());
            }
        }
        return nodes;
    }
498009
public NodeList getAt(String name) {
        NodeList answer = new NodeList();
        for (Object child : this) {
            if (child instanceof Node) {
                Node childNode = (Node) child;
                Object temp = childNode.get(name);
                if (temp instanceof Collection) {
                    answer.addAll((Collection) temp);
                } else {
                    answer.add(temp);
                }
            }
        }
        return answer;
    }
636251
@Override
    public List<GroupDef> getGroups() {
        List<GroupDef> groups = new ArrayList<GroupDef>();
        for (Node group : model.get("group")) {
            groups.add(new GroupDefImpl(getDescriptorName(), model, group));
        }
        return groups;
    }
90507
GroupIds getGroupIds(Node groupNode) throws RepositoryException
   {
      String storagePath = getGroupStoragePath();
      String nodePath = groupNode.getPath();

      String groupId = nodePath.substring(storagePath.length());
      String parentId = groupId.substring(0, groupId.lastIndexOf("/"));

      return new GroupIds(groupId, parentId);
   }
786697
@Override
    public Iterator findParentGroups(IGroupMember gm) throws GroupsException {
        if (isTreeRefreshRequired()) {
            refreshTree();
        }
        log.debug("Invoking findParentGroups() for group member: {}", gm.getKey());
        Set<IEntityGroup> rslt = new HashSet<>();
        final IEntityGroup root = getRootGroup();
        if (gm.isGroup()) {
            IEntityGroup group = (IEntityGroup) gm;
            log.debug(
                    "Group member {} is group {}, {}",
                    gm.getKey(),
                    group.getLocalKey(),
                    group.getName());
            getParentGroups(group.getLocalKey(), rslt);
        } else if (!gm.isGroup() && gm.getLeafType().equals(root.getLeafType())) {
            Object[] groupKeys = getPersonGroupMemberKeys(gm);
            for (Object o : groupKeys) {
                String s = (String) o;
                IEntityGroup group = groupsTree.getGroups().get(s);
                rslt.add(group);
                rslt.addAll(getParentGroups(s, new HashSet<>()));
            }
        }
        return rslt.iterator();
    }
15329
public List<Group> getRootGroups()
    {
        List<Group> results = this.cachedRootGroups;
        
        if(results == null)
        {
            synchronized(this)
            {
                results = this.cachedRootGroups;
                if(results == null)
                {
                    results = new ArrayList<Group>();
                    
                    RepositoryConnection conn = null;
                    
                    try
                    {
                        conn = this.getRepository().getConnection();
                        
                        final RepositoryResult<Statement> rootGroupStatements =
                                conn.getStatements(null, RDF.TYPE, SesameRealmConstants.OAS_ROOTGROUP, true,
                                        this.getContexts());
                        
                        try
                        {
                            while(rootGroupStatements.hasNext())
                            {
                                final Statement nextRootGroupStatement = rootGroupStatements.next();
                                
                                if(nextRootGroupStatement.getSubject() instanceof URI)
                                {
                                    final URI nextRootGroupUri = (URI)nextRootGroupStatement.getSubject();
                                    // add the group recursively to enable member groups to be added
                                    // recursively
                                    results.add(this.createGroupHierarchy(null, conn, nextRootGroupUri));
                                }
                                else
                                {
                                    this.log.warn("Not including root group as it did not have a URI identifier: {}",
                                            nextRootGroupStatement);
                                }
                            }
                        }
                        finally
                        {
                            rootGroupStatements.close();
                        }
                    }
                    catch(final RepositoryException e)
                    {
                        this.log.error("Found exception while trying to get root groups", e);
                    }
                    finally
                    {
                        try
                        {
                            if(conn != null)
                            {
                                conn.close();
                            }
                        }
                        catch(final RepositoryException e)
                        {
                            this.log.error("Found unexpected exception while closing repository connection", e);
                        }
                    }
                    
                    this.cachedRootGroups = results;
                }
            }
        }
        
        return results;
        
        // throw new RuntimeException(
        // "TODO: Implement code not to rely on getting a complete list of groups where possible");
        // return this.rootGroups;
    }
766364
public Set<N> getChildren(N n)
    {
        Pair<HashSet<N>, HashSet<N>> p = nodes.get(n);
        
        if(p == null)
            return null;
        
        return p.getOutgoing();
    }
515079
public Set<String> getAllNodeIDs() {
		HashSet<String> ids = new HashSet<>(nodes.keySet());
		ids.add(nodeID);
		return ids;
	}
527843
function groupTermsByRoot(node) {
  const newNode = clone(node);
  const radicandNode = getRadicandNode(node);
  const rootNode = getRootNode(node);
  const rootValue = parseFloat(rootNode.value);

  radicandNode.args.sort(sortNodes);

  // We want to go through the sorted nodes, and try to find any groups of the
  // same node that are the size of the root value
  let children = [], hasGroups = false;
  for (let i = 0; i < radicandNode.args.length;) {
    let j = i;
    const initialNode = radicandNode.args[i];
    while (j < radicandNode.args.length && j - i < rootValue) {
      const siblingNode = radicandNode.args[j];
      if (!initialNode.equals(siblingNode)) {
        break;
      }
      j++;
    }
    if (j - i === rootValue) {
      hasGroups = true;
      const groupedNode = Node.Creator.parenthesis(
        Node.Creator.operator('*', radicandNode.args.slice(i, j)));
      children.push(groupedNode);
    }
    else {
      children = children.concat(radicandNode.args.slice(i, j));
    }
    i = j;
  }

  if (hasGroups) {
    newNode.args[0] = children.length === 1 ?
        children[0] : Node.Creator.operator('*', children);
    return Node.Status.nodeChanged(
      ChangeTypes.GROUP_TERMS_BY_ROOT, node, newNode);
  }
  // if we don't group any factors, then we can't simplify it any more
  return Node.Status.noChange(node);
}
84043
def getAllNodeUids(self):
        '''
            
        '''
        # Start with a set including this tag's uuid
        ret = { self.uid }

        ret.update(self.getAllChildNodeUids())

        return ret
221433
private Object getEntityWithAssociationFromNode(EntityMetadata m, Node node)
    {
        Map<String, Object> relationMap = new HashMap<String, Object>();

        /**
         * Map containing Node ID as key and Entity object as value. Helps cache
         * entity objects found earlier for faster lookup and prevents repeated
         * processing
         */
        Map<Long, Object> nodeIdToEntityMap = new HashMap<Long, Object>();

        Object entity = mapper.getEntityFromNode(node, m);

        nodeIdToEntityMap.put(node.getId(), entity);
        populateRelations(m, entity, relationMap, node, nodeIdToEntityMap);

        nodeIdToEntityMap.clear();

        if (!relationMap.isEmpty() && entity != null)
        {
            return new EnhanceEntity(entity, PropertyAccessorHelper.getId(entity, m), relationMap);
        }
        else
        {
            return entity;
        }

    }
809265
def get_equivalent_nodes(self, node: BaseEntity) -> Set[BaseEntity]:
        """"""
        if isinstance(node, BaseEntity):
            return set(self.iter_equivalent_nodes(node))

        return set(self.iter_equivalent_nodes(node))