Documentation ¶
Index ¶
- type Elem
- type PriorityQueue
- func (p *PriorityQueue) Clone() *PriorityQueue
- func (p *PriorityQueue) Elems() []Elem
- func (e *PriorityQueue) Len() int
- func (e *PriorityQueue) Less(i, j int) bool
- func (p *PriorityQueue) Peek() (int32, float32)
- func (p *PriorityQueue) Pop() (int32, float32)
- func (p *PriorityQueue) Push(v int32, weight float32)
- func (p *PriorityQueue) Reverse() *PriorityQueue
- func (e *PriorityQueue) Swap(i, j int)
- func (p *PriorityQueue) Values() []int32
- type TopKFilter
- type TopKStringFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue represents the priority queue.
func NewPriorityQueue ¶
func NewPriorityQueue(desc bool) *PriorityQueue
NewPriorityQueue initializes an empty priority queue.
func (*PriorityQueue) Clone ¶
func (p *PriorityQueue) Clone() *PriorityQueue
func (*PriorityQueue) Elems ¶
func (p *PriorityQueue) Elems() []Elem
func (*PriorityQueue) Peek ¶
func (p *PriorityQueue) Peek() (int32, float32)
func (*PriorityQueue) Pop ¶
func (p *PriorityQueue) Pop() (int32, float32)
Pop removes the element with the highest priority from the queue and returns it. In case of an empty queue, an error is returned.
func (*PriorityQueue) Push ¶
func (p *PriorityQueue) Push(v int32, weight float32)
Push inserts a new element into the queue. No action is performed on duplicate elements.
func (*PriorityQueue) Reverse ¶
func (p *PriorityQueue) Reverse() *PriorityQueue
func (*PriorityQueue) Values ¶
func (p *PriorityQueue) Values() []int32
type TopKFilter ¶
type TopKFilter struct {
// contains filtered or unexported fields
}
TopKFilter filters out top k items with maximum weights.
func (*TopKFilter) PopAll ¶
func (filter *TopKFilter) PopAll() ([]int32, []float32)
PopAll pops all items in the filter with decreasing order.
func (*TopKFilter) Push ¶
func (filter *TopKFilter) Push(item int32, weight float32)
Push pushes the element x onto the heap. The complexity is O(log n) where n = h.Count().
type TopKStringFilter ¶
type TopKStringFilter struct {
// contains filtered or unexported fields
}
TopKStringFilter filters out top k strings with maximum weights.
func NewTopKStringFilter ¶
func NewTopKStringFilter(k int) *TopKStringFilter
NewTopKStringFilter creates a top k string filter.
func (*TopKStringFilter) Len ¶
func (filter *TopKStringFilter) Len() int
func (*TopKStringFilter) Less ¶
func (filter *TopKStringFilter) Less(i, j int) bool
func (*TopKStringFilter) PopAll ¶
func (filter *TopKStringFilter) PopAll() ([]string, []float64)
PopAll pops all strings in the filter with decreasing order.
func (*TopKStringFilter) Push ¶
func (filter *TopKStringFilter) Push(item string, weight float64)
Push pushes the element x onto the heap. The complexity is O(log n) where n = h.Count().
func (*TopKStringFilter) Swap ¶
func (filter *TopKStringFilter) Swap(i, j int)