44 using Node =
typename GT::Node;
60 return (Node*) Dlink::Iterator::get_curr_ne();
64 Node *
get_curr()
const {
return (Node*) Dlink::Iterator::get_curr(); }
69 Node * get_current_node_ne()
const {
return get_curr_ne(); }
85 using Node =
typename GT::Node;
86 using Arc =
typename GT::Arc;
98 : Dlink::Iterator(head)
104 return (Arc*) Dlink::Iterator::get_curr_ne();
108 Arc *
get_curr()
const {
return (Arc*) Dlink::Iterator::get_curr(); }
131 return (Node*)
get_curr()->src_node;
137 return (Node*)
get_curr()->tgt_node;
146 template <
class GT,
class Cmp>
149 using Node =
typename GT::Node;
157 bool operator () (Dlink * d1, Dlink * d2)
const noexcept
159 Node * p1 =
static_cast<Node*
>(d1);
160 Node * p2 =
static_cast<Node*
>(d2);
169 template <
class GT,
class Cmp>
172 using Arc =
typename GT::Arc;
176 Cmp_Dlink_Arc(Cmp && __cmp = Cmp()) noexcept : cmp(__cmp) { }
180 bool operator () (Dlink * d1, Dlink * d2)
const noexcept
182 Arc * arc1 =
static_cast<Arc*
>(d1);
183 Arc * arc2 =
static_cast<Arc*
>(d2);
184 return cmp(arc1, arc2);
205 template <
typename NodeInfo>
229 using Item_Type = NodeInfo;
237 GTNodeCommon(
const NodeInfo & info) : node_info(info) {}
239 GTNodeCommon(NodeInfo && info) : node_info(move(info)) {}
242 NodeInfo &
get_info() noexcept {
return node_info; }
245 const NodeInfo &
get_info() const noexcept {
return node_info; }
271 template <
typename ArcInfo>
276 using Item_Type = ArcInfo;
277 using Arc_Type = ArcInfo;
279 void * src_node =
nullptr;
280 void * tgt_node =
nullptr;
292 GTArcCommon(ArcInfo && info) : arc_info(move(info)) {}
294 GTArcCommon(
void * src,
void * tgt,
const ArcInfo & data)
295 : src_node(src), tgt_node(tgt), arc_info(data) {}
297 GTArcCommon(
void * src,
void * tgt, ArcInfo && data = ArcInfo())
298 : src_node(src), tgt_node(tgt), arc_info(move(data)) {}
310 const ArcInfo &
get_info() const noexcept {
return arc_info; }
312 void * get_connected_node(
void * node) noexcept
314 return src_node == node ? tgt_node : src_node;
317 void * get_img_node(
void * node) noexcept
319 return src_node == node ? src_node : tgt_node;
328 template <
class GT,
class Node,
class Arc>
331 GT * me() {
return static_cast<GT*
>(
this); }
333 const GT * const_me()
const {
return static_cast<const GT*
>(
this); }
337 void * cookie =
nullptr;
338 size_t num_nodes = 0;
340 bool digraph =
false;
344 using Node_Type =
typename Node::Node_Type;
345 using Arc_Type =
typename Arc::Arc_Type;
351 num_nodes = num_arcs = 0;
356 void common_swap(GT & g) noexcept
358 std::swap(num_nodes, g.num_nodes);
359 std::swap(num_arcs, g.num_arcs);
360 std::swap(digraph, g.digraph);
361 std::swap(cookie, g.cookie);
414 size_t vsize() const noexcept {
return get_num_nodes(); }
424 Node *
get_node()
const {
return const_me()->get_first_node(); }
434 Node *
get_arc()
const {
return const_me()->get_first_arc(); }
444 Node *
get_arc(Node * p) {
return const_me()->get_first_arc(p); }
449 return (Node*) arc->src_node;
455 return (Node*) arc->tgt_node;
490 return (Node*) arc->get_connected_node(node);
500 return node->num_arcs;
505 size_t degree(Node * p)
const noexcept {
return get_num_arcs(p); }
508 size_t esize() const noexcept {
return get_num_arcs(); }
526 int get_bit(Node * node,
int bit)
const noexcept
532 void set_bit(Node * node,
int bit,
int value)
const noexcept
553 int get_bit(Arc * arc,
int bit)
const noexcept
559 void set_bit(Arc * arc,
int bit,
int value)
const noexcept
617 for_each_arc([
this] (
auto a) { this->reset_counter(a); });
703 template <
class N1,
class N2 = N1>
static 706 assert(p !=
nullptr and q !=
nullptr);
731 template <
class A1,
class A2 = A1>
static 734 assert(p !=
nullptr and q !=
nullptr);
748 for_each_node([bit,
this] (
auto p) { this->reset_bit(p, bit); });
754 for_each_arc([bit,
this] (
auto a) { this->reset_bit(a, bit); });
778 for_each_arc([
this] (
auto a) { this->reset_counter(a); });
824 return me()->insert_node(
new Node (node_info));
848 return me()->insert_node(
new Node(std::forward<Node_Type>(node_info)));
871 template <
typename ...Args>
874 return me()->insert_node(Node_Type(args...));
899 Arc *
insert_arc(Node * src, Node * tgt,
const Arc_Type & arc_info)
901 std::unique_ptr<Arc> arc(
new Arc(arc_info));
902 me()->insert_arc(src, tgt, arc.get());
903 return arc.release();
929 Arc *
insert_arc(Node * src, Node * tgt, Arc_Type && arc_info = Arc_Type())
931 std::unique_ptr<Arc> arc(
new Arc(std::forward<Arc_Type>(arc_info)));
932 me()->insert_arc(src, tgt, arc.get());
933 return arc.release();
957 template <
typename ...Args>
960 return me()->insert_arc(src, tgt, Arc_Type(args...));
1009 template <
class Operation>
1012 for (
typename GT::Node_Iterator it(*const_me()); it.has_curr(); it.next_ne())
1013 if (not op(it.get_curr_ne()))
1019 template <
class Operation>
1022 return traverse_nodes(op);
1074 template <
class Operation>
1077 for (
typename GT::Arc_Iterator it(*const_me()); it.has_curr(); it.next_ne())
1078 if (not op(it.get_curr_ne()))
1084 template <
class Operation>
1141 template <
class Operation>
1144 for (
typename GT::Node_Arc_Iterator it(p); it.has_curr(); it.next_ne())
1145 if (not op(it.get_curr_ne()))
1151 template <
class Operation>
1153 const noexcept(noexcept(op))
1182 template <
class Operation>
1185 for (
typename GT::Node_Iterator it(*const_me()); it.has_curr(); it.next_ne())
1186 operation(it.get_curr_ne());
1190 template <
class Operation>
1220 template <
class Operation>
1223 for (
typename GT::Arc_Iterator it(*const_me()); it.has_curr(); it.next_ne())
1224 op(it.get_curr_ne());
1228 template <
class Operation>
1267 template <
class Operation>
1270 for (
typename GT::Node_Arc_Iterator it(p); it.has_curr(); it.next_ne())
1271 op(it.get_curr_ne());
1275 template <
class Operation>
1277 const noexcept(noexcept(op))
1311 template <
class Operation>
1314 return traverse_nodes(op);
1318 template <
class Operation>
1319 bool all_nodes(Operation && op = Operation()) const noexcept(noexcept(op))
1321 return all_nodes(op);
1353 template <
class Operation>
1354 bool all_arcs(Operation & op)
const noexcept(noexcept(op))
1360 template <
class Operation>
1361 bool all_arcs(Operation && op = Operation()) const noexcept(noexcept(op))
1363 return all_arcs(op);
1398 template <
class Operation>
1399 bool all_arcs(Node * p, Operation & op)
const noexcept(noexcept(op))
1405 template <
class Operation>
1407 const noexcept(noexcept(op))
1409 return all_arcs(p, op);
1452 template <
typename T = Node_Type>
1456 for_each_node([&ret_val, &op] (Node * p) { ret_val.append(op(p)); });
1499 template <
typename T = Arc_Type>
1505 ret_val.append(operation(p));
1550 template <
typename T = Arc_Type>
1551 auto arcs_map(Node * p, std::function<T(Arc *)> operation)
const 1556 ret_val.append(operation(a));
1595 template <
typename T = Node_Type>
1597 std::function<T(
const T&, Node*)> op)
const 1600 for_each_node([&ret, &op] (Node * p) { ret = op(ret, p); });
return ret;
1636 template <
typename T = Arc_Type>
1638 std::function<T(
const T&, Arc*)> op)
const 1641 for_each_arc([&ret, &op] (Arc * p) { ret = op(ret, p); });
1679 template <
typename T = Arc_Type>
1681 std::function<T(
const T&, Arc*)> op)
const 1684 for_each_arc(p, [&ret, &op] (Arc * a) { ret = op(ret, a); });
1723 return filter_nodes(op);
1761 return filter_arcs(op);
1808 return filter_arcs(p, op);
1829 template <
class Operation>
1832 return not traverse_nodes([&op] (Node * p) {
return not op(p); });
1836 template <
class Operation>
1837 bool exists_node(Operation && op = Operation()) const noexcept(noexcept(op))
1839 return exists_node(op);
1860 template <
class Operation>
1863 return not
traverse_arcs([&op] (Arc * a) {
return not op(a); });
1867 template <
class Operation>
1868 bool exists_arc(Operation && op = Operation()) const noexcept(noexcept(op))
1870 return exists_arc(op);
1895 template <
class Operation>
1896 bool exists_arc(Node * p, Operation & op)
const noexcept(noexcept(op))
1898 return not
traverse_arcs(p, [&op] (Arc * a) {
return not op(a); });
1902 template <
class Operation>
1904 const noexcept(noexcept(op))
1906 return exists_arc(p, op);
1928 for (
typename GT::Node_Iterator it(*const_me()); it.has_curr(); it.next_ne())
1930 auto p = it.get_curr_ne();
1941 return search_node(op);
1957 return search_node([&info] (
auto p) {
return p->get_info() == info; });
1979 for (
typename GT::Arc_Iterator it(*const_me()); it.has_curr(); it.next_ne())
1981 auto a = it.get_curr_ne();
2008 return search_arc([&info] (
auto a) {
return a->get_info() == info; });
2029 template <
class Operation>
2030 Arc *
search_arc(Node * p, Operation & op)
const noexcept(noexcept(op))
2032 for (
typename GT::Node_Arc_Iterator it(p); it.has_curr(); it.next_ne())
2034 Arc * arc = it.get_curr_ne();
2042 template <
class Operation>
2044 const noexcept(noexcept(op))
2074 for (
typename GT::Node_Arc_Iterator it(src); it.has_curr(); it.next_ne())
2075 if (it.get_tgt_node_ne() == tgt)
2076 return it.get_curr_ne();
2093 Container<Node*> ret;
2111 Container<Arc*> ret;
2127 Container<Arc*>
arcs(Node * p)
const 2129 Container<Arc*> ret;
2130 this->
for_each_arc(p, [&ret] (Arc * a) { ret.append(a); });
2153 return typename GT::Node_Iterator(*const_me());
2175 return typename GT::Arc_Iterator(*const_me());
2198 return typename GT::Node_Arc_Iterator(p);
2235 Node * tgt =
nullptr;
2238 In_Filt(Node * __tgt =
nullptr) noexcept : tgt(__tgt) { }
2242 bool operator () (Arc * a)
const noexcept
2245 return a->tgt_node == tgt;
2252 return (
typename GT::Node *) a->src_node;
2290 Node * src =
nullptr;
2297 bool operator () (Arc * a)
const noexcept
2300 return a->src_node == src;
2307 return (Node *) a->tgt_node;
2336 template <
class Filter>
2346 using Item_Type =
typename Itor::Item_Type;
2352 noexcept(noexcept(Filter(p)) and noexcept(
Itor(p, filt)))
2353 : filt(p), it(p, filt)
2358 void next_ne() noexcept { it.next_ne(); }
2368 void prev_ne() { it.prev_ne(); }
2377 typename GT::Arc *
get_curr_ne()
const noexcept {
return it.get_curr_ne(); }
2382 auto get_current_arc_ne()
const noexcept {
return get_curr_ne(); }
2386 typename GT::Node *
get_node(
typename GT::Arc * a)
const noexcept
2388 return filt.get_node(a);
2401 typename GT::Node * get_node()
const 2403 return this->get_node(this->
get_curr());
2477 for (
typename GT::Out_Iterator it(src); it.
has_curr(); it.next_ne())
2479 return it.get_curr_ne();
2532 ret.append(it.get_curr_ne());
2548 ret.append(it.get_curr_ne());
2572 auto a = it.get_curr_ne();
2573 ret.append(make_tuple(a, (Node*) a->get_connected_node(p)));
2595 auto a = it.get_curr_ne();
2596 ret.append(make_tuple(a, (Node*) a->get_connected_node(p)));
2663 template <
class Itor,
class Operation>
2666 for (Itor it(p); it.
has_curr(); it.next_ne())
2667 if (not op(it.get_curr_ne()))
2673 template <
class Itor,
class Operation>
2676 for (Itor it(p); it.
has_curr(); it.next_ne())
2677 operation(it.get_curr_ne());
2685 return traverse_arcs<In_Iterator, Op>(p, op);
2704 void for_each_in_arc(Node * p, Op && op = Op())
const noexcept(noexcept(op))
2718 bool all_in_arcs(Node * p, Op && op = Op()) const noexcept(noexcept(op))
2720 return all_in_arc(p, op);
2735 return exists_in_arc(p, op);
2754 Arc * ret =
nullptr;
2771 return search_in_arc(p, op);
2782 template <
typename T>
2784 const noexcept(noexcept(op))
2798 template <
typename T = Arc_Type>
2800 std::function<T(
const T&, Arc*)> op)
2801 const noexcept(noexcept(op))
2831 return filter_in_arcs(p, op);
2845 const noexcept(noexcept(op))
2875 return all_out_arc(p, op);
2890 return exists_out_arc(p, op);
2908 typename GT::Arc * ret =
nullptr;
2925 return search_out_arc(p, op);
2936 template <
typename T = Arc_Type>
2945 template <
typename T = Arc_Type>
2947 std::function<T(
const T&, Arc*)> op)
2948 const noexcept(noexcept(op))
2978 return filter_out_arcs(p, op);
2984 # endif // GRAPH_DRY_H Arc * search_arc(Op &&op) const noexcept(noexcept(op))
Definition: graph-dry.H:1990
auto arcs_map(Node *p, std::function< T(Arc *)> operation) const
Definition: graph-dry.H:1551
Node * get_tgt_node_ne() const noexcept
Return the target node of current arc (if it is a directed graph)
Definition: graph-dry.H:123
Bit_Fields & get_control_bits(Node *node) const noexcept
Return a reference to control fields of node
Definition: graph-dry.H:511
bool all_in_arcs(Node *p, Op &op) const noexcept(noexcept(op))
Return true if op is true for all the incoming arcs to node p
Definition: graph-dry.H:2711
DynList< Arc * > out_arcs(Node *p) const
Definition: graph-dry.H:2528
void for_each_in_arc(typename GT::Node *p, Op op=Op()) noexcept(noexcept(op))
Definition: tpl_graph.H:2077
NodeInfo & get_info() noexcept
Return a modifiable reference to the data contained in the node.
Definition: graph-dry.H:242
size_t out_degree(Node *p) const noexcept
Definition: graph-dry.H:2637
auto filter_arcs(Op &&op) const
Definition: graph-dry.H:1759
void reset_node(Node *p) const noexcept
Definition: graph-dry.H:597
void for_each_arc(Node *p, Operation &op) const noexcept(noexcept(op))
Perform operation on each arc of node p
Definition: graph-dry.H:2674
auto out_pairs(Node *p) const
Definition: graph-dry.H:2590
Node * get_src_node_ne() const noexcept
Return the sourcenode of current arc (if it is a directed graph)
Definition: graph-dry.H:117
size_t get_num_arcs(Node *node) const noexcept
Definition: graph-dry.H:498
auto in_arcs_map(Node *p, std::function< T(Arc *)> op) const noexcept(noexcept(op))
Definition: graph-dry.H:2783
Arc * insert_arc(Node *src, Node *tgt, Arc_Type &&arc_info=Arc_Type())
Definition: graph-dry.H:929
bool traverse_out_arcs(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2844
#define ARC_COUNTER(p)
Definition: aleph-graph.H:339
Node * get_connected_node(Arc *arc, Node *node) const noexcept
Definition: graph-dry.H:488
bool all_arcs(Node *p, Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1399
auto get_arc_it() const noexcept
Definition: graph-dry.H:2173
Definition: graph-dry.H:170
bool is_digraph() const noexcept
Return true if the graph this is directed.
Definition: graph-dry.H:373
void reset_cookie_arcs() const noexcept
Definition: graph-dry.H:798
void reset_node_counters() const noexcept
Reset all the node counters of graph to zero.
Definition: graph-dry.H:589
Array_Graph Set_Type
The type of container on which iterate.
Definition: graph-dry.H:92
#define NODE_COOKIE(p)
Definition: aleph-graph.H:333
void reset_counter(Arc *arc) const noexcept
Reset the acr counter to zero.
Definition: graph-dry.H:609
Out_Iterator get_out_it(Node *p) const noexcept
Definition: graph-dry.H:2463
Node * get_node() const
Definition: graph-dry.H:424
Node * get_node(Arc *a) const noexcept
Return the source node of arc a (whose target is tgt)
Definition: graph-dry.H:2304
long & get_counter(Node *node) const noexcept
Get a modifiable reference to the counter of node
Definition: graph-dry.H:577
size_t degree(Node *p) const noexcept
Definition: graph-dry.H:505
T foldl_in_arcs(Node *p, const T &init, std::function< T(const T &, Arc *)> op) const noexcept(noexcept(op))
Definition: graph-dry.H:2799
GTNodeIterator(Dlink &head) noexcept
Build a iterator for all the nodes of g.
Definition: graph-dry.H:55
Node * insert_node(Node_Type &&node_info=Node_Type())
Definition: graph-dry.H:846
Node * emplace_node(Args &&... args)
Definition: graph-dry.H:872
Arc * get_curr_ne() const noexcept
Return current arc without exception.
Definition: graph-dry.H:102
GTArcIterator(Dlink &head) noexcept
Build a iterator for all the arcs of g.
Definition: graph-dry.H:97
bool exists_node(Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1837
void reset_bits(Node *node) const noexcept
Reset all the control bits of node
Definition: graph-dry.H:523
auto get_arc_it(Node *p) const noexcept
Definition: graph-dry.H:2196
Container< Node * > nodes() const
Definition: graph-dry.H:2091
bool traverse_arcs(typename GT::Node *p, Operation op=Operation()) noexcept(noexcept(op))
Definition: tpl_graph.H:2017
void for_each_arc(Node *p, Operation &&op=Operation()) const noexcept(noexcept(op))
for_each_arc(Node * p, Operation & operation)
Definition: graph-dry.H:1276
void reset_arc_counters() const noexcept
Reset all the arc counters of graph to zero.
Definition: graph-dry.H:615
Arc * search_arc(Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1977
Node * search_node(Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1926
bool all_arcs(Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1361
void for_each_out_arc(Node *p, Op &op) const noexcept(noexcept(op))
Perform operation on each incoming arc of node p
Definition: graph-dry.H:2852
bool traverse_in_arcs(typename GT::Node *p, Op op=Op()) noexcept(noexcept(op))
Definition: tpl_graph.H:2064
bool all_out_arcs(Node *p, Op &op) const noexcept(noexcept(op))
Return true if op is true for all the outcoming arcs to node p
Definition: graph-dry.H:2866
bool exists_in_arc(Node *p, Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2726
const ArcInfo & get_info() const noexcept
Return a constant reference to the arc data.
Definition: graph-dry.H:310
Node * get_tgt_node() const
Return the target node of current arc (if it is a directed graph)
Definition: graph-dry.H:135
auto get_node_it() const noexcept
Definition: graph-dry.H:2151
Node * get_node(Arc *a) const noexcept
Return the source node of arc a
Definition: graph-dry.H:2249
void reset_bit(Node *node, int bit) const noexcept
Reset the bit of node (to zero)
Definition: graph-dry.H:517
Graph_Attr attrs
Definition: graph-dry.H:214
bool all_arcs(Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1354
bool all_arcs(Node *p, Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1406
Node * get_current_node() const
Return the current node.
Definition: graph-dry.H:67
int get_bit(Arc *arc, int bit) const noexcept
Get the control bit of arc
Definition: graph-dry.H:553
int get_bit(Node *node, int bit) const noexcept
Get the control bit of node
Definition: graph-dry.H:526
Node * insert_node(const Node_Type &node_info)
Definition: graph-dry.H:822
Arc * get_current_arc_ne() const noexcept
Return the current arc without exception.
Definition: graph-dry.H:114
bool has_curr() const noexcept
Return true is the iterator has a current arc.
Definition: graph-dry.H:2371
auto filter_out_arcs(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2976
auto filter_in_arcs(Node *p, Op &&op=Op()) const
Definition: graph-dry.H:2829
GT::Node * get_node(typename GT::Arc *a) const noexcept
Definition: graph-dry.H:2386
void reset_arc(Arc *arc) const noexcept
Definition: graph-dry.H:623
T foldl_out_arcs(Node *p, const T &init, std::function< T(const T &, Arc *)> op) const noexcept(noexcept(op))
Definition: graph-dry.H:2946
auto filter_arcs(Node *p, Op &&op) const
Definition: graph-dry.H:1806
auto out_arcs_map(Node *p, std::function< T(Arc *)> op) const
Definition: graph-dry.H:2937
Node * get_src_node() const
Return the sourcenode of current arc (if it is a directed graph)
Definition: graph-dry.H:129
bool traverse_arcs(Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1085
Node * search_node(Op &&op) const noexcept(noexcept(op))
Definition: graph-dry.H:1939
Node * get_arc() const
Definition: graph-dry.H:434
void set_digraph(bool val)
Definition: graph-dry.H:408
#define ARC_COOKIE(p)
Definition: aleph-graph.H:366
Definition: graph-dry.H:83
#define NODE_COUNTER(p)
Definition: aleph-graph.H:311
void reset_bits(Arc *arc) const noexcept
Reset all the control bits of arc
Definition: graph-dry.H:550
void * get_cookie() const noexcept
Return a constant reference to graph's cookie.
Definition: graph-dry.H:370
bool all_nodes(Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1312
void reset_bit_arcs() const noexcept
Reset all the bits for all the arcs of graph.
Definition: graph-dry.H:764
auto arcs_map(std::function< T(Arc *)> operation) const
Definition: graph-dry.H:1500
void for_each_arc(const GT &g, std::function< void(typename GT::Arc *)> operation, SA sa=SA()) noexcept(noexcept(operation) and noexcept(sa))
Definition: tpl_graph.H:1325
In_Filt(Node *__tgt=nullptr) noexcept
target node of iteration
Definition: graph-dry.H:2238
void reset_bit(Arc *arc, int bit) const noexcept
Reset the bit of arc to zero.
Definition: graph-dry.H:544
auto search_in_arc(Node *p, Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2752
Definition: graph-dry.H:272
Digraph_Iterator< Out_Filt > Out_Iterator
Definition: graph-dry.H:2423
Definition: graph-dry.H:2337
Node * get_curr() const
Return the current node.
Definition: graph-dry.H:64
void for_each_out_arc(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2859
T foldl_arcs(Node *p, const T &init, std::function< T(const T &, Arc *)> op) const
Definition: graph-dry.H:1680
void for_each_arc(Node *p, Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1268
Definition: graph-dry.H:329
Definition: graph-dry.H:2233
Arc * search_directed_arc(Node *src, Node *tgt) const noexcept
Definition: graph-dry.H:2475
GT::Node * get_node_ne() const noexcept
Definition: graph-dry.H:2393
bool exists_node(Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1830
Node * Item_Type
The type of item that returns the iterator.
Definition: graph-dry.H:47
Definition: graph-dry.H:42
Node * get_curr_ne() const noexcept
Return the current node without exception.
Definition: graph-dry.H:58
bool all_in_arcs(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2718
Recorre condicionalmente el contenedor y ejecuta una operation mientras ésta retorne true...
void *& get_cookie(Node *node) const noexcept
Get a modifiable reference to the cookie pointer of node
Definition: graph-dry.H:565
auto filter_arcs(Op &op) const
Definition: graph-dry.H:1747
auto in_pairs(Node *p) const
Definition: graph-dry.H:2567
bool traverse_arcs(Node *p, Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1142
void next()
Definition: graph-dry.H:2362
DynList< Arc * > filter_in_arcs(Node *p, Op &op) const
Definition: graph-dry.H:2816
void for_each_node(const GT &g, std::function< void(typename GT::Node *)> operation, SN sn=SN()) noexcept(noexcept(operation) and noexcept(sn))
Definition: tpl_graph.H:1306
bool traverse_arcs(Node *p, Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2664
Definition: graph-dry.H:206
Arc * search_arc(Node *p, Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2030
Arc * Item_Type
The type of item that returns the iterator.
Definition: graph-dry.H:89
DynList< Node * > out_nodes(Node *p) const
Definition: graph-dry.H:2511
auto filter_nodes(Op &op) const
Definition: graph-dry.H:1709
static void map_arcs(A1 *p, A2 *q) noexcept
Definition: graph-dry.H:732
Bit_Fields & get_control_bits(Arc *arc) const noexcept
Return a reference to the control bits of arc
Definition: graph-dry.H:538
Node_Info Node_Type
The node.
Definition: graph-dry.H:233
void for_each_node(Operation &operation) const noexcept(noexcept(operation))
Definition: graph-dry.H:1183
Arc * get_current_arc() const
Return the current arc.
Definition: graph-dry.H:111
unsigned int state() const noexcept
Return the state of arc.
Definition: graph-dry.H:301
List_Graph Set_Type
The type of container on which iterate.
Definition: graph-dry.H:50
void reset_last() noexcept
Reset the iterator to last arc.
Definition: graph-dry.H:2413
Graph_Attr attrs
Please don't use.
Definition: graph-dry.H:286
auto nodes_map(std::function< T(Node *)> op) const
Definition: graph-dry.H:1453
DynList< Arc * > filter_out_arcs(Node *p, Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2963
Container< Arc * > arcs() const
Definition: graph-dry.H:2109
tuple< __Graph_Arc *, __Graph_Node *> ArcPair
Pair of arc and node (topologically related)
Definition: graph-dry.H:2553
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Definition: graph-dry.H:447
Node * get_arc(Node *p)
Definition: graph-dry.H:444
void for_each_node(Operation &&operation=Operation()) const
Definition: graph-dry.H:1191
unsigned int state() const noexcept
Return the state's value.
Definition: graph-dry.H:248
void reset_first() noexcept
Reset the iterator to first arc.
Definition: graph-dry.H:2410
auto get_tgt_node() const
Definition: graph-dry.H:2407
void for_each_arc(Operation &&operation=Operation()) const
Definition: graph-dry.H:1229
GT::Arc * search_arc(const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept
Definition: tpl_graph.H:2381
size_t vsize() const noexcept
get_num_nodes()
Definition: graph-dry.H:414
void reset_counter_arcs() const noexcept
Reset all the counters to zero for all the arcs of graph.
Definition: graph-dry.H:776
#define NODE_BITS(p)
Definition: aleph-graph.H:305
Digraph_Iterator< Filt > Filter_Iterator
Definition: graph-dry.H:2417
bool exists_arc(Node *p, Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1903
void prev()
Definition: graph-dry.H:2366
bool traverse_arcs(Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1075
void for_each_in_arc(Node *p, Op &op) const noexcept(noexcept(op))
Perform operation on each incoming arc of node p
Definition: graph-dry.H:2697
Arc * search_arc(Node *p, Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:2043
bool exists_out_arc(Node *p, Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2881
bool all_out_arcs(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2873
bool exists_arc(Node *p, Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1896
bool traverse_in_arcs(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2690
GTArcCommon(const ArcInfo &info)
data contained in arc
Definition: graph-dry.H:290
void set_state(unsigned int s) noexcept
Set the state to value s
Definition: graph-dry.H:251
void reset_bit_nodes() const noexcept
Reset all the bits for all the nodes of graph.
Definition: graph-dry.H:758
bool all_nodes(Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1319
void *& get_cookie(Arc *arc) const noexcept
Get a modifiable reference to the cookie pointer of arc
Definition: graph-dry.H:571
bool exists_out_arc(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2888
void for_each_arc(Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1221
size_t get_num_arcs() const noexcept
Definition: graph-dry.H:494
bool traverse_arcs(Node *p, Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1152
Arc * find_arc(const Arc_Type &info) const noexcept
Definition: graph-dry.H:2006
DynList< Arc * > in_arcs(Node *p) const
Definition: graph-dry.H:2544
void reset_cookie_nodes() const noexcept
Definition: graph-dry.H:787
Arc * emplace_arc(Node *src, Node *tgt, Args &&... args)
Definition: graph-dry.H:958
static void map_nodes(N1 *p, N2 *q) noexcept
Definition: graph-dry.H:704
bool exists_arc(Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1861
GTNodeCommon() noexcept
another alias for set type
Definition: graph-dry.H:235
void reset_nodes() const
Definition: graph-dry.H:630
#define ARC_BITS(p)
Definition: aleph-graph.H:351
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
Definition: graph-dry.H:453
GT::Arc * get_curr() const
Definition: graph-dry.H:2375
void set_state(unsigned int s) noexcept
Set the state of arc to value s
Definition: graph-dry.H:304
auto get_tgt_node_ne() const noexcept
Definition: graph-dry.H:2399
void *& get_cookie() noexcept
Return a modifiable reference to graph's cookie.
Definition: graph-dry.H:367
auto search_out_arc(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2923
long & get_counter(Arc *arc) const noexcept
Get a modifiable reference to the counter of arc
Definition: graph-dry.H:603
void reset_arcs() const
Definition: graph-dry.H:637
bool traverse_nodes(Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1020
size_t in_degree(Node *p) const noexcept
Definition: graph-dry.H:2614
void for_each_out_arc(typename GT::Node *p, Op op=Op()) noexcept(noexcept(op))
Definition: tpl_graph.H:2234
Out_Filt(Node *__src) noexcept
source node of iteration
Definition: graph-dry.H:2293
Digraph_Iterator(Node *p) noexcept(noexcept(Filter(p)) and noexcept(Itor(p, filt)))
Instantiate an filtered iterator for arcs on the node p
Definition: graph-dry.H:2351
void set_bit(Node *node, int bit, int value) const noexcept
Set the control bit of node to value
Definition: graph-dry.H:532
void reset_bit_arcs(int bit) const noexcept
Reset bit to zero for all the arcs of graph.
Definition: graph-dry.H:752
Arc * insert_arc(Node *src, Node *tgt, const Arc_Type &arc_info)
Definition: graph-dry.H:899
In_Iterator get_in_it(Node *p) const noexcept
Definition: graph-dry.H:2443
const NodeInfo & get_info() const noexcept
Return a constant reference to the data contained in the node.
Definition: graph-dry.H:245
auto search_out_arc(Node *p, Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2906
bool exists_arc(Operation &&op=Operation()) const noexcept(noexcept(op))
Definition: graph-dry.H:1868
Node * find_node(const Node_Type &info) const noexcept
Definition: graph-dry.H:1955
void reset_counter_nodes() const noexcept
Reset all the counters to zero for all the nodes of graph.
Definition: graph-dry.H:770
auto filter_nodes(Op &&op) const
Definition: graph-dry.H:1721
ArcInfo & get_info() noexcept
Return a modifiable reference to the arc data.
Definition: graph-dry.H:307
size_t esize() const noexcept
Return the total of arcs of graph.
Definition: graph-dry.H:508
Definition: graph-dry.H:2288
bool exists_in_arc(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2733
auto search_in_arc(Node *p, Op &&op=Op()) const noexcept(noexcept(op))
Definition: graph-dry.H:2769
bool traverse_nodes(Operation &op) const noexcept(noexcept(op))
Definition: graph-dry.H:1010
bool traverse_out_arcs(typename GT::Node *p, Op op=Op()) noexcept(noexcept(op))
Definition: tpl_graph.H:2221
T foldl_nodes(const T &init, std::function< T(const T &, Node *)> op) const
Definition: graph-dry.H:1596
size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
Definition: graph-dry.H:411
auto get_current_arc() const
Definition: graph-dry.H:2380
void set_bit(Arc *arc, int bit, int value) const noexcept
Set the control bit of arc to value
Definition: graph-dry.H:559
void reset_bit_nodes(int bit) const noexcept
Reset bit to zero for all the nodes of graph.
Definition: graph-dry.H:746
Digraph_Iterator< In_Filt > In_Iterator
Definition: graph-dry.H:2420
bool traverse_out_arcs(Node *p, Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2837
Container< Arc * > arcs(Node *p) const
Definition: graph-dry.H:2127
Arc * search_arc(Node *src, Node *tgt) const noexcept
Definition: graph-dry.H:2072
DynList< Node * > in_nodes(Node *p) const
Definition: graph-dry.H:2493
Arc * get_curr() const
Return current arc.
Definition: graph-dry.H:108
Definition: graph-dry.H:147
void reset_counter(Node *node) const noexcept
Reset the node counter to zero.
Definition: graph-dry.H:583
T foldl_arcs(const T &init, std::function< T(const T &, Arc *)> op) const
Definition: graph-dry.H:1637
auto filter_arcs(Node *p, Op &op) const
Definition: graph-dry.H:1794
bool traverse_in_arcs(Node *p, Op &op) const noexcept(noexcept(op))
Definition: graph-dry.H:2683