Loading...
Searching...
No Matches
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...

## Namespaces

namespace | lemon
| The namespace of LEMON.

## Topics

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

## Functions

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

## Function Documentation

## nullMap()

template<typename K, typename V>

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

related

This function just returns a `NullMap` class.

## constMap() [1/2]

template<typename K, typename V>

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

related

This function just returns a `ConstMap` class.

## constMap() [2/2]

template<typename K, typename V, V v>

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

related

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

## identityMap()

template<typename T>

IdentityMap< T > identityMap | ( |  | ) |

related

This function just returns an `IdentityMap` class.

## rangeMap() [1/2]

template<typename V>

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

related

This function just returns a `RangeMap` class.

## rangeMap() [2/2]

template<typename V>

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

related

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

## sparseMap() [1/2]

template<typename K, typename V, typename Compare>

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

related

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

## sparseMap() [2/2]

template<typename K, typename V, typename Compare>

SparseMap< K, V, Compare > sparseMap | ( | const std::map< K, V, Compare > & | map,
|  | const V & | value = V() )

related

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

## trueMap()

template<typename K>

TrueMap< K > trueMap | ( |  | ) |

related

This function just returns a `TrueMap` class.

## falseMap()

template<typename K>

FalseMap< K > falseMap | ( |  | ) |

related

This function just returns a `FalseMap` class.

## loggerBoolMap()

template<typename Iterator>

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);
lemon::LoggerBoolMap::loggerBoolMap
LoggerBoolMap< Iterator > loggerBoolMap(Iterator it)
Returns a LoggerBoolMap class.
Definition maps.h:1808
lemon::dfs
DfsWizard< DfsWizardBase< GR > > dfs(const GR &digraph)
Function-type interface for DFS algorithm.
Definition dfs.h:1121
std::vector<Node> v(countNodes(g));
dfs(g).processedMap(loggerBoolMap(v.begin())).run(s);
lemon::countNodes
int countNodes(const Graph &g)
Function to count the nodes in the graph.
Definition core.h:252

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.