class_docstr: A binary heap.
class_docstr_tok: ["A","binary","heap","."]
code: def insert(self, key, value, allow_increase=False):
      dict = self._dict
      if key in dict:
          old_value = dict[key]
          if value < old_value or (
              allow_increase and value > old_value
          ):
              # Since there is no way to efficiently obtain the location of a
              # key-value pair in the heap, insert a new pair even if ones
              # with the same key may already be present. Deem the old ones
              # as stale and skip them when the minimum pair is queried.
              dict[key] = value
              heappush(self._heap, (value, next(self._count), key))
              return value < old_value
          return False
      else:
          dict[key] = value
          heappush(self._heap, (value, next(self._count), key))
          return True
  
imports: from heapq import heappop, heappush
  from itertools import count
  import networkx
label_desc: Use image node_id 5 for calling the BinaryHeap obj's underlying member method code with example usage: obj.insert(key, value, allow_increase) and returns: False, True, unknown