Skip to content

luxe API (2025.1.2)


luxe: pqueue module


MaxPQ

import "luxe: pqueue" for MaxPQ

A priority queue that returns larger values first.

A priority queue holds various values and will sort them into an ordered list by priority. When queried via peek or values removed via pop the values are sorted.


MaxPQ.value returns unknown

Returns the internal array. Read only, modify the queue via add and pop.

MaxPQ.count returns unknown

Returns the number of items in the priority queue.

MaxPQ.new() returns MaxPQ

Create a new priority queue.

MaxPQ.new(get_priority_fn: Any) returns MaxPQ

Create a new priority queue with a callback for the priority of a value. The callback takes one parameter, the value, and should return a priority number for that value.

MaxPQ.add(value: Any) returns unknown

Add a value to the queue.

MaxPQ.pop() returns unknown

Return the next value, removing it from the queue.

MaxPQ.peek() returns unknown

Return the next value without removing it from the queue.

MinPQ

import "luxe: pqueue" for MinPQ

A priority queue that returns smaller values first.

A priority queue holds various values and will sort them into an ordered list by priority. When queried via peek or values removed via pop the values are sorted.


MinPQ.value returns unknown

Returns the internal array. Read only, modify the queue via add and pop.

MinPQ.count returns unknown

Returns the number of items in the priority queue.

MinPQ.new() returns MinPQ

Create a new priority queue.

MinPQ.new(get_priority_fn: Any) returns MinPQ

Create a new priority queue with a callback for the priority of a value. The callback takes one parameter, the value, and should return a priority number for that value.

MinPQ.add(value: Any) returns unknown

Add a value to the queue.

MinPQ.pop() returns unknown

Return the next value, removing it from the queue.

MinPQ.peek() returns unknown

Return the next value without removing it from the queue.