IdMap< GR, K > Class Template Reference

- Main Page
- Modules
- Classes
- Namespaces
- Files
- Related Pages

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Related Functions
IdMap< GR, K > Class Template Reference
Graph Maps

## Detailed Description

### template<typename GR, typename K>
class lemon::IdMap< GR, K >

IdMap provides a unique and immutable id for each item of the same type (`Node`, `Arc` or `Edge`) in a graph. This id is

- unique: different items get different ids,
- immutable: the id of an item does not change (even if you delete other nodes).

Using this map you get access (i.e. can read) the inner id values of the items stored in the graph, which is returned by the `id()` function of the graph. This map can be inverted with its member class `InverseMap` or with the `operator()()` member.

Template Parameters

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

See Also
  RangeIdMap

`#include <lemon/maps.h>`

Inheritance diagram for IdMap< GR, K >:
[legend]

## Classes
class | InverseMap
| The inverse map type of IdMap. More...

## Public Types
typedef GR | Graph
| The graph type of IdMap.
typedef K | Item
| The key type of IdMap (`Node`, `Arc` or `Edge`).
typedef K | Key
| The key type of IdMap (`Node`, `Arc` or `Edge`).
typedef int | Value
| The value type of IdMap.
Public Types inherited from MapBase< K, int >
typedef K | Key
| The key type of the map.
typedef int | Value
| The value type of the map. (The type of objects associated with the keys).

## Public Member Functions
| IdMap (const Graph &graph)
| Constructor. More...
int | operator[] (const Item &item) const
| Gives back the id of the item. More...
Item | operator() (int id)
| Gives back the item by its id. More...
InverseMap | inverse () const
| Gives back the inverse of the map. More...

## Related Functions
(Note that these are not member functions.)
template<typename K , typename GR >
IdMap< GR, K > | idMap (const GR &graph)
| Returns an `IdMap` class. More...

## Constructor & Destructor Documentation

IdMap | ( | const Graph & | graph | ) |
| inlineexplicit

Constructor of the map.

## Member Function Documentation

int operator[] | ( | const Item & | item | ) | const
| inline

Gives back the immutable and unique id of the item.

Item operator() | ( | int | id | ) |
| inline

Gives back the item by its id.

InverseMap inverse | ( |  | ) | const
| inline

Gives back the inverse of the IdMap.