38#include <gtest/gtest.h>
56 return (a->get_info() % 2) == 0;
85 auto n1 = g.insert_node(1);
86 auto n2 = g.insert_node(2);
87 auto a12 = g.insert_arc(n1, n2, 10);
95 auto a21 = g.insert_arc(n2, n1, 20);
128 dummy->src_node = n1;
129 dummy->tgt_node = n2;
Generic directed graph (digraph) wrapper template.
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.
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.
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.
GT_Arc * insert(GT_Arc *e)
Insert an arc pointer into the index.
Graph implemented with double-linked adjacency lists.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
_Graph_Arc Arc
The node class type.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
constexpr size_t get_num_arcs() const noexcept
GT::Arc * search_arc(const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept
Arc filtered searching given two nodes.
Main namespace for Aleph-w library functions.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Arc of graph implemented with double-linked adjacency lists.
Generic graph and digraph implementations.
Arc indexing for fast lookup by endpoint nodes.