Priority Queue
Types
SeqSpace.PointCloud.PriorityQueue.RankedQueue
— Typestruct RankedQueue{T <: Real, S <: Any}
rank :: Array{T, 1}
data :: Array{S, 1}
end
Maintains a priority queue of data
. Each datum has a rank
that determines it's priority in the queue. rank
and data
are sorted in ascending order.
Functions
Base.insert!
— Methodinsert!(q::RankedQueue{T}, data::S, rank::T) where {T <: Real, S <: Any}
Push a new element data
with priority rank
onto the ranked queue q
. Rotates the queue until priority is sorted in ascending order.
Base.take!
— Methodtake!(q::RankedQueue)
Pop off the element with element with lowest rank/highest priority.
SeqSpace.PointCloud.PriorityQueue.left
— Methodleft(i)
Return the index of the left child of node i
.
SeqSpace.PointCloud.PriorityQueue.parent
— Methodparent(i)
Return the index of the parent of node i
.
SeqSpace.PointCloud.PriorityQueue.right
— Methodright(i)
Return the index of the right child of node i
.
SeqSpace.PointCloud.PriorityQueue.rotatedown!
— Methodrotatedown!(q::RankedQueue, i)
Modify the ranked queue by pushing down the node at index i
until the priority is sorted.
SeqSpace.PointCloud.PriorityQueue.rotatedown!
— Methodrotatedown!(q::RankedQueue)
Modify the ranked queue by pushing down the root until the priority is sorted.
SeqSpace.PointCloud.PriorityQueue.rotateup!
— Methodrotateup!(q::RankedQueue, i)
Modify the ranked queue by pushing up the node at index i
until the priority is sorted again.
SeqSpace.PointCloud.PriorityQueue.rotateup!
— Methodrotateup!(q::RankedQueue)
Modify the ranked queue by pushing up the last element until the priority is sorted.
SeqSpace.PointCloud.PriorityQueue.update!
— Methodupdate!(q::RankedQueue{T, S}, data::S, new::T) where {T <: Real, S <: Any}
Change the priority of element data
to rank new
. Will panic if data
is not contained in queue q
.