Loading...
Searching...
No Matches
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));
lemon::rnd
Random rnd
Global random number generator instance.
Definition random.cc:28
lemon::dim2::Point
Two dimensional vector (plain vector).
Definition dim2.h:45
lemon::dim2::Point::y
T y
Second coordinate.
Definition dim2.h:54
lemon::dim2::Point::x
T x
First coordinate.
Definition dim2.h:52
lemon::HypercubeGraph::HypercubeGraph
HypercubeGraph(int dim)
Constructs a hypercube graph with dim dimensions.
Definition hypercube_graph.h:310
lemon::HypercubeGraph::HyperMap
Linear combination map.
Definition hypercube_graph.h:404

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()

template<typename T, typename BF = std::plus<T>>
template<typename It>

HyperMap | ( | const Graph & | graph,
|  | It | begin,
|  | It | end,
|  | T | 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

## operator[]()

template<typename T, typename BF = std::plus<T>>

Value operator[] | ( | const Key & | k | ) | const

inline

Gives back the partial accumulated value.