67# ifndef TPL_INDEXGRAPH
68# define TPL_INDEXGRAPH
116template <
class GT,
class Compare = Dft_Node_Cmp<GT>,
117 template <
class ,
class >
class Tree =
Treap>
163 <<
"src node not in index";
166 <<
"tgt node not in index";
205 return idx_arc.search(src, tgt);
216 for (
typename GT::Node_Arc_Iterator it(p); it.has_curr(); it.next_ne())
219 return idx_node.remove_from_graph(p);
225 return idx_arc.remove_from_graph(a);
235 template <AlephGraph GT>
inline
238 if (
g1.vsize() !=
g2.vsize()
or g1.esize() !=
g2.esize())
243 if (
not g1.all_nodes([&
t2] (
auto p)
245 auto q = t2.search(p);
255 return g1.all_arcs([idx = &
t2, &
g1] (
auto a)
257 auto s1 =
g1.get_src_node(a);
258 auto t1 =
g1.get_tgt_node(a);
261 auto a2 = idx->search(
s2,
t2);
264 return a2->get_info() == a->get_info();
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
Index for fast arc lookup by its endpoint nodes.
Builds an index of nodes for fast search and retrieval.
Builds node and arc indices for fast lookup and retrieval.
size_t get_num_arcs() const
Returns the number of arcs the index contains.
GT_Node * search_node(GT_Node *p)
Looks up a node in the index.
GT_Node * search_node(const GT_Node_Type &info)
Looks up a node in the index.
IndexArc< GT, Tree > idx_arc
GT_Arc * search_arc(GT_Node *src, GT_Node *tgt)
Looks up an arc in the index given its two nodes.
void remove_node(GT_Node *p)
Removes node p from the graph and from the index.
size_t get_num_nodes() const
Returns the number of nodes the index contains.
GT_Node * insert_node(const GT_Node_Type &info)
Creates a new node and inserts it into the graph and the index.
Index_Graph(GT &g)
Creates an index of the graph: nodes and arcs are indexed.
IndexNode< GT, Compare, Tree > idx_node
void remove_arc(GT_Arc *a)
Removes arc a from the graph and from the index.
GT_Arc * insert_arc(GT_Node *src, GT_Node *tgt, const GT_Arc_Type &info=GT_Arc_Type())
Creates a new arc between two nodes and inserts it into the graph and the index.
GT::Node_Type GT_Node_Type
typename Node::Node_Type Node_Type
The arc class type.
typename Arc::Arc_Type Arc_Type
The type of data stored in the arc.
QuadTree - Hierarchical spatial index for 2D points.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
bool are_equal(const GT &g1, const GT &g2)
Fast graph comparison.
Treap (a special type of randomized binary search tree) using nodes without virtual destructor.
Arc indexing for fast lookup by endpoint nodes.
Node indexing for fast O(log n) lookup by key.