8 static const long No_Visited = 0;
51 unsigned int depth_first : 1;
87 throw(std::exception, std::out_of_range)
91 case Aleph::Depth_First:
return depth_first;
97 case Aleph::Kruskal:
return kruskal;
98 case Aleph::Prim:
return prim;
99 case Aleph::Dijkstra:
return dijkstra;
100 case Aleph::Euler:
return euler;
105 case Aleph::Cut:
return cut;
106 case Aleph::Min:
return min;
108 throw std::out_of_range(
"bit number out of range");
124 void set_bit(
const int & bit,
const int & value)
126 I(value == 0 or value == 1);
130 case Aleph::Depth_First: depth_first = value;
break;
132 case Aleph::Test_Cycle:
test_cycle = value;
break;
134 case Aleph::Test_Path:
test_path = value;
break;
135 case Aleph::Find_Path:
find_path = value;
break;
136 case Aleph::Kruskal:
kruskal = value;
break;
137 case Aleph::Prim:
prim = value;
break;
138 case Aleph::Dijkstra:
dijkstra = value;
break;
139 case Aleph::Euler:
euler = value;
break;
144 case Aleph::Cut:
cut = value;
break;
145 case Aleph::Min:
min = value;
break;
147 throw std::out_of_range(
"bit number out of range");
187 # define GRAPH_NODE_COMMON(GT_Node_Name) \
189 typedef Node_Info Item_Type; \
190 typedef GT_Node_Name Node; \
191 typedef Node_Info Node_Type; \
192 Node_Info node_info; \
193 Node_Info & get_info() { return node_info; } \
194 const Node_Info & get_info() const { return node_info; } \
198 # define GRAPH_ARC_COMMON(GT_Arc_Name) \
199 typedef Arc_Info Item_Type; \
200 typedef GT_Arc_Name Arc; \
201 typedef Arc_Info Arc_Type; \
207 Arc_Info & get_info() { return arc_info; } \
209 const Arc_Info & get_info() const { return arc_info; } \
211 void * get_connected_node(void * node) \
213 return src_node == node ? tgt_node : src_node; \
221 # define NODE_BITS(p) ((p)->attrs.control_bits)
226 # define NODE_COUNTER(p) ((p)->attrs.counter)
232 # define NODE_COLOR(p) ((p)->attrs.counter)
242 # define IS_NODE_VISITED(p, bit) (NODE_BITS(p).get_bit(bit))
248 # define NODE_COOKIE(p) ((p)->attrs.cookie)
254 # define ARC_COUNTER(p) ((p)->attrs.counter)
260 # define ARC_COLOR(p) ((p)->attrs.counter)
266 # define ARC_BITS(p) ((p)->attrs.control_bits)
275 # define IS_ARC_VISITED(p, bit) (ARC_BITS(p).get_bit(bit))
281 # define ARC_COOKIE(p) ((p)->attrs.cookie)
284 # define GRAPH_ATTR_COMMON(Graph_Name) \
286 typedef Graph_Name<__Graph_Node, __Graph_Arc> Graph_Class; \
287 typedef __Graph_Node Node; \
288 typedef __Graph_Arc Arc; \
289 typedef typename Node::Node_Type Node_Type; \
290 typedef typename Arc::Arc_Type Arc_Type; \
298 void operator () (Graph_Name&, Node * node) const \
300 NODE_BITS(node).reset(); \
301 NODE_COUNTER(node) = 0; \
302 NODE_COOKIE(node) = NULL; \
308 void operator () (Graph_Name&, Arc * arc) const \
310 ARC_BITS(arc).reset(); \
311 ARC_COUNTER(arc) = 0; \
312 ARC_COOKIE(arc) = NULL; \
322 num_nodes = num_arcs = 0; \
329 void common_swap(Graph_Name & g) \
331 if (digraph != g.digraph) \
332 throw std::domain_error("source and target incompatible"); \
334 std::swap(num_nodes, g.num_nodes); \
335 std::swap(num_arcs, g.num_arcs); \
336 std::swap(digraph, g.digraph); \
337 std::swap(cookie, g.cookie); \
342 void *& get_cookie() { return cookie; } \
344 bool is_digraph() const { return digraph; } \
346 const size_t & get_num_nodes() const { return num_nodes; } \
348 const size_t & vsize() const { return get_num_nodes(); } \
350 Node * get_src_node(Arc * arc) const { return (Node*) arc->src_node; } \
352 Node * get_tgt_node(Arc * arc) const { return (Node*) arc->tgt_node; } \
354 Node * get_connected_node(Arc * arc, Node * node) const \
356 return (Node*) arc->get_connected_node(node); \
359 const size_t & get_num_arcs() const { return num_arcs; } \
361 const size_t & esize() const { return get_num_arcs(); } \
363 const size_t & get_num_arcs(Node * node) const \
365 return node->num_arcs; \
368 Bit_Fields & get_control_bits(Node * node) const \
370 return NODE_BITS(node).reset(); \
373 void reset_bit(Node * node, const int & bit) const \
375 NODE_BITS(node).reset(bit); \
378 void reset_bits(Node * node) const { NODE_BITS(node).reset(); } \
380 void set_bit(Node * node, const int bit, const int value) \
382 NODE_BITS(node).set_bit(bit, value); \
385 Bit_Fields & get_control_bits(Arc * arc) const { return ARC_BITS(arc); } \
387 void reset_bit(Arc * arc, const int bit) const \
389 ARC_BITS(arc).reset(bit); \
392 void reset_bits(Arc * arc) const { ARC_BITS(arc).reset(); } \
394 void set_bit(Arc * arc, const int bit, const int value) const \
396 ARC_BITS(arc).set_bit(bit, value); \
399 void *& get_cookie(Node * node) const { return NODE_COOKIE(node); } \
401 void *& get_cookie(Arc * arc) const { return ARC_COOKIE(arc); } \
403 long & get_counter(Node * node) const { return NODE_COUNTER(node); } \
405 void reset_counter(Node * node) const { NODE_COUNTER(node) = No_Visited; } \
407 void reset_node(Node * node) const \
409 node_bits(node).reset(); \
410 NODE_COUNTER(node) = 0; \
411 NODE_COOKIE(node) = NULL; \
414 long & get_counter(Arc * arc) const { return ARC_COUNTER(arc); } \
416 void reset_counter(Arc * arc) const { ARC_COUNTER(arc) = No_Visited; } \
418 void reset_arc(Arc * arc) const \
420 ARC_BITS(arc).reset(); \
421 ARC_COUNTER(arc) = 0; \
422 ARC_COOKIE(arc) = NULL; \
425 template <class N1, class N2> static \
426 void map_nodes(N1 * p, N2 * q) \
428 I(p != NULL and q != NULL); \
430 if (NODE_COOKIE(p) == NULL) \
432 NODE_COOKIE(p) = q; \
433 NODE_COOKIE(q) = p; \
437 NODE_COOKIE(q) = NODE_COOKIE(p); \
438 NODE_COOKIE(p) = q; \
441 template <class A1, class A2> static \
442 void map_arcs(A1 * p, A2 * q) \
444 I(p != NULL and q != NULL); \
446 if (ARC_COOKIE(p) == NULL) \
454 ARC_COOKIE(q) = ARC_COOKIE(p); \
459 # define GRAPH_ITERATIVE_METHODS \
460 void reset_bit_nodes(const int & bit) \
462 for (Node_Iterator itor(*this); itor.has_curr(); itor.next()) \
463 reset_bit(itor.get_current_node(), bit); \
466 void reset_bit_arcs(const int & bit) \
468 for (Arc_Iterator itor(*this); itor.has_curr(); itor.next()) \
469 reset_bit(itor.get_current_arc(), bit); \
471 void reset_bit_nodes() \
473 for (Node_Iterator itor(*this); itor.has_curr(); itor.next()) \
474 reset_bits(itor.get_current_node()); \
477 void reset_bit_arcs() \
479 for (Arc_Iterator itor(*this); itor.has_curr(); itor.next()) \
480 reset_bits(itor.get_current_arc()); \
483 Node * get_node(size_t k) \
485 int m = num_nodes/2; \
486 Node_Iterator it(*this); \
489 for (int i = 0; i < k; ++i) \
494 for (int i = num_nodes - 1; i > k; --i) \
498 return it.get_curr(); \
501 Node * get_arc(size_t k) \
503 int m = num_arcs/2; \
504 Arc_Iterator it(*this); \
507 for (int i = 0; i < k; ++i) \
512 for (int i = num_arcs - 1; i > k; --i) \
516 return it.get_curr(); \
519 void reset_counter_nodes() \
521 for (Node_Iterator itor(*this); itor.has_curr(); itor.next()) \
522 reset_counter(itor.get_current_node()); \
525 void reset_counter_arcs() \
527 for (Arc_Iterator itor(*this); itor.has_curr(); itor.next()) \
528 reset_counter(itor.get_current_arc()); \
531 void reset_cookie_nodes() \
533 for (Node_Iterator itor(*this); itor.has_curr(); itor.next()) \
534 itor.get_current_node()->cookie = NULL; \
537 void reset_cookie_arcs() \
539 for (Arc_Iterator itor(*this); itor.has_curr(); itor.next()) \
540 itor.get_current_arc()->cookie = NULL; \
542 inline void reset_nodes(); \
544 inline void reset_arcs(); \
546 typedef Node_Arc_Iterator Out_Iterator;
550 # define GRAPH_SEARCH_METHODS \
551 template <class Equal> \
552 Node * search_node(const typename Node::Node_Type & node_info) \
554 for (Node_Iterator itor(*this); itor.has_curr(); itor.next()) \
556 Node * curr_node = itor.get_current_node(); \
557 if (Equal() (curr_node->get_info(), node_info)) \
564 template <typename T, class Equal> \
565 Node * search_node(const T & data) \
567 for (Node_Iterator it(*this); it.has_curr(); it.next()) \
569 Node * p = it.get_current_node(); \
570 if (Equal () (p->get_info(), data)) \
577 Node * search_node(const typename Node::Node_Type & node_info) \
579 return search_node<Aleph::equal_to<typename Node::Node_Type>>(node_info); \
582 template <class Equal> \
583 Node * search_node(void * ptr) \
585 for (Node_Iterator itor(*this); itor.has_curr(); itor.next()) \
587 Node * curr_node = itor.get_current_node(); \
588 if (Equal () (curr_node, ptr)) \
595 template <typename T, class Equal> \
596 Arc * search_Arc(const T & data) \
598 for (Arc_Iterator it(*this); it.has_curr(); it.next()) \
600 Arc * a = it.get_current_arc(); \
601 if (Equal () (a->get_info(), data)) \
608 template <class Equal> \
609 Arc * search_arc(const typename Arc::Arc_Type & arc_info) \
611 for (Arc_Iterator it(*this); it.has_curr(); it.next()) \
613 Arc * curr_arc = it.get_current_arc(); \
614 if (Equal () (curr_arc->get_info(), arc_info)) \
621 Arc * search_arc(const typename Arc::Arc_Type & arc_info) \
623 return search_arc<Aleph::equal_to<Arc_Type>>(arc_info); \
626 template <class Equal> \
627 Arc * search_arc(void * ptr) \
629 for (Arc_Iterator itor(*this); itor.has_curr(); itor.next()) \
631 Arc * curr_arc = itor.get_current_node(); \
632 if (Equal () (curr_arc, ptr)) \
640 # define GRAPH_INSERTION_METHODS \
641 virtual Node * insert_node(const Node_Type & node_info) \
643 return insert_node(new Node (node_info)); \
646 virtual Node * insert_node(Node_Type && node_info = Node_Type()) \
648 return insert_node(new Node(std::move(node_info))); \
652 insert_arc(Node * src, Node * tgt, const Arc_Type & arc_info) \
654 std::unique_ptr<Arc> arc(new Arc(arc_info)); \
655 insert_arc(src, tgt, arc.get()); \
656 return arc.release(); \
660 insert_arc(Node * src, Node * tgt, Arc_Type && arc_info = Arc_Type()) \
662 std::unique_ptr<Arc> arc(new Arc(std::move(arc_info))); \
663 insert_arc(src, tgt, arc.get()); \
664 return arc.release(); \
668 # define GRAPH_METHODS_IMPLS(Name) \
669 template <typename Node, typename Arc> \
670 void Name<Node, Arc>::reset_nodes() \
672 Operate_On_Nodes <Graph_Class, Reset_Node> () (*this); \
675 template <typename Node, typename Arc> \
676 void Name<Node, Arc>::reset_arcs() \
678 Operate_On_Arcs <Graph_Class, Reset_Arc> () (*this); \
681 # define GRAPH_FUNCTIONAL_METHODS(Name) \
682 template <class Operation> \
683 bool traverse_nodes(Operation & operation) const \
685 for (Node_Iterator it(*const_cast<Name<Node,Arc>*>(this)); \
686 it.has_curr(); it.next()) \
687 if (not operation(it.get_curr())) \
692 template <class Operation> \
693 bool traverse_nodes(Operation & operation) \
695 for (Node_Iterator it(*this); it.has_curr(); it.next()) \
696 if (not operation(it.get_curr())) \
701 template <class Operation> \
702 bool traverse_nodes(Operation && operation = Operation()) const \
704 return const_cast<Name<Node,Arc>*>(this)-> \
705 traverse_nodes<Operation>(operation); \
708 template <class Operation> \
709 bool traverse_nodes(Operation && operation = Operation()) \
711 return traverse_nodes<Operation>(operation); \
714 template <class Operation> \
715 bool traverse_arcs(Operation & operation) const \
717 for (Arc_Iterator it(*const_cast<Name<Node,Arc>*>(this)); \
718 it.has_curr(); it.next()) \
719 if (not operation(it.get_curr())) \
724 template <class Operation> \
725 bool traverse_arcs(Operation & operation) \
727 for (Arc_Iterator it(*this); it.has_curr(); it.next()) \
728 if (not operation(it.get_curr())) \
733 template <class Operation> \
734 bool traverse_arcs(Operation && operation = Operation()) const \
736 return const_cast<Name<Node,Arc>*>(this)-> \
737 traverse_arcs<Operation>(operation); \
740 template <class Operation> \
741 bool traverse_arcs(Operation && operation = Operation()) \
743 return traverse_arcs<Operation>(operation); \
746 template <class Operation> \
747 void for_each_node(Operation & operation) const \
749 for (Node_Iterator it(*const_cast<Name<Node,Arc>*>(this)); \
750 it.has_curr(); it.next()) \
751 operation(it.get_curr()); \
754 template <class Operation> \
755 void for_each_node(Operation & operation) \
757 for (Node_Iterator it(*this); it.has_curr(); it.next()) \
758 operation(it.get_curr()); \
761 template <class Operation> \
762 void for_each_node(Operation && operation = Operation()) const \
764 const_cast<Name<Node,Arc>*>(this)-> \
765 for_each_node<Operation>(operation); \
768 template <class Operation> \
769 void for_each_node(Operation && operation = Operation()) \
771 for_each_node<Operation>(operation); \
774 template <class Operation> \
775 bool all_node(Operation & operation) const \
777 for (Node_Iterator it(*const_cast<Name<Node,Arc>*>(this)); \
778 it.has_curr(); it.next()) \
779 if (not operation(it.get_curr())) \
784 template <class Operation> \
785 bool all_node(Operation & operation) \
787 for (Node_Iterator it(*this); it.has_curr(); it.next()) \
788 if (not operation(it.get_curr())) \
793 template <class Operation> \
794 bool all_node(Operation && operation = Operation()) const \
796 return const_cast<Name<Node,Arc>*>(this)-> \
797 all_node<Operation>(operation); \
800 template <class Operation> \
801 bool all_node(Operation && operation = Operation()) \
803 return all_node<Operation>(operation); \
806 template <class Operation> \
807 bool forall_node(Operation & operation) const \
809 for (Node_Iterator it(*const_cast<Name<Node,Arc>*>(this)); \
810 it.has_curr(); it.next()) \
811 if (not operation(it.get_curr())) \
816 template <class Operation> \
817 bool forall_node(Operation & operation) \
819 for (Node_Iterator it(*this); it.has_curr(); it.next()) \
820 if (not operation(it.get_curr())) \
825 template <class Operation> \
826 bool forall_node(Operation && operation = Operation()) const \
828 return const_cast<Name<Node,Arc>*>(this)-> \
829 all_node<Operation>(operation); \
832 template <class Operation> \
833 bool forall_node(Operation && operation = Operation()) \
835 return all_node<Operation>(operation); \
838 template <typename T = Node_Type, \
839 template <typename> class Container = DynList> \
840 Container<T> map_nodes(std::function<T(Node *)> operation) \
842 Container<T> ret_val; \
843 this->for_each_node([&ret_val, &operation] (Node * p) \
845 ret_val.append(operation(p)); \
850 template <typename T> \
851 T foldl_nodes(const T & init, std::function<T(const T&, Node*)> operation) \
854 this->for_each_node( [&ret_val, &operation] (Node * p) \
856 ret_val = operation(ret_val, p); \
861 template <class Operation> \
862 void for_each_arc(Operation & operation) const \
864 for (Arc_Iterator it(*const_cast<Name<Node,Arc>*>(this)); \
865 it.has_curr(); it.next()) \
866 operation(it.get_curr()); \
869 template <class Operation> \
870 void for_each_arc(Operation & operation) \
872 for (Arc_Iterator it(*this); it.has_curr(); it.next()) \
873 operation(it.get_curr()); \
876 template <class Operation> \
877 void for_each_arc(Operation && operation = Operation()) const \
879 const_cast<Name<Node,Arc>*>(this)-> \
880 for_each_arc<Operation>(operation); \
883 template <class Operation> \
884 void for_each_arc(Operation && operation = Operation()) \
886 for_each_arc<Operation>(operation); \
889 template <class Operation> \
890 bool all_arc(Operation & operation) const \
892 for (Arc_Iterator it(*const_cast<Name<Node,Arc>*>(this)); \
893 it.has_curr(); it.next()) \
894 if (not operation(it.get_curr())) \
899 template <class Operation> \
900 bool all_arc(Operation & operation) \
902 for (Arc_Iterator it(*this); it.has_curr(); it.next()) \
903 if (not operation(it.get_curr())) \
908 template <class Operation> \
909 bool all_arc(Operation && operation = Operation()) const \
911 return const_cast<Name<Node,Arc>*>(this)-> \
912 all_arc<Operation>(operation); \
915 template <class Operation> \
916 bool all_arc(Operation && operation = Operation()) \
918 return all_arc<Operation>(operation); \
921 template <class Operation> \
922 bool forall_arc(Operation & operation) const \
924 return const_cast<Name<Node,Arc>*>(this)-> \
925 all_arc<Operation>(operation); \
928 template <class Operation> \
929 bool forall_arc(Operation & operation) \
931 return all_arc<Operation>(operation); \
934 template <class Operation> \
935 bool forall_arc(Operation && operation = Operation()) const \
937 return const_cast<Name<Node,Arc>*>(this)-> \
938 all_arc<Operation>(operation); \
941 template <class Operation> \
942 bool forall_arc(Operation && operation = Operation()) \
944 return all_arc<Operation>(operation); \
947 template <typename T = Arc_Type, \
948 template <typename> class Container = DynList> \
949 Container<T> map_arcs(std::function<T(Arc *)> operation) \
951 Container<T> ret_val; \
952 this->for_each_arc([&ret_val, &operation] (Arc * p) \
954 ret_val.append(operation(p)); \
959 template <typename T> \
960 T foldl_arcs(const T & init, std::function<T(const T&, Arc*)> operation) \
963 this->for_each_arc([&ret_val, &operation] (Arc * p) \
965 ret_val = operation(ret_val, p); \
970 template <class Operation> \
971 void for_each_arc(Node * p, Operation & operation) const \
973 for (Node_Arc_Iterator it(p); it.has_curr(); it.next()) \
974 operation(it.get_curr()); \
977 template <class Operation> \
978 void for_each_arc(Node * p, Operation & operation) \
980 for (Node_Arc_Iterator it(p); it.has_curr(); it.next()) \
981 operation(it.get_curr()); \
984 template <class Operation> \
985 void for_each_arc(Node * p, Operation && operation = Operation()) const \
987 for_each_arc<Operation>(p, operation); \
990 template <class Operation> \
991 void for_each_arc(Node * p, Operation && operation = Operation()) \
993 for_each_arc<Operation>(p, operation); \
996 template <class Operation> \
997 bool all_arc(Node * p, Operation & operation) const \
999 for (Node_Arc_Iterator it(p); it.has_curr(); it.next()) \
1000 if (not operation(it.get_curr())) \
1005 template <class Operation> \
1006 bool all_arc(Node * p, Operation & operation) \
1008 for (Node_Arc_Iterator it(p); it.has_curr(); it.next()) \
1009 if (not operation(it.get_curr())) \
1014 template <class Operation> \
1015 bool all_arc(Node * p, Operation && operation = Operation()) const \
1017 return all_arc<Operation>(p, operation); \
1020 template <class Operation> \
1021 bool all_arc(Node * p, Operation && operation = Operation()) \
1023 return all_arc<Operation>(p, operation); \
1026 template <class Operation> \
1027 bool forall_arc(Node * p, Operation & operation) const \
1029 return all_arc(p, operation); \
1032 template <class Operation> \
1033 bool forall_arc(Node * p, Operation & operation) \
1035 return all_arc(p, operation); \
1038 template <class Operation> \
1039 bool forall_arc(Node * p, Operation && operation = Operation()) const \
1041 return all_arc(p, operation); \
1044 template <class Operation> \
1045 bool forall_arc(Node * p, Operation && operation = Operation()) \
1047 return all_arc<Operation>(p, operation); \
1050 template <typename T = Arc_Type, \
1051 template <typename> class Container = Aleph::DynList> \
1052 Container<T> map_arcs(Node * p, std::function<T(Arc *)> operation) \
1054 Container<T> ret_val; \
1055 this->for_each_arc(p, [&ret_val, &operation] (Arc * a) \
1057 ret_val.append(operation(a)); \
1062 template <typename T> \
1063 T foldl_arcs(Node * p, const T & init, \
1064 std::function<T(const T&, Arc*)> operation) \
1067 this->for_each_arc(p, [&ret_val, &operation] (Arc * a) \
1069 ret_val = operation(ret_val, a); \
1074 template <template <typename> class Container = Aleph::DynList> \
1075 Container<Node*> filter_nodes(std::function<bool(Node*)> operation) \
1077 Container<Node*> ret_val; \
1078 this->for_each_node([&ret_val, &operation] (Node * p) \
1081 ret_val.append(p); \
1086 template <template <typename> class Container = Aleph::DynList> \
1087 Container<Arc*> filter_arcs(std::function<bool(Arc*)> operation) \
1089 Container<Arc*> ret_val; \
1090 this->for_each_arc([&ret_val, &operation] (Arc * a) \
1093 ret_val.append(a); \
1098 template <template <typename> class Container = Aleph::DynList> \
1099 Container<Arc*> filter_arcs(Node * p, std::function<bool(Arc*)> operation) \
1101 Container<Arc*> ret_val; \
1102 this->for_each_node(p, [&ret_val, &operation] (Arc * a) \
1105 ret_val.append(a); \
1110 template <class Operation> \
1111 bool exists_node(Operation & operation) const \
1113 return this->traverse_nodes([&operation] (Node * p) \
1115 return not operation(p); \
1119 template <class Operation> \
1120 bool exists_node(Operation & operation) \
1122 return this->traverse_nodes([&operation] (Node * p) \
1124 return not operation(p); \
1128 template <class Operation> \
1129 bool exists_node(Operation && operation = Operation()) const \
1131 return exists_node(operation); \
1134 template <class Operation> \
1135 bool exists_node(Operation && operation = Operation()) \
1137 return exists_node(operation); \
1140 template <class Operation> \
1141 bool exists_arc(Operation & operation) const \
1143 return this->traverse_arcs([&operation] (Arc * a) \
1145 return not operation(a); \
1149 template <class Operation> \
1150 bool exists_arc(Operation & operation) \
1152 return this->traverse_arcs([&operation] (Arc * a) \
1154 return not operation(a); \
1158 template <class Operation> \
1159 bool exists_arc(Operation && operation = Operation()) const \
1161 return exists_arc(operation); \
1164 template <class Operation> \
1165 bool exists_arc(Operation && operation = Operation()) \
1167 return exists_arc(operation); \
1170 template <class Operation> \
1171 bool exists_arc(Node * p, Operation & operation) const \
1173 return this->traverse_arcs(p, [&operation] (Arc * a) \
1175 return not operation(a); \
1179 template <class Operation> \
1180 bool exists_arc(Node * p, Operation & operation) \
1182 return this->traverse_arcs(p, [&operation] (Arc * a) \
1184 return not operation(a); \
1188 template <class Operation> \
1189 bool exists_arc(Node * p, Operation && operation = Operation()) const \
1191 return exists_arc(p, operation); \
1194 template <class Operation> \
1195 bool exists_arc(Node * p, Operation && operation = Operation()) \
1197 return exists_arc(p, operation); \
1200 template <template <typename> class Container = Aleph::DynList> \
1201 Container<Node*> nodes() \
1203 Container<Node*> ret_val; \
1204 this->for_each_node([&ret_val] (Node * p) \
1206 ret_val.append(p); \
1211 template <template <typename> class Container = Aleph::DynList> \
1212 Container<Arc*> arcs() \
1214 Container<Arc*> ret_val; \
1215 this->for_each_arc([&ret_val] (Arc * a) \
1217 ret_val.append(a); \
1222 template <template <typename> class Container = Aleph::DynList> \
1223 Container<Arc*> arcs(Node * p) \
1225 Container<Arc*> ret_val; \
1226 this->for_each_arc(p, [&ret_val] (Arc * a) \
1228 ret_val.append(a); \
1233 template <template <typename> class Container = Aleph::DynList> \
1234 Container<Node*> nodes() const \
1236 Container<Node*> ret_val; \
1237 this->for_each_node([&ret_val] (Node * p) \
1239 ret_val.append(p); \
1244 template <template <typename> class Container = Aleph::DynList> \
1245 Container<Arc*> arcs() const \
1247 Container<Arc*> ret_val; \
1248 this->for_each_arc([&ret_val] (Arc * a) \
1250 ret_val.append(a); \
1255 template <template <typename> class Container = Aleph::DynList> \
1256 Container<Arc*> arcs(Node * p) const \
1258 Container<Arc*> ret_val; \
1259 this->for_each_arc(p, [&ret_val] (Arc * a) \
1261 ret_val.append(a); \
Bit_Fields()
pertenece a un camino mínimo
Definition: aleph-graph.H:69
unsigned int is_acyclique
Bit de verificación de ciclo.
Definition: aleph-graph.H:54
unsigned int min
nodo o arco de corte
Definition: aleph-graph.H:66
bool get_bit(const int &bit) const
Definition: aleph-graph.H:86
unsigned int breadth_first
Bit de búsqueda en profundidad.
Definition: aleph-graph.H:52
Definition: aleph-graph.H:177
unsigned int convert_tree
Bit de subgrafo.
Definition: aleph-graph.H:64
unsigned int cut
Conversión a Tree_Node.
Definition: aleph-graph.H:65
unsigned int kruskal
Bit de búsqueda de camino.
Definition: aleph-graph.H:57
unsigned int test_path
Bit de prueba de aciclicidad.
Definition: aleph-graph.H:55
unsigned int test_cycle
Bit de búsqueda en amplitud.
Definition: aleph-graph.H:53
unsigned int find_path
Bit de prueba de existencia de camino.
Definition: aleph-graph.H:56
void set_bit(const int &bit, const int &value)
Definition: aleph-graph.H:124
unsigned int prim
Bit de algoritmo de Kruskal.
Definition: aleph-graph.H:58
unsigned int build_subtree
Bit de árbol abarcador.
Definition: aleph-graph.H:63
unsigned int spanning_tree
Bit para flujos máximos.
Definition: aleph-graph.H:62
void reset()
Reinicia todos los bits a cero.
Definition: aleph-graph.H:155
long counter
bits de control del arco
Definition: aleph-graph.H:180
unsigned int maximum_flow
Bit de camino euleriano.
Definition: aleph-graph.H:61
unsigned int euler
Bit de algoritmo de Dijkstra.
Definition: aleph-graph.H:60
Definition: aleph-graph.H:47
void reset(const int &bit)
Reinicia bit a cero.
Definition: aleph-graph.H:152
unsigned int dijkstra
Bit de algoritmo de Prim.
Definition: aleph-graph.H:59