|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
#include <archeap.H>
Public Types | |
| using | handle_type = typename Heap::handle_type |
Public Member Functions | |
| Distance & | get_distance () |
| Return the distance functor of the comparison that orders the arcs of this heap and chooses between two arcs to the same node. | |
| ArcFibonacciHeap (Distance __dist=Distance(), Access_Heap_Node acc=Access_Heap_Node()) | |
| Construct an empty Fibonacci arc heap with the given distance functor and heap-node access policy. | |
| ArcFibonacciHeap (const ArcFibonacciHeap &)=delete | |
| Copying is disabled (heap manages internal node memory) | |
| ArcFibonacciHeap & | operator= (const ArcFibonacciHeap &)=delete |
| ArcFibonacciHeap (ArcFibonacciHeap &&other) noexcept | |
| Move construction transfers ownership of heap nodes and the distance. | |
| ArcFibonacciHeap & | operator= (ArcFibonacciHeap &&other) noexcept |
| Move assignment transfers ownership of heap nodes and the distance, after emptying this heap as empty() does. | |
| void | put_arc (typename GT::Arc *arc, typename GT::Node *tgt) |
| Insert or update an arc associated with a target node, keeping the smallest-distance arc per node in the heap. | |
| GT::Arc * | get_min_arc () |
| Extract the arc with minimum distance from the heap and clear its node-to-heap mapping. | |
| bool | is_empty () const noexcept |
| Return true if the heap is empty. | |
| void | empty () |
| Remove all heap nodes and delete their memory, after clearing the handles that the access functor keeps for them, so that their nodes can be put in a heap again. | |
| void | clear () |
| Empties the container. | |
| ~ArcFibonacciHeap () | |
| Destructor. Clears all remaining heap nodes, as empty() does. | |
Private Types | |
| using | Compare = Distance_Compare< GT, Distance > |
| using | Heap = Fibonacci_Heap< typename GT::Arc *, Compare > |
Private Member Functions | |
| handle_type & | handle_ref (typename GT::Node *p) |
| handle_type & | handle_of (handle_type heap_node) |
| void | clear_handles (handle_type first) |
Private Attributes | |
| Access_Heap_Node | access_node |
| Heap | heap |
|
private |
| using ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::handle_type = typename Heap::handle_type |
|
private |
|
inline |
|
delete |
Copying is disabled (heap manages internal node memory)
|
inlinenoexcept |
|
inline |
Destructor. Clears all remaining heap nodes, as empty() does.
Definition at line 381 of file archeap.H.
References ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::empty().
|
inline |
Empties the container.
| none |
Definition at line 378 of file archeap.H.
References ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::empty().
|
inlineprivate |
Definition at line 252 of file archeap.H.
References ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::handle_of().
Referenced by ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::empty().
|
inline |
Remove all heap nodes and delete their memory, after clearing the handles that the access functor keeps for them, so that their nodes can be put in a heap again.
No arc is compared. The storage of the handles must still be alive, and the access functor, called for both nodes of each arc, must not throw: the destructor and the move assignment, which do not throw, empty the heap too. With the handles in a map, operator[] of std::unordered_map, for one, inserts the nodes that it does not find, and may throw std::bad_alloc.
Definition at line 367 of file archeap.H.
References Aleph::Fibonacci_Heap< T, Compare >::clear(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::clear_handles(), Aleph::Fibonacci_Heap< T, Compare >::get_min_node(), and ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::heap.
Referenced by ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::~ArcFibonacciHeap(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::clear(), and ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::operator=().
|
inline |
Return the distance functor of the comparison that orders the arcs of this heap and chooses between two arcs to the same node.
Changing it while the heap has arcs may leave the heap out of order.
Definition at line 283 of file archeap.H.
References Aleph::Distance_Compare< GT, Distance >::dist, Aleph::Fibonacci_Heap< T, Compare >::get_compare(), and ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::heap.
|
inline |
Extract the arc with minimum distance from the heap and clear its node-to-heap mapping.
If the distance throws, or there is no memory, the arc is still in the heap, as its minimum, with its mapping.
Definition at line 342 of file archeap.H.
References ah_underflow_error_if, Aleph::Fibonacci_Heap< T, Compare >::extract_min(), Aleph::Fibonacci_Heap< T, Compare >::get_min_node(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::handle_of(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::heap, and Aleph::Fibonacci_Heap< T, Compare >::is_empty().
|
inlineprivate |
Definition at line 235 of file archeap.H.
References ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::handle_ref().
Referenced by ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::clear_handles(), and ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::get_min_arc().
|
inlineprivate |
Definition at line 228 of file archeap.H.
References ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::access_node.
Referenced by ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::handle_of(), and ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::put_arc().
|
inlinenoexcept |
Return true if the heap is empty.
Definition at line 357 of file archeap.H.
References ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::heap, and Aleph::Fibonacci_Heap< T, Compare >::is_empty().
|
inlinenoexcept |
Move assignment transfers ownership of heap nodes and the distance, after emptying this heap as empty() does.
Definition at line 305 of file archeap.H.
References ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::access_node, ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::empty(), and ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::heap.
|
delete |
|
inline |
Insert or update an arc associated with a target node, keeping the smallest-distance arc per node in the heap.
If the distance throws, the heap is as it was, and tgt has in it the arc that it had, or none.
Definition at line 319 of file archeap.H.
References Aleph::Fibonacci_Heap< T, Compare >::decrease_key(), Aleph::Fibonacci_Heap< T, Compare >::get_compare(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::handle_ref(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::heap, and Aleph::Fibonacci_Heap< T, Compare >::insert().
|
private |
Definition at line 225 of file archeap.H.
Referenced by ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::handle_ref(), and ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::operator=().
|
private |
Definition at line 226 of file archeap.H.
Referenced by ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::empty(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::get_distance(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::get_min_arc(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::is_empty(), ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::operator=(), and ArcFibonacciHeap< GT, Distance, Access_Heap_Node >::put_arc().