Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct { Node uint32 // The value of the item; arbitrary. Distance float32 // The priority of the item in the queue. // The index is needed by update and is maintained by the heap.Interface methods. Index int // The index of the item in the heap. }
An Item is something we manage in a priority queue.
type PriorityQueue ¶
A PriorityQueue implements heap.Interface and holds Items.
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() any
Remove the top element (e.g smallest in a min-heap, largest in a max-heap)
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
func (*PriorityQueue) Top ¶
func (pq *PriorityQueue) Top() any
Return the top element (either max, or min, depending on heap type)
Click to show internal directories.
Click to hide internal directories.