16 #ifndef PAAL_CYCLE_ALGO_HPP
17 #define PAAL_CYCLE_ALGO_HPP
38 template <
typename Metric,
typename Cycle>
40 typedef typename data_structures::cycle_traits<Cycle>::CycleElem El;
41 typedef typename Metric::DistanceType Dist;
47 return std::accumulate(ebegin, eend, Dist(),
48 [&m](Dist a,
const std::pair<El, El> & p)->Dist{
49 return a + m(p.first, p.second);
54 template <
typename Cycle,
typename Stream>
55 void print_cycle(
const Cycle &cm, Stream &o,
const std::string &endl =
"\n") {
60 typedef typename data_structures::cycle_traits<Cycle>::CycleElem El;
63 boost::make_iterator_range(ebegin, eend)) {
64 o <<
"(" << p.first <<
"," << p.second <<
")->";
72 #endif // PAAL_CYCLE_ALGO_HPP
Metric::DistanceType get_cycle_length(const Metric &m, const Cycle &cm)
computes length of the cycle
void print_cycle(const Cycle &cm, Stream &o, const std::string &endl="\n")
pints cycle to std out
vertex_to_edge_iterator< vertex_iterator > make_vertex_to_edge_iterator(vertex_iterator b, vertex_iterator e)
make for vertex_to_edge_iterator