class_docstr: A pairing heap.
class_docstr_tok: ["A","pairing","heap","."]
code: def insert(self, key, value, allow_increase=False):
      node = self._dict.get(key)
      root = self._root
      if node is not None:
          if value < node.value:
              node.value = value
              if node is not root and value < node.parent.value:
                  self._cut(node)
                  self._root = self._link(root, node)
              return True
          elif allow_increase and value > node.value:
              node.value = value
              child = self._merge_children(node)
              # Nonstandard step: Link the merged subtree with the root. See
              # below for the standard step.
              if child is not None:
                  self._root = self._link(self._root, child)
              # Standard step: Perform a decrease followed by a pop as if the
              # value were the smallest in the heap. Then insert the new
              # value into the heap.
              # if node is not root:
              #     self._cut(node)
              #     if child is not None:
              #         root = self._link(root, child)
              #     self._root = self._link(root, node)
              # else:
              #     self._root = (self._link(node, child)
              #                   if child is not None else node)
          return False
      else:
          # Insert a new key.
          node = self._Node(key, value)
          self._dict[key] = node
          self._root = (
              self._link(root, node) if root is not None else node
          )
          return True
  
imports: from heapq import heappop, heappush
  from itertools import count
  import networkx
label_desc: Use image node_id 5 for calling the PairingHeap obj's underlying member method code with example usage: obj.insert(key, value, allow_increase) and returns: False, True, True