15 #ifndef PAAL_METRIC_ON_IDX_HPP
16 #define PAAL_METRIC_ON_IDX_HPP
22 namespace data_structures {
35 template <
typename Metric,
typename Bimap,
typename Strategy = read_indexes_tag>
class metric_on_idx {
40 auto read(
typename btraits::Val v,
read_values_tag)
const -> decltype(m_idx.get_idx(v)) {
41 return m_idx.get_idx(v);
44 auto read(
typename btraits::Idx v,
read_indexes_tag)
const -> decltype(m_idx.get_val(v)) {
45 return m_idx.get_val(v);
48 template <
typename Vertex>
49 auto read(Vertex && v)
const -> decltype(this->read(v, Strategy())) {
50 return read(v, Strategy{});
62 : m_metric(m), m_idx(idx) {}
72 template <
typename Vertex>
74 return m_metric(read(i), read(j));
85 template <
typename Vertex>
86 auto operator()(
const Vertex & i,
const Vertex & j)
const {
87 return m_metric(read(i), read(j));
101 template <
typename Strategy = read_indexes_tag,
typename Metric,
typename Bimap>
108 template <
typename Metric,
typename Bimap>
110 public _metric_traits<metric_on_idx<Metric, Bimap, read_indexes_tag>,
111 typename bimap_traits<typename std::decay<Bimap>::type>::Idx>
114 template <
typename Metric,
typename Bimap>
116 public _metric_traits<metric_on_idx<Metric, Bimap, read_values_tag>,
117 typename bimap_traits<typename std::decay<Bimap>::type>::Val>
123 #endif // PAAL_METRIC_ON_IDX_HPP
metric_on_idx< Metric, Bimap, Strategy > make_metric_on_idx(Metric &&m, Bimap &&b)
make for metric_on_idx
auto operator()(const Vertex &i, const Vertex &j) const
operator() const
This metric keeps inner metric and index. Given vertices are reindex and passed to inner metric...
metric_on_idx(Metric m, Bimap idx)
constructor
auto operator()(const Vertex &i, const Vertex &j)
operator()