50#include <lal/iterators/E_iterator.hpp>
51#include <lal/numeric/rational.hpp>
52#include <lal/detail/macros/basic_convert.hpp>
64template <
class graph_t,
class arrangement_t>
67 const arrangement_t& arr
75 for (; not e_it.
end(); e_it.
next()) {
78 const auto pu = arr[u];
79 const auto pv = arr[v];
82 l += (pu < pv ? pv - pu : pu - pv);
95template <
typename result_t,
class graph_t,
class arrangement_t>
98 const arrangement_t& arr
103 std::is_same_v<result_t, numeric::rational> or
104 std::is_same_v<result_t, double>
108 assert(g.get_num_edges() > 0);
113 if constexpr (std::is_same_v<result_t, numeric::rational>) {
Iterator over the set of edges of a graph.
Definition: E_iterator.hpp:97
void next() noexcept
Moves the iterator to the next edge.
Definition: E_iterator.hpp:142
bool end() const noexcept
Returns true if the end of the iteration was reached.
Definition: E_iterator.hpp:117
edge_t get_edge_t() const noexcept
Returns the current edge.
Definition: E_iterator.hpp:123
Exact rational number.
Definition: rational.hpp:63
constexpr double to_double(const T &t) noexcept
Conversion to double.
Definition: basic_convert.hpp:62
result_t mean_sum_edge_lengths(const graph_t &g, const arrangement_t &arr) noexcept
Average sum of edge lengths in a graph.
Definition: sum_edge_lengths.hpp:96
uint64_t sum_edge_lengths(const graph_t &g, const arrangement_t &arr) noexcept
Sum of edge lengths in a graph.
Definition: sum_edge_lengths.hpp:65
Main namespace of the library.
Definition: basic_types.hpp:50