43# ifndef EUCLIDIAN_GRAPH_COMMON_H
44# define EUCLIDIAN_GRAPH_COMMON_H
52# include <gsl/gsl_rng.h>
91 <<
"Init_P(): width and height must be > 0";
101 std::pair<int, int> q(x,
y);
130 const double dist = std::hypot(
static_cast<double>(
psrc.x -
ptgt.x),
131 static_cast<double>(
psrc.y -
ptgt.y));
177 template <AlephGraph GT>
183 <<
"gen_random_euclidian_graph(): width and height must be > 0";
185 const auto max_unique =
static_cast<size_t>(
w) *
static_cast<size_t>(
h);
187 <<
"gen_random_euclidian_graph(): requested n exceeds available unique grid points";
194 const int max_offset = std::max(1,
195 static_cast<int>(std::ceil(std::hypot(
static_cast<double>(
w),
196 static_cast<double>(
h)))));
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
#define ah_bad_alloc_if(C)
Throws std::bad_alloc if condition holds.
C++20 concepts for the protocol shared by graph algorithms.
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) const
Find an element in the set.
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)
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
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.
gsl_rng * rand_gen
Internal RNG handle used by the helper functors in this header.
GT gen_random_euclidian_graph(size_t n, size_t m, int w, int h, unsigned int seed)
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.