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>
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()) | |
ValueIt | beginValue () const |
Returns an iterator to the first value. | |
ValueIt | endValue () const |
Returns an iterator after the last value. | |
void | set (const Key &key, const Value &value) |
const Value & | operator[] (const Key &key) const |
IterableValueMap | ( | const Graph & | graph, |
const Value & | value = Value() |
||
) | [inline, explicit] |
Constructor of the map with a given value.
ValueIt beginValue | ( | ) | const [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.
ValueIt endValue | ( | ) | const [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.