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

## Detailed Description

template<typename GR, typename K>
class lemon::IterableIntMap< GR, K >

This class provides a special graph map type which can store an integer value for graph items (`Node`, `Arc` or `Edge`). For each non-negative value it is possible to iterate on the keys mapped to the value.

This map is intended to be used with small integer values, for which it is efficient, and supports iteration only for non-negative values. If you need large values and/or iteration for negative integers, consider to use IterableValueMap instead.

This type is a reference map, so it can be modified with the subscript operator.

Note
  The size of the data structure depends on the largest value in the map.

Template Parameters

  GR | The graph type.
  K | The key type of the map (`GR::Node`, `GR::Arc` or `GR::Edge`).

See also
  IterableBoolMap, IterableValueMap
  CrossRefMap

`#include <lemon/maps.h>`

## Classes

class | Reference
| Reference to the value of the map. More...
class | ItemIt
| Iterator for the keys with the same value. More...

## Public Types

typedef K | Key
| The key type.
typedef int | Value
| The value type.
typedef GR | Graph
| The graph type.
typedef True | ReferenceMapTag
| Indicates that the map is reference map.
typedef const Value & | ConstReference
| The const reference type.

## Public Member Functions

| IterableIntMap (const Graph &graph)
| Constructor of the map.
| IterableIntMap (const Graph &graph, int value)
| Constructor of the map with a given value.
int | size () const
| Gives back the maximal value plus one.
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.
Reference | operator[] (const Key &key)
| Subscript operator of the map.

## Constructor & Destructor Documentation

## IterableIntMap() [1/2]

template<typename GR, typename K>

IterableIntMap | ( | const Graph & | graph | ) |

inline explicit

Constructor of the map. It sets all values to -1.

## IterableIntMap() [2/2]

template<typename GR, typename K>

IterableIntMap | ( | const Graph & | graph,
|  | int | value )

inline explicit

Constructor of the map with a given value.

## Member Function Documentation

## size()

template<typename GR, typename K>

int size | ( |  | ) | const

inline

Gives back the maximal value plus one.

## set()

template<typename GR, typename K>

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

inline

Set operation of the map.

## operator[]() [1/2]

template<typename GR, typename K>

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

inline

Const subscript operator of the map.

## operator[]() [2/2]

template<typename GR, typename K>

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

inline

Subscript operator of the map.