Esempio n. 1
0
        public void BKTree_should_FindBestDistance()
        {
            BKTree <TestNode> tree = new BKTree <TestNode>();

            TestNode search = new TestNode(new int[] { 118, 223, 316 });
            TestNode best   = new TestNode(3, new int[] { 120, 220, 320 });

            tree.add(new TestNode(1, new int[] { 100, 200, 300 }));
            tree.add(new TestNode(2, new int[] { 110, 210, 310 }));
            tree.add(best);
            tree.add(new TestNode(4, new int[] { 130, 230, 330 }));
            tree.add(new TestNode(5, new int[] { 140, 240, 340 }));

            Assert.Equal(9, DistanceMetric.calculateLeeDistance(search.Data, best.Data));
            Assert.Equal(9, tree.findBestDistance(search));
        }
        public void BKTree_should_FindBestDistance()
        {
            BKTree<TestNode> tree = new BKTree<TestNode>();

            TestNode search = new TestNode(new int[] { 118, 223, 316 });
            TestNode best   = new TestNode(3, new int[] { 120, 220, 320 });

            tree.add(new TestNode(1, new int[] { 100, 200, 300 }));
            tree.add(new TestNode(2, new int[] { 110, 210, 310 }));
            tree.add(best);
            tree.add(new TestNode(4, new int[] { 130, 230, 330 }));
            tree.add(new TestNode(5, new int[] { 140, 240, 340 }));

            Assert.Equal(9, DistanceMetric.calculateLeeDistance(search.Data, best.Data));
            Assert.Equal(9, tree.findBestDistance(search));
        }