precedes Function

private pure function precedes(self, left, right) result(first)

.true. when entry left must pop before entry right.

Compares (key, insertion index) lexicographically, which makes the ordering total and the tie behaviour FIFO.

Arguments

Type IntentOptional Attributes Name
class(heap_t), intent(in) :: self
integer(kind=default_int), intent(in) :: left
integer(kind=default_int), intent(in) :: right

Return Value logical


Called by

proc~~precedes~~CalledByGraph proc~precedes precedes proc~sift_down sift_down proc~sift_down->proc~precedes proc~sift_up sift_up proc~sift_up->proc~precedes proc~heap_build_from heap_t%heap_build_from proc~heap_build_from->proc~sift_down proc~heap_pop heap_t%heap_pop proc~heap_pop->proc~sift_down proc~heap_push heap_t%heap_push proc~heap_push->proc~sift_up proc~a_star a_star proc~a_star->proc~heap_pop proc~a_star->proc~heap_push proc~dijkstra dijkstra proc~dijkstra->proc~heap_pop proc~dijkstra->proc~heap_push

Source Code

   pure function precedes(self, left, right) result(first)
      !! `.true.` when entry `left` must pop before entry `right`.
      !!
      !! Compares `(key, insertion index)` lexicographically, which makes the
      !! ordering total and the tie behaviour FIFO.
      class(heap_t), intent(in) :: self
      integer(default_int), intent(in) :: left
      integer(default_int), intent(in) :: right
      logical :: first

      if (self%keys(left) == self%keys(right)) then
         first = (self%insertion(left) < self%insertion(right))
      else if (self%max_heap) then
         first = (self%keys(left) > self%keys(right))
      else
         first = (self%keys(left) < self%keys(right))
      end if
   end function precedes