push

MinHeap.push(data, priority)

Add data object.

Re-adding an already queued object will update the queued object’s priority instead of adding a duplicate with a different priority, see update().

Parameters:
  • data (object) – Object to be added to the priority queue.

  • priority (float) – Priority of the data object.

Raises:

TypeError – If data is not derived from a hashable data type.

Note

Only hashable objects can be added to a heap. All user defined types are hashable.