This class provides a special graph map type which can store a comparable value for graph items (Node
, Arc
or Edge
). For each value it is possible to iterate on the keys mapped to the value (ItemIt
), and the values of the map can be accessed with an STL compatible forward iterator (ValueIt
). The map stores a linked list for each value, which contains the items mapped to the value, and the used values are stored in balanced binary tree (std::map
).
IterableBoolMap and IterableIntMap are similar classes specialized for bool
and int
values, respectively.
This type is not reference map, so it cannot be modified with the subscript operator.
GR | The graph type. |
K | The key type of the map (GR::Node , GR::Arc or GR::Edge ). |
V | The value type of the map. It can be any comparable value type. |
#include <lemon/maps.h>
Inherits Type< GR, K >.
Classes | |
class | ItemIt |
Iterator for the keys with the same value. More... | |
class | ValueIt |
Forward iterator for values. More... | |
Public Types | |
typedef K | Key |
The key type. | |
typedef V | Value |
The value type. | |
typedef GR | Graph |
The graph type. | |
Public Member Functions | |
IterableValueMap (const Graph &graph, const Value &value=Value()) | |
Constructor of the map with a given value. More... | |
ValueIt | beginValue () const |
Returns an iterator to the first value. More... | |
ValueIt | endValue () const |
Returns an iterator after the last value. More... | |
void | set (const Key &key, const Value &value) |
Set operation of the map. More... | |
const Value & | operator[] (const Key &key) const |
Const subscript operator of the map. More... | |
|
inlineexplicit |
Constructor of the map with a given value.
|
inline |
Returns an STL compatible iterator to the first value of the map. The values of the map can be accessed in the [beginValue, endValue)
range.
|
inline |
Returns an STL compatible iterator after the last value of the map. The values of the map can be accessed in the [beginValue, endValue)
range.