ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Maps.h File Reference

The maps of LEMON on the structures of ADS, beyond the book: models of the concepts ReadMap, ReadWriteMap and ReferenceMap of lemon/concepts/maps.h, which the algorithms of LEMON take for their input and output maps by named parameters (SetPredMap, SetDistMap, SetHeap< H , CR >, lengthMap()) [see Interoperation with LEMON]: More...

#include "ADS/Contract.h"
#include "ADS/Modification.h"
#include <lemon/core.h>
#include <algorithm>
#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Classes

class  ADS::lemon_interop::DenseMap< GR, T, Item >
 a ReferenceMap of LEMON by the ids of the items of a graph, on an array of its own, not attached to the notifier of the graph More...
class  ADS::lemon_interop::IndexMap< GR, S, Item >
 a ReadWriteMap of LEMON over a structure of ADS indexed by the ids of the items of a graph, ObservableArray or Fenwick among them More...
class  ADS::lemon_interop::ObservedMap< GR, Map, A, Policy >
 a map of LEMON whose writes are told as Changed< A , int , V >, the id of the item its handle More...

Namespaces

namespace  ADS
namespace  ADS::lemon_interop

Detailed description

The maps of LEMON on the structures of ADS, beyond the book: models of the concepts ReadMap, ReadWriteMap and ReferenceMap of lemon/concepts/maps.h, which the algorithms of LEMON take for their input and output maps by named parameters (SetPredMap, SetDistMap, SetHeap< H , CR >, lengthMap()) [see Interoperation with LEMON]:

  • DenseMap< GR , T , Item >, a ReferenceMap from the nodes, the arcs or the edges of a graph of LEMON to an array of maxId( Item() ) + 1 values of T (never a std::vector< bool >, so that Reference is a true bool &) that does not attach to the notifier of the graph: a map of LEMON attaches at its construction under the lock of the notifier, so that \( k \) algorithms started at once on one graph serialize on that lock and change one shared list, while with DenseMap they share no mutable state and run on the threads of an executor of ADS [see Parallel.h]; the price is that it does not follow the graph, and is valid while the graph keeps its items;
  • IndexMap< GR , S , Item >, a ReadWriteMap over a structure of ADS indexed by the ids of the items, ObservableArray [see ObservableArray.h], whose set() tells Assigned to its observers, Fenwick [see Fenwick.h], whose set() keeps the prefix aggregates, read by prefix(), or any structure with size(), set( i , v ) and a read by operator[]( i ) or get( i ); it does not own the structure, which must have room for maxId( Item() ) + 1 values;
  • ObservedMap< GR , Map , A , Policy >, a ReadWriteMap over a map of LEMON whose set() tells Changed< A , int , V > (the id of the item, the old and the new value) through the subject policy Policy [see Modification.h], since the maps of LEMON cannot be observed; a read costs that of the map below, and a write one more read of the old value when someone listens. A change of a cost or of a capacity must go through it to reach the observers; a direct write to the map below is not seen.

The contracts [see Contract.h]: the ids of the items within the room of the structure (for IndexMap) or of the array (for DenseMap). The maps are defined in this file.

See also
B. Dezső, A. Jüttner, P. Kovács, LEMON - an open source C++ graph template library, Electronic Notes in Theoretical Computer Science 264(5), 23-45, 2011, doi:10.1016/j.entcs.2011.06.003
P. M. Fenwick, A new data structure for cumulative frequency tables, Software: Practice and Experience 24(3), 327-336, 1994, doi:10.1002/spe.4380240306
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa