Exemple #1
0
        /// <summary>
        /// extension a itemset, we pick up the node's SIL, and its right borther's SIL, we do IStep and if its support bigger than minSupport
        /// we neet to merge the itemset of the node whit the item in the last position of the node's right brother's itemset
        /// then we insert the new itemset into the itemset tree with the position
        /// we store all the itemset in the DataSet's ItemSILDic
        /// </summary>
        /// <param name="itemsetTree"></param>
        /// <param name="node"></param>
        private void ItemsetExtension(ItemsetTree <string> itemsetTree, ItemsetNode <string> node)
        {
            var position = 0;
            var children = node.Parent.GetChildren;

            for (int i = node.Position + 1; i < children.Count; i++)
            {
                var rightBrother = children[i];
//                var rightBrotherLastItem = rightBrother.Itemset.Last();
//                var nodeLastItem = node.Itemset.Last();
//                if (!DataSet.CMapIExtension.ContainsKey(nodeLastItem) || !DataSet.CMapIExtension[nodeLastItem].ContainsKey(rightBrotherLastItem))
//                {
//                    continue;
//                }
                var SIL = SparseIdList.IStep(node.SparseIdList, rightBrother.SparseIdList);
                if (SIL.Support >= DataSet.MinSupport)
                {
                    var newItemset = node.Itemset.Clone();
                    newItemset.AddItems(rightBrother.Itemset.Last());
                    DataSet.GetItemSILDic().Add(newItemset.Display(), SIL);
                    itemsetTree.AddChild(node, newItemset, SIL, position);
                    position++;
                }
            }
        }