Beispiel #1
0
        private void ExpandClusterOrder(VectorDataOptics pointDBS)
        {
            var neighbors = kdTree.PointsWithinRadiusOfWithDistance(pointDBS, Epsilon);

            pointDBS.Visited = true;

            pointDBS.ReachabilityDistance = double.PositiveInfinity;

            pointDBS.SetCoreDistance(neighbors, Epsilon, MinPts);

            clusterOrdering.Add(pointDBS);

            if (!double.IsPositiveInfinity(pointDBS.CoreDistance))
            {
                var orderSeeds = new PriorityQueue<VectorDataOptics>();
                Update(neighbors, pointDBS, orderSeeds);
                while (orderSeeds.IsEmpty() == false)
                {
                    var currentObject = orderSeeds
                            .Poll();

                    var neighborsCurrent = kdTree
                            .PointsWithinRadiusOfWithDistance(pointDBS, Epsilon);

                    currentObject.Visited = true;

                    currentObject.SetCoreDistance(neighborsCurrent, Epsilon, MinPts);

                    clusterOrdering.Add(currentObject);

                    if (!double.IsPositiveInfinity(currentObject.CoreDistance))
                    {
                        Update(neighborsCurrent, currentObject, orderSeeds);
                    }
                }
            }
        }
        public void TestPoll2()
        {
            var queue = new PriorityQueue<string>();

            var poll = queue.Poll();

            Assert.IsNull(poll);
        }
        public void TestPoll1()
        {
            var queue = new PriorityQueue<string> { "string", "anotherString" };

            var poll = queue.Poll();

            Assert.AreEqual(1, queue.Count);
            Assert.AreEqual("anotherString", poll);
            Assert.IsFalse(queue.Contains("anotherString"));
        }