private int PutNodeGroupName(string nodeName, int nodeGroupId, IDictionary <int, ISet <string> > groups, IDictionary <string, ISet <string> > rootToNodeGroup) { int newNodeGroupId = nodeGroupId; string root = nodeGrouper.Root(nodeName); ISet <string> nodeGroup = rootToNodeGroup.ContainsKey(root) ? rootToNodeGroup[root] : null; if (nodeGroup == null) { nodeGroup = new HashSet <string>(); rootToNodeGroup.Add(root, nodeGroup); groups.Add(newNodeGroupId++, nodeGroup); } nodeGroup.Add(nodeName); return(newNodeGroupId); }