FastUpdateBinaryHeap(initial_capacity=128, max_reference=None)
The number of values in the heap
The number of levels in the binary heap (see Notes below). The values are stored in the last level, so 2**levels is the capacity of the heap before another resize is required.
The minimum number of levels in the heap (relates to the :None:None:`initial_capacity`
parameter.)
The provided or calculated maximum allowed reference value.
This heap class keeps cross-references so that the value associated with a given reference can be quickly queried (O(1) time) or updated (O(log2(N)) time). This is ideal for pathfinding algorithms that implement some variant of Dijkstra's algorithm.
The cross-references map data[reference]->internalindex, such that the value corresponding to a given reference can be found efficiently. This can be queried with the value_of() method.
A special method, push_if_lower() is provided that will update the heap if the given reference is not in the heap, or if it is and the provided value is lower than the current value in the heap. This is again useful for pathfinding algorithms.
Estimate of the size of the heap, if known in advance. (In any case, the heap will dynamically grow and shrink as required, though never below the :None:None:`initial_capacity`
.)
Largest reference value that might be pushed to the heap. (Pushing a larger value will result in an error.) If no value is provided, :None:None:`1-initial_capacity`
will be used. For the cross-reference index to work, all references must be in the range [0, max_reference]; references pushed outside of that range will not be added to the heap. The cross-references are kept as a 1-d array of length `max_reference+1', so memory use of this heap is effectively O(max_reference)
Binary heap that allows the value of a reference to be updated quickly.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them