コード例 #1
0
        public void AddTransactione_OneTransactionAdded_ReturnPathWithOneItem()
        {
            ConditionalFPTree cTree       = new ConditionalFPTree(5);
            FPTreeNode        transaction = CreateTransaction(1, 3, 4);

            cTree.AddTransaction(transaction, 1);
            var result = cTree.GetItemPrefixPath(4);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count());
        }
コード例 #2
0
        public void AddTransaction_OneTransactionAdded_ContainsAddedTransaction()
        {
            ConditionalFPTree cTree       = new ConditionalFPTree(5);
            FPTreeNode        transaction = CreateTransaction(1, 3, 4);

            cTree.AddTransaction(transaction, 1);
            var result = cTree.GetItemPrefixPath(4).ToArray();

            Assert.AreEqual(4, result[0].FPTreeNode.Item);
            Assert.AreEqual(3, result[0].FPTreeNode.ParentNode.Item);
            Assert.AreEqual(1, result[0].FPTreeNode.ParentNode.ParentNode.Item);
            Assert.AreEqual(FPTreeNodeType.Root, result[0].FPTreeNode.ParentNode.ParentNode.ParentNode.Type);
        }
コード例 #3
0
        public void AddTransaction_TwoTransactionAddedWithCommonPath_CommonPathHasCorrectSupport()
        {
            ConditionalFPTree cTree = new ConditionalFPTree(0);

            FPTreeNode[] transactions = CreateTransactionWithCommonPath(new uint[] { 1 }, new uint[] { 3, 4, 5 }, new uint[] { 4, 5 });

            cTree.AddTransaction(transactions[0], 1);
            cTree.AddTransaction(transactions[1], 1);

            var result = cTree.GetItemPrefixPath(1).ToArray();

            Assert.AreEqual(1, result.Length);
            Assert.AreEqual(1, result[0].FPTreeNode.Item);
            Assert.AreEqual(2, result[0].FPTreeNode.Support);
        }