HeapNode

HeapNode#

class HeapNode(key, priority)#

Bases: LinkedListNode, Generic[_K, _V]

__init__(key, priority)#

Constructor of the HeapNode class.

Parameters:
  • key (_K) – Key to represent the node.

  • priority (_V) – Numeric priority with respect to which the heap property is maintained.

Methods

__init__(key, priority)

Constructor of the HeapNode class.

add_child(child)

rtype:

None

add_parent(key, priority)

rtype:

None

add_predecessor(value)

rtype:

None

add_successor(value)

rtype:

None

change_children_root(new_child_root)

rtype:

None

change_degree(new_degree)

rtype:

None

change_parent(new_parent)

rtype:

None

change_predecessor(new_predecessor)

rtype:

None

change_priority(new_priority)

rtype:

None

change_successor(new_successor)

rtype:

None

create_and_add_child(key, priority)

rtype:

None

decrement_degree()

rtype:

None

increment_degree()

rtype:

None

new_node(value)

rtype:

TypeVar(LLN, bound= LinkedListNode)

remove_child(child)

rtype:

None

remove_children()

rtype:

None

remove_children_root()

rtype:

None

remove_parent()

rtype:

None

remove_predecessor()

rtype:

None

remove_successor()

rtype:

None

set_mark(mark)

rtype:

None

Attributes

child

rtype:

Optional[HeapNode]

degree

rtype:

int

key

rtype:

TypeVar(_K)

mark

rtype:

bool

parent

rtype:

Optional[HeapNode]

predecessor

rtype:

Optional[TypeVar(LLN, bound= LinkedListNode)]

priority

rtype:

TypeVar(_V, bound= Comparable)

successor

rtype:

Optional[TypeVar(LLN, bound= LinkedListNode)]

value

rtype:

TypeVar(T)

add_child(child)#
Return type:

None

add_parent(key, priority)#
Return type:

None

add_predecessor(value)#
Return type:

None

add_successor(value)#
Return type:

None

change_children_root(new_child_root)#
Return type:

None

change_degree(new_degree)#
Return type:

None

change_parent(new_parent)#
Return type:

None

change_predecessor(new_predecessor)#
Return type:

None

change_priority(new_priority)#
Return type:

None

change_successor(new_successor)#
Return type:

None

property child: Optional[HeapNode]#
Return type:

Optional[HeapNode]

create_and_add_child(key, priority)#
Return type:

None

decrement_degree()#
Return type:

None

property degree: int#
Return type:

int

increment_degree()#
Return type:

None

property key: _K#
Return type:

TypeVar(_K)

property mark: bool#
Return type:

bool

classmethod new_node(value)#
Return type:

TypeVar(LLN, bound= LinkedListNode)

property parent: Optional[HeapNode]#
Return type:

Optional[HeapNode]

property predecessor: Optional[LLN]#
Return type:

Optional[TypeVar(LLN, bound= LinkedListNode)]

property priority: _V#
Return type:

TypeVar(_V, bound= Comparable)

remove_child(child)#
Return type:

None

remove_children()#
Return type:

None

remove_children_root()#
Return type:

None

remove_parent()#
Return type:

None

remove_predecessor()#
Return type:

None

remove_successor()#
Return type:

None

set_mark(mark)#
Return type:

None

property successor: Optional[LLN]#
Return type:

Optional[TypeVar(LLN, bound= LinkedListNode)]

property value: T#
Return type:

TypeVar(T)