예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BinaryQueue{TVertex,TDistance}"/> class.
        /// </summary>
        /// <param name="distanceFunc">Function that compute the distance for a given vertex.</param>
        /// <param name="distanceComparison">Comparer of distances.</param>
        public BinaryQueue(
            [NotNull] Func <TVertex, TDistance> distanceFunc,
            [NotNull] Comparison <TDistance> distanceComparison)
        {
            if (distanceFunc is null)
            {
                throw new ArgumentNullException(nameof(distanceFunc));
            }
            if (distanceComparison is null)
            {
                throw new ArgumentNullException(nameof(distanceComparison));
            }

            _distanceFunc = distanceFunc;
            _heap         = new BinaryHeap <TDistance, TVertex>(distanceComparison);
        }
예제 #2
0
 void IDisposable.Dispose()
 {
     _owner = null;
     _items = null;
 }