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>
66(
const graph_t& g,
const arrangement_t& arr)
73 for (; not e_it.
end(); e_it.
next()) {
76 const auto pu = arr[u];
77 const auto pv = arr[v];
80 l += (pu < pv ? pv - pu : pu - pv);
93template <
class result_t,
class graph_t,
class arrangement_t>
95(
const graph_t& g,
const arrangement_t& arr)
99 std::is_same_v<result_t, numeric::rational> or
100 std::is_same_v<result_t, double>
104 assert(g.get_num_edges() > 0);
109 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:72
result_t mean_sum_edge_lengths(const graph_t &g, const arrangement_t &arr) noexcept
Average sum of edge lengths in a graph.
Definition D.hpp:95
uint64_t sum_edge_lengths(const graph_t &g, const arrangement_t &arr) noexcept
Sum of edge lengths in a graph.
Definition D.hpp:66
Main namespace of the library.
Definition basic_types.hpp:48