Example #1
0
        /// <inheritdoc />
        public IEnumerable <int> NearestNeighborIndexes(T target, int k)
        {
            var boundedPriorityList = new BoundablePriorityList <int, double>(k);

            for (var i = 0; i < this.source.Count; i++)
            {
                boundedPriorityList.Add(i, this.Metric(this.source[i], target));
            }

            return(boundedPriorityList);
        }
Example #2
0
        /// <inheritdoc />
        public IEnumerable <T> NearestNeighbors(T target, int k)
        {
            var boundedPriorityList = new BoundablePriorityList <T, double>(k);

            foreach (var point in this.source)
            {
                boundedPriorityList.Add(point, this.Metric(point, target));
            }

            return(boundedPriorityList);
        }