Loading...
Searching...
No Matches
IterableValueMap< GR, K, V > Class Template Reference
Data Structures » Maps » Graph Maps

## Detailed Description

template<typename GR, typename K, typename V>
class lemon::IterableValueMap< GR, K, V >

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.

Template Parameters

  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.

See also
  IterableBoolMap, IterableIntMap
  CrossRefMap

`#include <lemon/maps.h>`

## Classes

class | ValueIt
| Forward iterator for values. More...
class | ItemIt
| Iterator for the keys with the same value. 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.
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)
| Set operation of the map.
const Value & | operator[] (const Key &key) const
| Const subscript operator of the map.

## Constructor & Destructor Documentation

## IterableValueMap()

template<typename GR, typename K, typename V>

IterableValueMap | ( | const Graph & | graph,
|  | const Value & | value = Value() )

inline explicit

Constructor of the map with a given value.

## Member Function Documentation

## beginValue()

template<typename GR, typename K, typename V>

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.

## endValue()

template<typename GR, typename K, typename V>

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.

## set()

template<typename GR, typename K, typename V>

void set | ( | const Key & | key,
|  | const Value & | value )

inline

Set operation of the map.

## operator[]()

template<typename GR, typename K, typename V>

const Value & operator[] | ( | const Key & | key | ) | const

inline

Const subscript operator of the map.