Skip to content

luxe: pqueue


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 : unknown

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

MaxPQ.count : unknown

Returns the number of items in the priority queue.

MaxPQ.new() : MaxPQ

Create a new priority queue.

MaxPQ.new(get_priority_fn : Any) : 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) : unknown

Add a value to the queue.

MaxPQ.pop() : unknown

Return the next value, removing it from the queue.

MaxPQ.peek() : unknown

Return the next value without removing it from the queue.

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 : unknown

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

MinPQ.count : unknown

Returns the number of items in the priority queue.

MinPQ.new() : MinPQ

Create a new priority queue.

MinPQ.new(get_priority_fn : Any) : 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) : unknown

Add a value to the queue.

MinPQ.pop() : unknown

Return the next value, removing it from the queue.

MinPQ.peek() : unknown

Return the next value without removing it from the queue.