4#include <gtest/gtest.h>
25 bool operator()(
const int & a,
const int & b)
const {
return a < b; }
30 bool operator()(
const int & a,
const int & b) {
return a < b; }
35 bool operator()(
int x)
const {
return x > 0; }
40 void operator()(
int)
const {}
45 void operator()(
int & x)
const { ++x; }
50 std::optional<int> operator()(
int x)
const
52 return x > 0 ? std::optional<int>(x) :
std::
nullopt;
58 void operator()()
const {}
63 int operator()(
int acc,
int x)
const {
return acc + x; }
68 void operator()(
int,
int)
const {}
75 bool operator()(
Graph::Node *)
const {
return true; }
80 bool operator()(
Graph::Arc *)
const {
return true; }
95static_assert(
not std::predicate<MaybePositive &, const int &>);
194 int node_info(
Graph::Node * p) {
return p->get_info(); }
230 auto arc_info = [](
Graph::Arc * arc) {
return arc->get_info(); };
Functional programming utilities for Aleph-w containers.
Dynamic heap of elements of type T ordered by a comparison functor.
Doubly-linked list (defined in tpl_dynList.H).
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Arc Arc
The node class type.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Aleph::DynList< T > filter(Operation &operation) const
Filter the elements of a container according to a matching criterion.
__T foldl(const __T &init, Op &op) const
Fold the elements of the container to a specific result.
void mutable_for_each(Operation &operation)
Apply a mutable operation to each element of the container.
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition(Operation &op) const
Exclusive partition of container according to a filter criterion.
auto out_arcs_map(Node *p, Op op) const
Return a list of outcoming arcs of a node mapped to items of type given by transformation op.
bool traverse_nodes(Operation &op) const
Conditioned traversal of all the nodes of a graph.
T foldl_in_arcs(Node *p, const T &init, Op op) const
Fold the incoming arcs of a node.
T foldl_nodes(const T &init, Op op) const
Folding of nodes on a graph.
auto nodes_map(Op op) const
Map the nodes of a graph to a specific range.
T foldl_arcs(const T &init, Op op) const
Folding of arcs on a graph.
auto arcs_map(Op operation) const
Map the arcs of a graph to a specific range.
auto filter_arcs(Op &op) const
Filter the arcs of graph satisfying a condition.
T foldl_out_arcs(Node *p, const T &init, Op op) const
Fold-left over outcoming arcs of a node.
int cmp(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
void for_each_arc(const GT &g, Op operation, SA sa=SA())
Traverse all the arcs of graph filtering some ones according to a condition and executing an operatio...
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
bool forall_arc(const GT &g, Op cond, SA sa=SA())
Return true if condition cond is met on every filtered arc of the graph.
Singly linked list implementations with head-tail access.
Main namespace for Aleph-w library functions.
void each(const size_t start, const size_t end, Op &op)
Execute an operation repeatedly over a range of indices.
size_t size(Node *root) noexcept
Itor::difference_type count_if(Itor beg, const Itor &end, Operation op)
Count elements satisfying a predicate.
void introsort(T *a, const long l, const long r, const Compare &cmp=Compare())
Sort an array using introsort (introspective sort).
Arc of graph implemented with double-linked adjacency lists.
bool operator()(const int &a, const int &b) const
bool operator()(const int &a, const int &b)
Lazy and scalable dynamic array implementation.
Dynamic binary heap with node-based storage.
Generic graph and digraph implementations.
Comprehensive sorting algorithms and search utilities for Aleph-w.