RangeIdMap
Declared in lemon/maps.h, in the group Graph Maps; the same class on the Doxygen site.
-
template< typename GR , typename K >
class RangeIdMap : protected Type< GR , K > Provides continuous and unique id for the items of a graph.
RangeIdMap provides a unique and continuous id for each item of a given type (
Node,ArcorEdge) in a graph. This id isunique: different items get different ids,
continuous: the range of the ids is the set of integers between 0 and
n-1, wherenis the number of the items of this type (Node,ArcorEdge).So, the ids can change when deleting an item of the same type.
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 classInverseMap, or with theoperator()()member.See also
- Template Parameters:
GR – The graph type.
K – The key type of the map (
GR::Node,GR::ArcorGR::Edge).
Public Types
-
typedef GR Graph
The graph type of RangeIdMap.
-
typedef K Item
The key type of RangeIdMap (
Node,ArcorEdge).
-
typedef K Key
The key type of RangeIdMap (
Node,ArcorEdge).
-
typedef int Value
The value type of RangeIdMap.
Public Functions
-
inline unsigned int size() const
Returns the maximal value plus one.
Returns the maximal value plus one in the map.
-
inline void swap( const Item & p , const Item & q )
Swaps the position of the two items in the map.
-
inline Item operator()( int id ) const
Gives back the item belonging to a range id.
Gives back the item belonging to the given range id.
-
inline const InverseMap inverse() const
Gives back the inverse of the map.
Gives back the inverse of the RangeIdMap.
Protected Functions
-
inline virtual void add( const Item & item )
Adds a new key to the map.
Add a new key to the map. It is called by the
AlterationNotifier.
-
inline virtual void add( const std::vector< Item > & items )
Add more new keys to the map. It is called by the
AlterationNotifier.
-
inline virtual void erase( const Item & item )
Erase the key from the map. It is called by the
AlterationNotifier.
-
inline virtual void erase( const std::vector< Item > & items )
Erase more keys from the map. It is called by the
AlterationNotifier.
-
inline virtual void build()
Build the unique map. It is called by the
AlterationNotifier.
-
inline virtual void clear()
Clear the keys from the map. It is called by the
AlterationNotifier.
-
class InverseMap
The inverse map type of RangeIdMap. The subscript operator gives back an item by its range id. This type conforms to the ReadMap concept.
Public Types
-
typedef RangeIdMap::Key Value
The value type of the InverseMap.
-
typedef RangeIdMap::Value Key
The key type of the InverseMap.
Public Functions
-
inline explicit InverseMap( const RangeIdMap & inverted )
Constructor.
Constructor of the InverseMap.
-
inline Value operator[]( const Key & key ) const
Subscript operator. It gives back the item that the given range id currently belongs to.
-
inline unsigned int size() const
Size of the map.
Returns the size of the map.
-
typedef RangeIdMap::Key Value