RangeIdMap provides a unique and continuous ID for each item of a given type (Node
, Arc
or Edge
) in a graph. This id is
n-1
, where n
is the number of the items of this type (Node
, Arc
or Edge
).Thus this id is not (necessarily) the same as what can get using the id()
function of the graph or IdMap. This map can be inverted with its member class InverseMap
, or with the operator()
member.
GR | The graph type. |
K | The key type of the map (GR::Node , GR::Arc or GR::Edge ). |
#include <lemon/maps.h>
Inherits Type< GR, K >.
Classes | |
class | InverseMap |
Public Types | |
typedef GR | Graph |
The graph type of RangeIdMap. | |
typedef K | Item |
The key type of RangeIdMap (Node , Arc or Edge ). | |
typedef K | Key |
The key type of RangeIdMap (Node , Arc or Edge ). | |
typedef int | Value |
The value type of RangeIdMap. | |
Public Member Functions | |
RangeIdMap (const Graph &gr) | |
unsigned int | size () const |
Returns the maximal value plus one. | |
void | swap (const Item &p, const Item &q) |
int | operator[] (const Item &item) const |
Item | operator() (int id) const |
const InverseMap | inverse () const |
Protected Member Functions | |
virtual void | add (const Item &item) |
Adds a new key to the map. | |
virtual void | add (const std::vector< Item > &items) |
Add more new keys to the map. | |
virtual void | erase (const Item &item) |
Erase the key from the map. | |
virtual void | erase (const std::vector< Item > &items) |
Erase more keys from the map. | |
virtual void | build () |
Build the unique map. | |
virtual void | clear () |
Clear the keys from the map. | |
|
inlineexplicit |
Constructor.
|
inlineprotectedvirtual |
Add a new key to the map. It is called by the AlterationNotifier
.
|
inlineprotectedvirtual |
Add more new keys to the map. It is called by the AlterationNotifier
.
|
inlineprotectedvirtual |
Erase the key from the map. It is called by the AlterationNotifier
.
|
inlineprotectedvirtual |
Erase more keys from the map. It is called by the AlterationNotifier
.
|
inlineprotectedvirtual |
Build the unique map. It is called by the AlterationNotifier
.
|
inlineprotectedvirtual |
Clear the keys from the map. It is called by the AlterationNotifier
.
|
inline |
Returns the maximal value plus one in the map.
|
inline |
Gives back the RangeId of the item.
|
inline |
Gives back the item belonging to a RangeId.
|
inline |
Gives back the inverse of the map.