#include <containers_heap.h>
List of all members.
Detailed Description
template<typename feature_type_, typename real_type_>
class OpenTissue::containers::Heap< feature_type_, real_type_ >
Heap Utility Class.
NOTE: This heap keeps priorities in descending order. That means that the element with the largest priority is on top of the heap!!!
Often a priority heap is needed with the following properties:
1) Each priority value is coupled to some feature/element from another data structure. As an example one may store edges of a polygonal mesh in a priority queue. The priorites indicate the benefit of performing some operation on the edges.
Thus when extracting the top element one gets the ``edge'' which will result in the largest gain when performing some operation on it.
2) After having performed an operation on a coupled feature, one often need to recompute the priority value, the operation may even affects ``neighboring'' features, which also need to get their priority values updated.
Thus we are often faced with the problem of changing only a small number of heap values, destroying the heap-property.
Since the number of heap elements is low it would be more attractive to have a heapify functionality that exploits this fact.
This class was implemented to make it easy to deal with the priority-feature coupling and to be able to heapify single elements rather than the entire heap.
Member Typedef Documentation
template<typename feature_type_, typename real_type_>
template<typename feature_type_, typename real_type_>
template<typename feature_type_, typename real_type_>
template<typename feature_type_, typename real_type_>
template<typename feature_type_, typename real_type_>
template<typename feature_type_, typename real_type_>
template<typename feature_type_, typename real_type_>
Constructor & Destructor Documentation
template<typename feature_type_, typename real_type_>
template<typename feature_type_, typename real_type_>
Member Function Documentation
template<typename feature_type_, typename real_type_>
Get First Heap Element.
- Returns:
- An iterator to the first heap element.
template<typename feature_type_, typename real_type_>
template<typename feature_type_, typename real_type_>
Get End Heap Element.
- Returns:
- An iterator to the position one past the last heap element.
template<typename feature_type_, typename real_type_>
Erase Feature.
- Parameters:
-
| f | The feature indicating the corresponding heap element (if it exist) that be erased. |
- Returns:
- If the heap element was succesfully deleted the return value is true otherwise it is false.
template<typename feature_type_, typename real_type_>
Get Heap Iterator.
- Parameters:
-
- Returns:
- An iterator pointing to the heap element that corresponds to the feature or the position one past the end of the heap.
template<typename feature_type_, typename real_type_>
Heapify All of the Heap. This method has time-complexity o( n lg n), where n is the number of heap elements.
template<typename feature_type_, typename real_type_>
Heapify Single Element. This function assumes that only the specifed heap element has the wrong position in the heap. The method works by scanning first to the left and then to the right, to look for the correct position of the specified heap element. Worst case time-complexity is thus O(n), where n is the number of heap elements.
Notice that as an side-effect all iterators may change after having invoked the method.
template<typename feature_type_, typename real_type_>
Push a new feature onto the heap.
Note that the new elements is not ``heapified''.
- Parameters:
-
| f | The feature that should be inserted. |
- Returns:
- A heap iterator to the newly created heap element. This can for instance be used to heapify the new element.
template<typename feature_type_, typename real_type_>
Size.
- Returns:
- The number of heap elements in the heap.
template<typename feature_type_, typename real_type_>
Get Top Element.
- Returns:
- An iterator to the heap element with largest priority value.
Member Data Documentation
template<typename feature_type_, typename real_type_>
The heap storing the heap-elements.
template<typename feature_type_, typename real_type_>
A heap iterator lookup table. This is used to quickly find the heap element corresponding to a given feature.
The documentation for this class was generated from the following file:
- /home/hauberg/Dokumenter/Capture/humim-tracker-0.1/src/OpenTissue/OpenTissue/core/containers/containers_heap.h