/// <param name="hierarchies">domain generalization hierarchies</param> /// <returns>Returns the sorted generalization nodeList.</returns> public List <Node> MakeNodeList(List <IHierarchy> hierarchies) { List <int[]> hierArchiesLevels = new List <int[]>(); foreach (IHierarchy h in hierarchies) { int depth = h.GetDepth(); // deth = number of dictionaries in the list -or number of levels int[] level = new int[depth]; for (int i = 0; i < depth; i++) { level[i] = i; } hierArchiesLevels.Add(level); } var cartesianProductOfPointers = CartesianProductExtension.CartesianProduct(hierArchiesLevels); int idCount = 0; List <Node> nodeList = new List <Node>(); foreach (var product in cartesianProductOfPointers) { Node node = new Node(); node.id = idCount++; node.generalizations = product.ToList(); nodeList.Add(node); } nodeList.Sort(); return(nodeList); }
/* * It returns a sorted generalization node list belongigng to a node/bucket */ public List <Node> MakeNodeList(Node inputNode) { List <int[]> nodeLevels = new List <int[]>(); foreach (var h in inputNode.generalizations) { int max = h; // deth = number of dictionaries in the list -or number of levels int[] level = new int[max + 1]; for (int i = 0; i <= max; i++) { level[i] = i; } nodeLevels.Add(level); } var cartesianProductOfPointers = CartesianProductExtension.CartesianProduct(nodeLevels); int idCount = 0; List <Node> nodeList = new List <Node>(); foreach (var product in cartesianProductOfPointers) { Node node = new Node(); node.id = idCount++; node.generalizations = product.ToList(); nodeList.Add(node); } nodeList.Sort(); return(nodeList); }