#include <duplicatesRemover.h>
Public Methods | |
DuplicatesRemover (SuperContainer *superContainer) | |
Creates a DuplicatesRemover. | |
void | insert (const RelabeledEdgeWithoutSource &edge, NodeID source) |
Adds an edge to the container. | |
void | clear (NodeID source) |
Clears the container. | |
Private Types | |
typedef std::pair< RelabeledEdgeWithoutSource, int > | HashMapElement |
The type of a hashMap-element. | |
Private Methods | |
int | hashFunction (NodeID x) const |
Returns the hash value for the given node ID. | |
int | find (NodeID x) const |
Returns the position of an edge with the given node ID in the hashMap. | |
void | clearLocal (NodeID x) |
Removes entries from the hashMap beginning with the hash value of the given node ID and ending with the first empty entry which is found. | |
bool | empty (int index) const |
Returns true iff the given position in the hashMap is empty. | |
Private Attributes | |
RelabeledEdgeWithoutSource | _edges [_maxSize] |
This array contains all edges without vacancies. | |
HashMapElement | _hashMap [_hashMapSize] |
The hashMap which contains the edges. | |
EdgeCount | _size |
The number of edges which are stored in this container. | |
SuperContainer * | _superContainer |
A pointer to the super container, i.e. | |
Static Private Attributes | |
const EdgeCount | _maxSize = 1024 |
The capacity of the container. | |
const EdgeCount | _hashMapSize = 2 * _maxSize |
The size of the hash map. |
If there is more than one edge with the same target node (the source node is always the same during one pass), only the edge with minimum weight is preserved. If the capacity of the container is exhausted, further edges which can't be stored are output directly.
Definition at line 23 of file duplicatesRemover.h.
|
The type of a hashMap-element. The first component stores the edge, the second the index in the array '_edges'. Definition at line 93 of file duplicatesRemover.h. Referenced by DuplicatesRemover< SuperContainer >::insert(). |
|
Creates a DuplicatesRemover.
Definition at line 35 of file duplicatesRemover.h. References DuplicatesRemover< SuperContainer >::_size, and DuplicatesRemover< SuperContainer >::_superContainer. |
|
Clears the container. The edges are written to the appropriate buckets. Definition at line 74 of file duplicatesRemover.h. References DuplicatesRemover< SuperContainer >::_edges, DuplicatesRemover< SuperContainer >::_size, DuplicatesRemover< SuperContainer >::_superContainer, and DuplicatesRemover< SuperContainer >::clearLocal(). |
|
Returns the position of an edge with the given node ID in the hashMap. If no appropriate edge is found, the position where such an edge should be stored is returned. Definition at line 127 of file duplicatesRemover.h. References DuplicatesRemover< SuperContainer >::_hashMap, DuplicatesRemover< SuperContainer >::_hashMapSize, DuplicatesRemover< SuperContainer >::empty(), and DuplicatesRemover< SuperContainer >::hashFunction(). Referenced by DuplicatesRemover< SuperContainer >::insert(). |
|
Adds an edge to the container. If an edge with the same target node is already in the container, the new edge replaces the old one if it has a lower weight, otherwise it is discarded. Definition at line 45 of file duplicatesRemover.h. References DuplicatesRemover< SuperContainer >::_edges, DuplicatesRemover< SuperContainer >::_hashMap, DuplicatesRemover< SuperContainer >::_maxSize, DuplicatesRemover< SuperContainer >::_size, DuplicatesRemover< SuperContainer >::_superContainer, DuplicatesRemover< SuperContainer >::empty(), DuplicatesRemover< SuperContainer >::find(), DuplicatesRemover< SuperContainer >::HashMapElement, and EdgeWithoutSource::target(). |
|
This array contains all edges without vacancies. This is useful in order to clear the container without traversing the whole hashMap. Definition at line 100 of file duplicatesRemover.h. Referenced by DuplicatesRemover< SuperContainer >::clear(), and DuplicatesRemover< SuperContainer >::insert(). |
|
A pointer to the super container, i.e. the container that uses this DuplicatesRemover (either a Buckets or a PQueue object). This is required in order to be able to put the edges to the super container when the capacity of this container is exhausted or when this container is cleared. Definition at line 115 of file duplicatesRemover.h. Referenced by DuplicatesRemover< SuperContainer >::clear(), DuplicatesRemover< SuperContainer >::DuplicatesRemover(), and DuplicatesRemover< SuperContainer >::insert(). |