68# ifndef TPL_INDEXARC_H
69# define TPL_INDEXARC_H
134 return std::less<void*>{}(a, b);
144 return { a->src_node, a->tgt_node };
146 auto u = a->src_node;
147 auto v = a->tgt_node;
181 auto p =
index.contains_or_insert(e);
256 <<
"There is already an arc between these nodes";
271 <<
"There is already an arc between these nodes";
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
Index for fast arc lookup by its endpoint nodes.
GT_Arc * search(void *src, void *tgt) const
Search an arc that connects two nodes.
void build_index()
Insert into the index all arcs currently present in the graph.
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, GT_Arc_Type &&info=GT_Arc_Type())
void remove_from_graph(GT_Arc *a)
Remove an arc from both index and graph.
void remove(GT_Arc *e)
Remove an arc from the index.
size_t size() const
Return the number of arcs currently stored in the index.
GT_Arc * search_directed(void *src, void *tgt) const
Search an arc that connects two nodes as a directed pair.
IndexArc(GT &__g, bool with_init, SA &__sa)
Construct an arc index for a graph (lvalue filter overload).
void clear_index()
Remove all arcs from the index.
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, const GT_Arc_Type &info)
Create a new arc between two nodes, insert it into the graph and index it.
DynSetTree< GT_Arc *, Tree, Cmp_Arc > index
IndexArc(GT &__g, bool with_init=true, SA &&__sa=SA())
Construct an arc index for a graph.
GT_Arc * insert(GT_Arc *e)
Insert an arc pointer into the index.
GT::Node_Type GT_Node_Type
GT_Arc * search(GT_Arc *a) const
Search an arc by using its endpoint pointers.
typename Node::Node_Type Node_Type
The arc class type.
virtual void remove_arc(Arc *arc) noexcept
Remove an arc from the graph and free it.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
typename Arc::Arc_Type Arc_Type
The type of data stored in the arc.
void * tgt_node
Please don't use.
List_Graph< Graph_Node< int >, Graph_Arc< int > > GT
Main namespace for Aleph-w library functions.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Filtered iterator on all the arcs of a graph.
Default filter for filtered iterators on arcs.
Arc of graph implemented with double-linked adjacency lists.
bool operator()(const GT_Arc *a1, const GT_Arc *a2) const
static std::pair< void *, void * > endpoints(const GT_Arc *a, const bool directed) noexcept
Cmp_Arc(bool __directed) noexcept
static bool ptr_less(void *a, void *b) noexcept
Dynamic set implementations based on balanced binary search trees.
Generic graph and digraph implementations.