43# ifndef EUCLIDIAN_GRAPH_COMMON_H
44# define EUCLIDIAN_GRAPH_COMMON_H
92 <<
"Init_P(): width and height must be > 0";
102 std::pair<int, int> q(x,
y);
131 const double dist = std::hypot(
static_cast<double>(psrc.
x - ptgt.
x),
132 static_cast<double>(psrc.
y - ptgt.
y));
178 template <AlephGraph GT>
184 <<
"gen_random_euclidian_graph(): width and height must be > 0";
186 const auto max_unique =
static_cast<size_t>(
w) *
static_cast<size_t>(
h);
188 <<
"gen_random_euclidian_graph(): requested n exceeds available unique grid points";
195 const int max_offset = std::max(1,
196 static_cast<int>(std::ceil(std::hypot(
static_cast<double>(
w),
197 static_cast<double>(
h)))));
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
C++20 concepts for the protocol shared by graph algorithms.
The random number generators of Aleph: the one that gives the numbers of the gsl_rng_mt19937 of GSL,...
RAII guard for exception-safe resource cleanup.
Dynamic set implemented using AVL binary search trees of type Avl_Tree<Key>.
Key * insert(const Key &key)
Inserts a key into the dynamic set.
Key * search(const Key &key)
Find an element in the set.
A random number generator with the sequences of GSL's gsl_rng_mt19937.
static constexpr result_type max() noexcept
The greatest number of operator()(): 2^32 - 1.
unsigned long uniform_int(const unsigned long n)
An integer in [0, n), each with the same probability, as gsl_rng_uniform_int(r, n).
RAII guard for graph algorithm initialization.
Random undirected graph generator.
ArcInfo & get_info() noexcept
Return a modifiable reference to the arc data.
NodeInfo & get_info() noexcept
Return a modifiable reference to the data contained in the node.
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
__gmp_expr< typename __gmp_resolve_expr< T, V >::value_type, __gmp_binary_expr< __gmp_expr< T, U >, __gmp_expr< V, W >, __gmp_max_function > > max(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
const long double offset[]
Offset values indexed by symbol string length (bounded by MAX_OFFSET_INDEX)
Graph serialization and deserialization utilities.
Main namespace for Aleph-w library functions.
GT gen_random_euclidian_graph(size_t n, size_t m, int w, int h, unsigned int seed)
Gsl_Compatible_Rng * rand_gen
Internal RNG handle used by the helper functors in this header.
Random graph generation utilities.
void operator()(GT &g, typename GT::Arc *a)
Init_P(const long w, const long h)
Create a node initializer that assigns unique random positions.
void operator()(GT &, typename GT::Node *p)
DynSetAvlTree< std::pair< int, int > > puntos
Simple integer point used as node payload by the helper functors in this header.
void operator()(std::istream &input, GT &, typename GT::Arc *a)
void operator()(std::istream &input, GT &, typename GT::Node *p)
void operator()(std::ostream &output, GT &, typename GT::Arc *a)
void operator()(std::ostream &output, GT &, typename GT::Node *p)
FooMap m(5, fst_unit_pair_hash, snd_unit_pair_hash)
Simple graph implementation with adjacency lists.