Maps

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Classes | Modules | Files | Functions
Maps
Data Structures

## Detailed Description

This group contains the map structures implemented in LEMON.

LEMON provides several special purpose maps and map adaptors that e.g. combine new maps from existing ones.

See also: Map Concepts.

## Classes
class | MapBase< K, V >
| Base class of maps. More...
class | NullMap< K, V >
| Null map. (a.k.a. DoNothingMap) More...
class | ConstMap< K, V >
| Constant map. More...
class | ConstMap< K, Const< V, v > >
| Constant map with inlined constant value. More...
class | IdentityMap< T >
| Identity map. More...
class | RangeMap< V >
| Map for storing values for integer keys from the range `[0..size-1]`. More...
class | SparseMap< K, V, Comp >
| Map type based on `std::map`. More...
class | TrueMap< K >
| Constant `true` map. More...
class | FalseMap< K >
| Constant `false` map. More...
class | LoggerBoolMap< IT, KEY >
| Writable bool map for logging each `true` assigned element. More...

## Modules
| Graph Maps
| Special graph-related maps.
| Map Adaptors
| Tools to create new maps from existing ones.

## Files
file | maps.h
| Miscellaneous property maps.

## Functions
template<typename K , typename V >
NullMap< K, V > | nullMap ()
| Returns a `NullMap` class. More...
template<typename K , typename V >
ConstMap< K, V > | constMap (const V &v)
| Returns a `ConstMap` class. More...
template<typename K , typename V , V v>
ConstMap< K, Const< V, v > > | constMap ()
| Returns a `ConstMap` class with inlined constant value. More...
template<typename T >
IdentityMap< T > | identityMap ()
| Returns an `IdentityMap` class. More...
template<typename V >
RangeMap< V > | rangeMap (int size=0, const V &value=V())
| Returns a `RangeMap` class. More...
template<typename V >
RangeMap< V > | rangeMap (const std::vector< V > &vector)
| Returns a `RangeMap` class created from an appropriate `std::vector`. More...
template<typename K , typename V , typename Compare >
SparseMap< K, V, Compare > | sparseMap (const V &value=V())
| Returns a `SparseMap` class. More...
template<typename K , typename V , typename Compare >
SparseMap< K, V, Compare > return | SparseMap (map, value)
| Returns a `SparseMap` class created from an appropriate `std::map`. More...
template<typename K >
TrueMap< K > | trueMap ()
| Returns a `TrueMap` class. More...
template<typename K >
FalseMap< K > | falseMap ()
| Returns a `FalseMap` class. More...
template<typename Iterator >
LoggerBoolMap< Iterator > | loggerBoolMap (Iterator it)
| Returns a `LoggerBoolMap` class. More...

## Function Documentation

NullMap< K, V > nullMap | ( |  | ) |
| related

This function just returns a `NullMap` class.

ConstMap< K, V > constMap | ( | const V & | v | ) |
| related

This function just returns a `ConstMap` class.

ConstMap< K, Const< V, v > > constMap | ( |  | ) |
| related

This function just returns a `ConstMap` class with inlined constant value.

IdentityMap< T > identityMap | ( |  | ) |
| related

This function just returns an `IdentityMap` class.

RangeMap< V > rangeMap | ( | int | size = `0`,
|  | const V & | value = `V()`
| ) |  |
| related

This function just returns a `RangeMap` class.

RangeMap< V > rangeMap | ( | const std::vector< V > & | vector | ) |
| related

This function just returns a `RangeMap` class created from an appropriate `std::vector`.

SparseMap< K, V, Compare > sparseMap | ( | const V & | value = `V()` | ) |
| related

This function just returns a `SparseMap` class with specified default value.

SparseMap< K, V, Compare > return SparseMap< K, V, Compare > | ( | map | ,
|  | value |
| ) |  |
| related

This function just returns a `SparseMap` class created from an appropriate `std::map`.

TrueMap< K > trueMap | ( |  | ) |
| related

This function just returns a `TrueMap` class.

FalseMap< K > falseMap | ( |  | ) |
| related

This function just returns a `FalseMap` class.

LoggerBoolMap< Iterator > loggerBoolMap | ( | Iterator | it | ) |
| related

This function just returns a `LoggerBoolMap` class.

The most important usage of it is storing certain nodes or arcs that were marked `true` by an algorithm. For example, it makes easier to store the nodes in the processing order of Dfs algorithm, as the following examples show.

* std::vector<Node> v;
* dfs(g).processedMap(loggerBoolMap(std::back_inserter(v))).run(s);
*
* std::vector<Node> v(countNodes(g));
* dfs(g).processedMap(loggerBoolMap(v.begin())).run(s);
*

Note
  The container of the iterator must contain enough space for the elements or the iterator should be an inserter iterator.
  LoggerBoolMap is just writable, so it cannot be used when a readable map is needed, for example, as `ReachedMap` for `Bfs`, `Dfs` and `Dijkstra` algorithms.