+ /**
+ * The number of filled prioritized buckets.
+ */
+ public get buckets (): number {
+ return this.k === Infinity ? 1 : Math.trunc(this.nodeArray.length / this.k)
+ }
+
+ /**
+ * Constructs a priority queue.
+ *
+ * @param k - Prioritized bucket size. @defaultValue Infinity
+ */
+ public constructor (k = Infinity) {
+ if (k !== Infinity && !Number.isSafeInteger(k)) {
+ throw new TypeError('k must be an integer')
+ }
+ if (k < 1) {
+ throw new RangeError('k must be greater than or equal to 1')
+ }
+ this.k = k