pq

package
v0.0.0-...-5408671 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PQ

type PQ[T point.P] struct {
	// contains filtered or unexported fields
}

PQ is an exported priority queue of k-D tree nodes with a maximum queue size. PQ tracks a specified number points with the smallest given priorities -- attempting to add a point with a larger priority will result in an effective no-op.

func New

func New[T point.P](size int) *PQ[T]

func (*PQ[T]) Empty

func (pq *PQ[T]) Empty() bool

func (*PQ[T]) Full

func (pq *PQ[T]) Full() bool

func (*PQ[T]) Len

func (pq *PQ[T]) Len() int

func (*PQ[T]) Pop

func (pq *PQ[T]) Pop() T

Pop removes the node with the highest priority from the queue.

func (*PQ[T]) Priority

func (pq *PQ[T]) Priority() float64

Priority calculates the current highest priority of the queue.

func (*PQ[T]) Push

func (pq *PQ[T]) Push(p T, priority float64)

Push adds a new point into the queue.

The queue will enforce the struct size constraint by removing elements frmo itself until the constraint is satisfied.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL