# KPriorityQueueFactory

> **KPriorityQueueFactory** = <`K`, `V`>(`k`, `keyOrder`, `entries?`) => [`KPriorityQueue`](/reference/knotkit/heap/interfaces/kpriorityqueue/)<`K`, `V`>

Defined in: [packages/heap/src/priority-queue.ts:249](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/heap/src/priority-queue.ts#L249)

Create a [KPriorityQueue](/reference/knotkit/heap/interfaces/kpriorityqueue/) of arity `k`. Separate from [BinaryPriorityQueueFactory](/reference/knotkit/heap/type-aliases/binarypriorityqueuefactory/) because the arity is a construction parameter rather than part of the kind.

## Type Parameters

### K

`K`

### V

`V`

## Parameters

### k

`number`

### keyOrder

[`Order`](/reference/knotkit/heap/type-aliases/order/)<`K`>

### entries?

`Iterable`\<readonly \[`K`, `V`]>

## Returns

[`KPriorityQueue`](/reference/knotkit/heap/interfaces/kpriorityqueue/)<`K`, `V`>

## Throws

With code `INVALID_ARITY` when `k` is not an integer of at least 2.
