All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions
HypercubeGraph::HyperMap< T, BF > Class Template Reference

Detailed Description

template<typename T, typename BF = std::plus<T>>
class lemon::HypercubeGraph::HyperMap< T, BF >

This map makes possible to give back a linear combination for each node. It works like the std::accumulate function, so it accumulates the bf binary function with the fv first value. The map accumulates only on that positions (dimensions) where the index of the node is one. The values that have to be accumulated should be given by the begin and end iterators and the length of this range should be equal to the dimension number of the graph.

const int DIM = 3;
HypercubeGraph graph(DIM);
dim2::Point<double> base[DIM];
for (int k = 0; k < DIM; ++k) {
base[k].x = rnd();
base[k].y = rnd();
}
HypercubeGraph::HyperMap<dim2::Point<double> >
pos(graph, base, base + DIM, dim2::Point<double>(0.0, 0.0));
See Also
HypercubeGraph

#include <lemon/hypercube_graph.h>

Public Types

typedef Node Key
 The key type of the map.
 
typedef T Value
 The value type of the map.
 

Public Member Functions

template<typename It >
 HyperMap (const Graph &graph, It begin, It end, T fv=0, const BF &bf=BF())
 Constructor for HyperMap.
 
Value operator[] (const Key &k) const
 The partial accumulated value.
 

Constructor & Destructor Documentation

HyperMap ( const Graph &  graph,
It  begin,
It  end,
fv = 0,
const BF &  bf = BF() 
)
inline

Construct a HyperMap for the given graph. The values that have to be accumulated should be given by the begin and end iterators and the length of this range should be equal to the dimension number of the graph.

This map accumulates the bf binary function with the fv first value on that positions (dimensions) where the index of the node is one.

Member Function Documentation

Value operator[] ( const Key k) const
inline

Gives back the partial accumulated value.