31 # include <bitArray.H> 32 # include <tpl_dynArray.H> 33 # include <tpl_sort_utils.H> 34 # include <tpl_dynMapTree.H> 35 # include <tpl_dynDlist.H> 36 # include <tpl_treapRk.H> 37 # include <filter_iterator.H> 38 # include <aleph-graph.H> 39 # include <graph-dry.H> 42 using namespace Aleph;
55 template <
typename __Graph_Node,
typename __Graph_Arc>
58 template <
typename __Graph_Node,
typename __Graph_Arc>
64 template <
typename MT,
typename Entry_Info,
typename Copy>
95 template <
typename __Node_Info = Empty_Class>
101 friend class Arc_Node;
104 using Node_Info = __Node_Info;
126 Graph_Node(Node_Info && info = Node_Info()) noexcept : Base(move(info))
137 noexcept(std::is_nothrow_copy_assignable<Node_Info>::value)
141 this->node_info = node.node_info;
161 noexcept(std::is_nothrow_copy_assignable<Node_Info>::value)
196 template <
typename __Arc_Info = Empty_Class>
205 using Arc_Info = __Arc_Info;
207 Arc_Node * src_arc_node =
nullptr;
208 Arc_Node * tgt_arc_node =
nullptr;
220 noexcept(noexcept(std::is_nothrow_copy_constructible<Arc_Info>::value))
236 noexcept(noexcept(
std::is_nothrow_move_constructible<Arc_Info>::value))
243 noexcept(noexcept(std::is_nothrow_copy_constructible<Arc_Info>::value))
250 noexcept(std::is_nothrow_copy_constructible<Arc_Info>::value)
254 this->arc_info = arc.arc_info;
259 class Arc_Node :
public Dlink 262 void * arc =
nullptr;
263 Arc_Node() noexcept : arc(
nullptr) {}
264 Arc_Node(
void * __arc) noexcept : arc(__arc) {}
403 template <
typename __Graph_Node = Graph_Node<
unsigned long>,
404 typename __Graph_Arc = Graph_Arc<
unsigned long>>
406 :
public GraphCommon<List_Graph<__Graph_Node, __Graph_Arc>,
407 __Graph_Node, __Graph_Arc>
420 using Arc_Type =
typename Arc::Arc_Type;
423 __Graph_Node, __Graph_Arc>;
426 __Graph_Node, __Graph_Arc>;
428 using CommonBase::insert_node;
429 using CommonBase::insert_arc;
436 static Node * dlink_to_node(
Dlink * p) noexcept {
return (
Node*) p; }
438 static Arc * dlink_to_arc(
Dlink * p) noexcept {
return (
Arc*) p; }
440 static Arc_Node * dlink_to_arc_node(
Dlink * p) noexcept
442 return (Arc_Node*) p;
445 static Arc * void_to_arc(Arc_Node * arc_node) noexcept
447 return (
Arc*) arc_node->arc;
495 if (not this->digraph)
496 while (not node->arc_list.is_empty())
498 Arc_Node * arc_node = dlink_to_arc_node(node->arc_list.get_next());
499 Arc * arc = void_to_arc(arc_node);
505 Arc * a = it.get_curr_ne();
534 if (this->num_nodes == 0)
535 throw std::range_error(
"Graph has not nodes");
537 return dlink_to_node(const_cast<Dlink&>(node_list).
get_next());
555 throw std::range_error(
"node has not arcs");
557 void * arc = dlink_to_arc_node(node->arc_list.get_next())->arc;
558 return reinterpret_cast <
Arc *> (arc);
566 arc->src_node = src_node;
567 arc->tgt_node = tgt_node;
570 unique_ptr<Arc_Node> src_arc_node (
new Arc_Node (arc));
573 if (not this->digraph)
575 if (src_node == tgt_node)
576 arc->tgt_arc_node = src_arc_node.get();
579 unique_ptr<Arc_Node> tgt_arc_node(
new Arc_Node(arc));
582 arc->tgt_arc_node = tgt_arc_node.get();
583 tgt_node->arc_list.append(tgt_arc_node.get());
584 tgt_node->num_arcs++;
585 tgt_arc_node.release();
590 arc->src_arc_node = src_arc_node.get();
591 src_node->arc_list.append(src_arc_node.get());
592 src_node->num_arcs++;
596 src_arc_node.release();
611 Arc_Node * src_arc_node = arc->src_arc_node;
614 src_node->num_arcs--;
617 if (not this->digraph)
620 if (src_node != tgt_node)
622 Arc_Node * tgt_arc_node = arc->tgt_arc_node;
624 tgt_node->num_arcs--;
659 Arc_Node * src_arc_node = arc->src_arc_node;
661 src_node->num_arcs--;
663 if (not this->digraph)
666 if (src_node != tgt_node)
668 Arc_Node * tgt_arc_node = arc->tgt_arc_node;
670 tgt_node->num_arcs--;
693 Arc_Node * src_arc_node = arc->src_arc_node;
694 Arc_Node * tgt_arc_node = arc->tgt_arc_node;
696 if (not this->digraph)
698 if (src_node != tgt_node)
700 tgt_node->arc_list.append(tgt_arc_node);
701 tgt_node->num_arcs++;
705 src_node->arc_list.append(src_arc_node);
706 src_node->num_arcs++;
727 throw std::range_error(
"Graph has not arcs");
729 return dlink_to_arc(const_cast<Dlink&>(arc_list).
get_next());
753 template <
class Compare>
inline 757 mergesort(node_list, c);
761 template <
class Compare>
inline 788 template <
class Compare>
inline 792 mergesort(arc_list, c);
796 template <
class Compare>
inline 883 : Base(const_cast<
Dlink&>(g.node_list))
934 Arc_Node * get_current_arc_node()
const 939 Arc_Node * get_current_arc_node_ne()
const noexcept
947 return static_cast<Arc*
>(get_current_arc_node()->arc);
953 return static_cast<Arc*
>(get_current_arc_node_ne()->arc);
960 Arc * get_current_arc_ne()
const noexcept {
return get_curr_ne(); }
967 return (
Node*) get_current_arc()->get_connected_node(src_node);
970 Node * get_tgt_node_ne()
const noexcept
972 return (
Node*) get_current_arc_ne()->get_connected_node(src_node);
975 Node * get_node()
const {
return get_tgt_node(); }
977 Node * get_node_ne()
const noexcept {
return get_tgt_node_ne(); }
1009 Arc * get_current_arc()
const 1014 Arc * get_curr()
const {
return get_current_arc(); }
1016 Arc * get_curr_ne()
const noexcept {
return get_current_arc_ne(); }
1023 return (
Node*) get_current_arc()->src_node;
1026 Node * get_src_node_ne()
const 1028 return (
Node*) get_current_arc_ne()->src_node;
1036 Node * get_tgt_node_ne()
const 1038 return (
Node*) get_current_arc_ne()->tgt_node;
1048 this->common_swap(g);
1049 node_list.
swap(&g.node_list);
1050 arc_list.
swap(&g.arc_list);
1065 bool operator () (
typename GT::Arc * )
const noexcept
1070 void set_cookie(
void*) noexcept { }
1176 template <
class GT,
class Show_Arc = Dft_Show_Arc<GT>>
1179 typename GT::Node_Arc_Iterator,
1183 typename GT::Node_Arc_Iterator,
1187 typename GT::Node_Arc_Iterator,
1201 noexcept(noexcept(
Itor(p, sa)))
1224 template <
class GT,
class Show_Arc = Dft_Show_Arc<GT>>
1241 noexcept(noexcept(
Itor(g, sa)))
1259 bool operator () (
typename GT::Node *)
const noexcept
1269 template <
class GT,
class Show_Node = Dft_Show_Node<GT>>
1289 noexcept(noexcept(
Itor(g, sn)))
1305 template <
class GT,
class SN = Dft_Show_Node<GT>>
1307 std::function<
void(
typename GT::Node*)> operation,
1309 noexcept(noexcept(operation) and noexcept(sn))
1312 operation(it.get_curr_ne());
1324 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1326 std::function<
void(
typename GT::Arc*)> operation,
1328 noexcept(noexcept(operation) and noexcept(sa))
1331 operation(it.get_curr_ne());
1344 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1346 typename GT::Node * p,
1347 std::function<
void(
typename GT::Arc*)> operation,
1349 noexcept(noexcept(operation) and noexcept(sa))
1352 operation(it.get_curr_ne());
1365 template <
class GT,
class SN = Dft_Show_Node<GT>>
1367 std::function<
bool(
typename GT::Node*)> cond,
1369 noexcept(noexcept(cond) and noexcept(sn))
1372 if (not cond(it.get_curr_ne()))
1387 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1389 std::function<
bool(
typename GT::Arc*)> cond,
1391 noexcept(noexcept(cond) and noexcept(sa))
1394 if (not cond(it.get_curr_ne()))
1409 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1411 std::function<
bool(
typename GT::Arc*)> cond,
1413 noexcept(noexcept(cond) and noexcept(sa))
1416 if (not cond(it.get_curr_ne()))
1432 template <
class GT,
typename T,
1433 template <
typename>
class Container =
DynList,
1436 std::function<T(
typename GT::Node *)> transformation,
1439 Container<T> ret_val;
1440 for_each_node<GT, SN>(g, [&ret_val, &transformation] (
typename GT::Node * p)
1442 ret_val.append(transformation(p));
1456 template <
class GT,
typename T,
1457 template <
typename>
class Container =
DynList,
1460 std::function<T(
typename GT::Arc *)> transformation,
1463 Container<T> ret_val;
1464 for_each_arc<GT, SA>(g, [&ret_val, &transformation] (
typename GT::Arc * p)
1466 ret_val.append(transformation(p));
1481 template <
class GT,
typename T,
1482 template <
typename>
class Container =
DynList,
1485 typename GT::Node * p,
1486 std::function<T(
typename GT::Arc *)> transformation,
1489 Container<T> ret_val;
1490 for_each_arc<GT, SA>(g, p, [&ret_val, &transformation] (
typename GT::Arc * p)
1492 ret_val.append(transformation(p));
1507 template <
class GT,
typename T,
class SN = Dft_Show_Node<GT>>
1509 std::function<T(
const T&,
typename GT::Node*)> operation,
1511 noexcept(noexcept(operation) and noexcept(sn) and
1512 std::is_nothrow_copy_assignable<T>::value)
1515 for_each_node<GT, SN>(g, [&ret_val, &operation] (
typename GT::Node * p)
1517 ret_val = operation(ret_val, p);
1531 template <
class GT,
typename T,
class SA = Dft_Show_Arc<GT>>
1533 std::function<T(
const T&,
typename GT::Arc*)> operation,
1535 noexcept(noexcept(operation) and noexcept(sa) and
1536 std::is_nothrow_copy_assignable<T>::value)
1539 for_each_arc<GT, SA>(g, [&ret_val, &operation] (
typename GT::Arc* a)
1541 ret_val = operation(ret_val, a);
1556 template <
class GT,
typename T,
class SA = Dft_Show_Arc<GT>>
1559 std::function<T(
const T&,
typename GT::Arc*)> operation,
1561 noexcept(noexcept(operation) and noexcept(sa) and
1562 std::is_nothrow_copy_assignable<T>::value)
1565 for_each_arc<GT, SA>(g, p, [&ret_val, &operation] (
typename GT::Arc* a)
1567 ret_val = operation(ret_val, a);
1581 template <
typename __Graph_Node = Graph_Node<
int>,
1582 typename __Graph_Arc = Graph_Arc<
int>>
1591 this->digraph =
true;
1596 this->digraph =
true;
1602 this->digraph =
true;
1629 using ArcPair = tuple<typename GT::Arc*, typename GT::Node*>;
1640 typename GT::Node * src =
nullptr;
1644 __Out_Filt(
typename GT::Node * __src) noexcept : src(__src) { }
1646 bool operator () (
typename GT::Arc * a)
const noexcept
1649 return a->src_node == src;
1652 typename GT::Node * get_node(
typename GT::Arc * a)
const noexcept
1655 return (
typename GT::Node *) a->tgt_node;
1669 typename GT::Node * tgt =
nullptr;
1673 __In_Filt(
typename GT::Node * __tgt) noexcept : tgt(__tgt) { }
1675 bool operator () (
typename GT::Arc * a)
const noexcept
1678 return a->tgt_node == tgt;
1681 typename GT::Node * get_node(
typename GT::Arc * a)
const noexcept
1684 return (
typename GT::Node *) a->src_node;
1692 template <
class GT,
class Filter>
1696 typename GT::Node_Arc_Iterator, Filter>;
1709 noexcept(noexcept(Filter(p)) and noexcept(
Itor(p, filt)))
1710 : filt(p), it(p, filt)
1719 void next_ne() noexcept { it.next_ne(); }
1726 bool has_curr() const noexcept {
return it.has_curr(); }
1730 typename GT::Arc *
get_curr()
const {
return it.get_curr(); }
1734 typename GT::Arc *
get_curr_ne() const noexcept {
return it.get_curr_ne(); }
1741 typename GT::Node *
get_node(
typename GT::Arc * a)
const noexcept
1743 return filt.get_node(a);
1749 return this->get_node(this->get_curr());
1758 return this->get_node(this->get_curr_ne());
1771 void end() noexcept { put_itor_at_the_end(*
this); }
1795 template <
class GT,
class Show_Arc = Dft_Show_Arc<GT>>
1797 Filter_Iterator<typename GT::Node*, typename GT::Out_Iterator, Show_Arc>
1809 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1828 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1833 ret.
append(it.get_node_ne());
1845 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1850 ret.
append(it.get_node_ne());
1861 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1866 ret.
append(it.get_curr_ne());
1877 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1882 ret.
append(it.get_curr_ne());
1892 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1897 ret.
append(it.get_curr_ne());
1907 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1913 typename GT::Arc * a = it.get_curr_ne();
1914 ret.
append(make_tuple(a, (
typename GT::Node*) a->get_connected_node(p)));
1926 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1932 typename GT::Arc * a = it.get_curr_ne();
1933 ret.
append(make_tuple(a, (
typename GT::Node*) a->get_connected_node(p)));
1947 template <
class GT,
class SA = Dft_Show_Arc<GT>>
1975 template <
class GT,
class SA = Dft_Show_Arc<GT>>
2016 template <
class GT,
class Itor,
class Operation>
inline 2018 noexcept(noexcept(op))
2020 for (Itor it(p); it.has_curr(); it.next_ne())
2021 if (not op(it.get_curr_ne()))
2043 template <
class GT,
class Itor,
class Operation>
inline 2045 noexcept(noexcept(op))
2047 for (Itor it(p); it.has_curr(); it.next_ne())
2048 op(it.get_curr_ne());
2063 template <
class GT,
class Op>
inline 2065 noexcept(noexcept(op))
2067 return traverse_arcs<GT, __In_Iterator<GT>, Op>(p, op);
2076 template <
class GT,
class Op>
inline 2079 for_each_arc<GT, __In_Iterator<GT>, Op>(p, op);
2092 template <
class GT,
class Op>
inline 2093 bool all_in_arc(
typename GT::Node * p, Op op = Op()) noexcept(noexcept(op))
2108 template <
class GT,
class Op>
inline 2109 bool exists_in_arc(
typename GT::Node * p, Op op = Op()) noexcept(noexcept(op))
2111 return not traverse_in_arcs<GT, Op>(p, [&op] (
auto a) {
return not op(a); });
2125 template <
class GT,
class Op>
inline 2126 auto search_in_arc(
typename GT::Node * p, Op op = Op()) noexcept(noexcept(op))
2128 typename GT::Arc * ret =
nullptr;
2154 template <
class GT,
typename T>
inline 2155 auto map_in_arcs(
typename GT::Node * p, std::function<T(
typename GT::Arc*)> op)
2156 noexcept(noexcept(op))
2179 template <
class GT,
typename T>
inline 2180 T foldl_in_arcs(
typename GT::Node * p,
const T & init,
2181 std::function<T(
const T&,
typename GT::Arc*)> op)
2182 noexcept(noexcept(op))
2195 template <
class GT,
class Op>
inline 2197 noexcept(noexcept(cond))
2220 template <
class GT,
class Op>
inline 2222 noexcept(noexcept(op))
2224 return traverse_arcs<GT, __Out_Iterator<GT>, Op>(p, op);
2233 template <
class GT,
class Op>
inline 2235 noexcept(noexcept(op))
2237 for_each_arc<GT, __Out_Iterator<GT>, Op>(p, op);
2250 template <
class GT,
class Op>
inline 2251 bool all_out_arc(
typename GT::Node * p, Op op = Op()) noexcept(noexcept(op))
2266 template <
class GT,
class Op>
inline 2267 bool exists_out_arc(
typename GT::Node * p, Op op = Op()) noexcept(noexcept(op))
2269 return not traverse_out_arcs<GT, Op>(p, [&op] (
auto a) {
return not op(a); });
2283 template <
class GT,
class Op>
inline 2284 auto search_out_arc(
typename GT::Node * p, Op op = Op()) noexcept(noexcept(op))
2286 typename GT::Arc * ret =
nullptr;
2287 __traverse_out_arcs(p, [&op, &ret] (
auto a)
2312 template <
class GT,
typename T>
inline 2313 auto map_out_arcs(
typename GT::Node * p, std::function<T(
typename GT::Arc*)> op)
2314 noexcept(noexcept(op))
2337 template <
class GT,
typename T>
inline 2338 T foldl_out_arcs(
typename GT::Node * p,
const T & init,
2339 std::function<T(
const T&,
typename GT::Arc*)> op)
2340 noexcept(noexcept(op))
2353 template <
class GT,
class Op>
inline 2355 noexcept(noexcept(cond))
2379 template <
class GT,
class SA = Dft_Show_Arc<GT>>
2382 typename GT::Node * src,
typename GT::Node * tgt,
2383 SA sa = SA()) noexcept
2385 assert(src !=
nullptr and tgt !=
nullptr);
2387 if (not g.is_digraph() and tgt->num_arcs < src->num_arcs)
2388 std::swap(tgt, src);
2391 if (itor.get_tgt_node_ne() == tgt)
2392 return itor.get_current_arc_ne();
2406 template <
class GT,
class SA = Dft_Show_Arc<GT>>
2409 typename GT::Node * src,
typename GT::Node * tgt,
2410 SA sa = SA()) noexcept
2412 assert(src !=
nullptr and tgt !=
nullptr);
2416 typename GT::Arc * a = it.get_curr_ne();
2417 if (a->src_node == src and a->tgt_node == tgt)
2436 typename GT::Arc * mapped_arc(
typename GT::Arc * a) noexcept
2442 template <
class GTSRC,
class GTTGT>
2443 typename GTTGT::Node *
mapped_node(
typename GTSRC::Node * p) noexcept
2449 template <
class GTSRC,
class GTTGT>
2450 typename GTTGT::Arc * mapped_arc(
typename GTSRC::Arc * a) noexcept
2452 return (
typename GTTGT::Arc *)
ARC_COOKIE(a);
2472 template <
class GT>
inline 2473 void copy_graph(GT & gtgt,
const GT & gsrc,
const bool cookie_map =
false);
2480 template <
class GT>
inline void clear_graph(GT & g) noexcept;
2492 template <
class GT,
class Operation,
class SN = Dft_Show_Node<GT>>
2501 noexcept(
std::is_nothrow_constructible<SN>::value)
2509 void operator () (
const GT & g, Operation op = Operation())
2510 noexcept(noexcept(op))
2513 op (g, it.get_curr_ne());
2521 void operator () (GT & g, Operation op = Operation()) noexcept(noexcept(op))
2524 op (g, it.get_curr_ne());
2539 template <
class GT,
class Operation,
class SA = Dft_Show_Arc<GT>>
2548 noexcept(
std::is_nothrow_constructible<SA>::value)
2556 void operator () (
const GT & g, Operation op = Operation()) const
2557 noexcept(noexcept(op))
2560 op (g, it.get_curr_ne());
2563 void operator () (GT & g, Operation op = Operation())
const 2564 noexcept(noexcept(op))
2567 op (g, it.get_curr_ne());
2576 void operator () (
const GT & g,
typename GT::Node * p,
2577 Operation op = Operation()) const noexcept(noexcept(op))
2580 op (g, it.get_current_arc_ne());
2583 void operator () (GT & g,
typename GT::Node * p,
2584 Operation op = Operation())
const 2585 noexcept(noexcept(op))
2588 op (g, it.get_current_arc_ne());
2644 const GT * g =
nullptr;
2646 using Node =
typename GT::Node;
2647 using Arc =
typename GT::Arc;
2654 Path_Desc(Node * _node =
nullptr, Arc * _arc =
nullptr) noexcept
2655 : node(_node), arc(_arc) {}
2657 bool operator == (
const Path_Desc & r)
const noexcept
2659 if (not (node->get_info() == r.node->get_info()))
2663 return r.arc ==
nullptr;
2665 if (r.arc ==
nullptr)
2668 return arc->get_info() == r.arc->get_info();
2677 throw std::domain_error(
"Path: Graph has not been specified");
2686 while (not l.is_unitarian_or_empty())
2689 auto nxt = l.get_first().node;
2690 if (nxt == g->get_connected_node(d.arc, d.node))
2700 return list.
all([
this] (
auto d) {
return g->get_src_node(d.arc) == d.node; })
2701 and list.
get_last().arc ==
nullptr;
2711 Path(
const GT & __g) noexcept : g(&__g) {}
2713 Path() noexcept : g(
nullptr) { }
2722 void init(Node * start_node) { list.
append(Path_Desc(start_node)); }
2730 Path(
const GT & _g, Node * start_node) : g(&_g) {
init(start_node); }
2749 if (start_node ==
nullptr)
2769 Path(
const Path & path) : g(path.g), list(path.list) {}
2772 Path(
Path && path) : g(path.g), list(move(path.list)) {}
2790 std::swap(g, path.g);
2791 std::swap(list, path.list);
2813 throw std::domain_error(
"path is empty");
2815 auto & last_path_desc = list.
get_last();
2816 auto last_node = last_path_desc.node;
2817 if (arc->src_node != last_node and arc->tgt_node != last_node)
2818 throw std::invalid_argument(
"arc has not link to last node of path");
2820 last_path_desc.arc = arc;
2821 list.
append(Path_Desc(g->get_connected_node(arc, last_node)));
2851 Node * last_node = get_last_node();
2855 throw std::invalid_argument(
"There is no an arc connecting to the node");
2889 auto & last_path_desc = list.
get_last();
2890 Node * last_node = last_path_desc.node;
2894 throw std::invalid_argument(
"There is no an arc connecting to the node");
2896 assert(arc->src_node == last_path_desc.node);
2898 last_path_desc.arc = arc;
2899 list.
append(Path_Desc(static_cast<Node*>(arc->tgt_node)));
2925 throw std::domain_error(
"path is empty");
2927 auto & last_path_desc = list.
get_last();
2928 Node * last_node = last_path_desc.node;
2929 if (arc->src_node != last_node)
2930 throw std::invalid_argument(
"The arc does not connect the last node");
2932 last_path_desc.arc = arc;
2933 list.
append(Path_Desc(static_cast<Node*>(arc->tgt_node)));
2956 throw std::domain_error(
"path is empty");
2958 auto & first_path_desc = list.
get_first();
2959 auto first_node = first_path_desc.node;
2960 if (arc->src_node != first_node and arc->tgt_node != first_node)
2961 throw std::invalid_argument(
"arc has not link to first node of path");
2963 Path_Desc item(g->get_connected_node(arc, first_node), arc);
2992 Node * first_node = get_first_node();
2993 Arc * arc =
search_arc(*g, node, first_node);
2995 throw std::domain_error(
"There is no arc connecting node");
2997 Path_Desc item(node, arc);
3029 Node * first_node = get_first_node();
3032 throw std::domain_error(
"There is no an arc connecting to the node");
3034 list.
insert(Path_Desc(p, arc));
3057 throw std::domain_error(
"path is empty");
3059 auto & first_path_desc = list.
get_first();
3060 Node * first_node = first_path_desc.node;
3061 if (arc->tgt_node != first_node)
3062 throw std::invalid_argument(
"The arc does not connect the first node");
3064 list.
insert(Path_Desc(static_cast<Node*>(arc->src_node), arc));
3075 auto & last_path_desc = list.
get_last();
3076 assert(last_path_desc.arc ==
nullptr);
3077 return last_path_desc.node;
3089 throw std::domain_error(
"Path with only a node (without any arc");
3094 return it.get_curr().arc;
3098 bool is_cycle() const noexcept {
return get_first_node() == get_last_node(); }
3126 std::swap(g, path.g);
3127 list.
swap(path.list);
3145 Path_Desc & get_curr_path_desc_ne()
const noexcept
3150 Path_Desc & get_curr_path_desc()
const 3161 Node * get_current_node_ne()
const noexcept
3163 return this->get_curr_path_desc_ne().node;
3178 if (this->is_in_last())
3179 throw std::overflow_error(
"Path iterator is in last node of path");
3181 return this->get_curr_path_desc().arc;
3184 Arc * get_current_arc_ne()
const noexcept
3186 return this->get_curr_path_desc_ne().arc;
3192 Node * get_curr()
const {
return get_current_node(); }
3206 return make_pair(get_current_node(), get_current_arc());
3221 return make_tuple(get_current_node(), get_current_arc());
3224 tuple<Node*, Arc*> get_tuple_ne()
const noexcept
3226 return make_tuple(get_current_node_ne(), get_current_arc_ne());
3239 return this->has_curr() and not this->is_in_last();
3253 template <
class Operation>
3256 for (
Iterator it(*
this); it.has_current_node(); it.next_ne())
3257 op (it.get_current_node_ne());
3264 template <
class Operation>
3267 for (
Iterator it(*
this); it.has_current_arc(); it.next_ne())
3268 op (it.get_current_arc_ne());
3274 for (
Iterator it(*
this); it.has_current_node(); it.next_ne())
3275 if (it.get_current_node_ne() == node)
3283 for (
Iterator it(*
this); it.has_current_arc(); it.next_ne())
3284 if (it.get_current_arc_ne() == arc)
3315 bool operator == (
const Path & p)
const noexcept
3317 return eq(this->list, p.list);
3321 bool operator != (
const Path & p)
const noexcept
3323 return not eq(this->list, p.list);
3327 template <
class GT>
inline 3329 typename GT::Node * end_node);
3331 template <
class GT>
static inline 3332 bool __find_path_depth_first(
const GT & g,
typename GT::Node * curr_node,
3333 typename GT::Arc * curr_arc,
3334 typename GT::Node * end_node,
Path<GT> & path)
3336 if (curr_node == end_node)
3346 NODE_BITS(curr_node).set_bit(Find_Path,
true);
3348 for (
auto it = g.get_arc_it(curr_node); it.has_curr(); it.next_ne())
3350 auto next_arc = it.get_curr_ne();
3354 ARC_BITS(next_arc).set_bit(Find_Path,
true);
3355 auto next_node = it.get_tgt_node();
3356 if (__find_path_depth_first<GT>(g, next_node, next_arc, end_node, path))
3382 template <
class GT>
inline 3384 typename GT::Node * end_node)
3388 g.reset_bit_nodes(Find_Path);
3389 g.reset_bit_arcs(Find_Path);
3390 NODE_BITS(start_node).set_bit(Find_Path,
true);
3392 for (
auto it = g.get_arc_it(start_node); it.has_curr(); it.next_ne())
3394 auto arc = it.get_current_arc_ne();
3395 ARC_BITS(arc).set_bit(Find_Path,
true);
3396 auto next_node = it.get_tgt_node();
3400 if (__find_path_depth_first<GT>(g, next_node, arc, end_node, path))
3418 template <
class GTS,
class GTT>
3419 void map_nodes(
typename GTS::Node * p,
typename GTT::Node * q) noexcept
3421 assert(p !=
nullptr and q !=
nullptr);
3444 template <
class GTS,
class GTT>
3445 void map_arcs(
typename GTS::Arc * p,
typename GTT::Arc * q) noexcept
3447 assert(p !=
nullptr and q !=
nullptr);
3465 for (
typename GT::Arc_Iterator it(g); it.has_curr(); )
3467 typename GT::Arc * arc = it.get_curr_ne();
3472 for (
typename GT::Node_Iterator it(g); it.has_curr(); )
3474 typename GT::Node * p = it.get_curr_ne();
3482 void copy_graph(GT & gtgt,
const GT & gsrc,
const bool cookie_map)
3490 for (
typename GT::Node_Iterator it(gsrc); it.has_curr(); it.next_ne())
3492 typename GT::Node * src_node = it.get_current_node_ne();
3493 unique_ptr<typename GT::Node>
3494 tgt_node(
new typename GT::Node(src_node->get_info()));
3495 map.
insert(src_node, tgt_node.get());
3497 typename GT::Node * tgt = tgt_node.release();
3498 assert(tgt->get_info() == src_node->get_info());
3499 gtgt.insert_node(tgt);
3505 assert(gtgt.get_num_nodes() == gsrc.get_num_nodes());
3509 for (
typename GT::Arc_Iterator it(gsrc); it.has_curr(); it.next_ne())
3511 typename GT::Arc * src_arc = it.get_current_arc_ne();
3514 typename GT::Node * src_node = map[gsrc.get_src_node(src_arc)];
3515 typename GT::Node * tgt_node = map[gsrc.get_tgt_node(src_arc)];
3516 typename GT::Arc * tgt_arc = gtgt.insert_arc(src_node, tgt_node);
3518 *tgt_arc = *src_arc;
3523 assert(gtgt.get_num_arcs() == gsrc.get_num_arcs());
3536 template <
class GTT,
class GTS>
3539 void operator () (
typename GTT::Node * tgt,
typename GTS::Node * src) noexcept
3541 tgt->get_info() = src->get_info();
3550 template <
class GTT,
class GTS>
3553 void operator () (
typename GTT::Arc * tgt,
typename GTS::Arc * src)
3555 tgt->get_info() = src->get_info();
3567 template <
class GTT,
class GTS,
3571 const bool cookie_map =
false)
3579 for (
typename GTS::Node_Iterator it(gsrc); it.has_curr(); it.next_ne())
3581 typename GTS::Node * src_node = it.get_current_node_ne();
3582 unique_ptr<typename GTT::Node> tgt_node(
new typename GTT::Node);
3583 Copy_Node () (tgt_node.get(), src_node);
3584 map.
insert(src_node, tgt_node.get());
3586 typename GTT::Node * tgt = tgt_node.release();
3587 gtgt.insert_node(tgt);
3590 map_nodes<GTS, GTT>(src_node, tgt);
3593 assert(gtgt.get_num_nodes() == gsrc.get_num_nodes());
3597 for (
typename GTS::Arc_Iterator it(gsrc); it.has_curr(); it.next_ne())
3599 typename GTS::Arc * src_arc = it.get_current_arc_ne();
3602 typename GTT::Node * src_node = map[gsrc.get_src_node(src_arc)];
3603 typename GTT::Node * tgt_node = map[gsrc.get_tgt_node(src_arc)];
3604 typename GTT::Arc * tgt_arc = gtgt.insert_arc(src_node, tgt_node);
3605 Copy_Arc () (tgt_arc, src_arc);
3607 map_arcs<GTS, GTT>(src_arc, tgt_arc);
3610 assert(gtgt.get_num_arcs() == gsrc.get_num_arcs());
3632 template <
class GT,
class SN = Dft_Show_Node<GT>,
class SA = Dft_Show_Arc<GT>>
3652 void copy(GT & gtgt,
const GT & gsrc,
const bool cookie_map)
3662 typename GT::Node * src_node = it.get_curr_ne();
3663 unique_ptr<typename GT::Node>
3664 tgt_node(
new typename GT::Node(src_node));
3665 map.
insert(src_node, tgt_node.get());
3667 typename GT::Node * tgt = tgt_node.release();
3668 gtgt.insert_node(tgt);
3678 typename GT::Arc * src_arc = it.get_curr_ne();
3681 typename GT::Node * src_node = map[gsrc.get_src_node(src_arc)];
3682 typename GT::Node * tgt_node = map[gsrc.get_tgt_node(src_arc)];
3683 typename GT::Arc * tgt_arc =
3684 gtgt.insert_arc(src_node, tgt_node, src_arc->get_info());
3706 void operator () (GT & gtgt, GT & gsrc,
const bool cookie_map =
true)
3708 copy(gtgt, gsrc, cookie_map);
3722 template <
class GT,
class Distance>
3726 typename Distance::Distance_Type
dist;
3730 bool operator () (
typename GT::Arc * a) noexcept
3735 dist = dist + ARC_DIST(a);
3761 template <
class GT>
inline 3762 bool are_equal(
const GT & g1,
const GT & g2);
Definition: tpl_graph.H:3633
Node_Arc_Iterator(Node *src) noexcept
Definition: tpl_graph.H:928
T foldl_arcs(GT &g, typename GT::Node *p, const T &init, std::function< T(const T &, typename GT::Arc *)> operation, SA sa=SA()) noexcept(noexcept(operation) and noexcept(sa) and std::is_nothrow_copy_assignable< T >::value)
Definition: tpl_graph.H:1557
void for_each_in_arc(typename GT::Node *p, Op op=Op()) noexcept(noexcept(op))
Definition: tpl_graph.H:2077
__Node_Info & get_info() noexcept
Return a modifiable reference to the data contained in the node.
Definition: graph-dry.H:242
GT::Arc * search_directed_arc(const GT &, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept
Definition: tpl_graph.H:2408
DynList< ArcPair< GT > > in_pairs(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1908
void clear_graph(GT &g) noexcept
Definition: tpl_graph.H:3463
Definition: tpl_graph.H:1225
void sort_nodes(Compare &cmp) noexcept
Definition: tpl_graph.H:754
Graph_Node(Node_Info &&info=Node_Info()) noexcept
Definition: tpl_graph.H:126
Definition: tpl_graph.H:56
void init() noexcept
Definition: dlink.H:186
void swap(DynDlist &l) noexcept
Definition: tpl_dynDlist.H:357
Arc_Iterator(const GT &g, Show_Arc sa=Show_Arc()) noexcept(noexcept(Itor(g, sa)))
Definition: tpl_graph.H:1240
Node * get_first_node() const
Definition: tpl_graph.H:532
size_t size() const noexcept
Return the path length in nodes.
Definition: tpl_graph.H:2755
Arc_Iterator(const List_Graph &g) noexcept
Initialize an iterator for all the arc of g
Definition: tpl_graph.H:997
Dlink * remove_last() noexcept
Definition: dlink.H:454
Node * get_first_node() const
Definition: tpl_graph.H:3069
void prev()
Definition: tpl_graph.H:1723
Pair * insert(const Key &key, const Type &data)
Definition: tpl_dynMapTree.H:112
Definition: graph-dry.H:170
Arc_Iterator() noexcept
The type of set.
Definition: tpl_graph.H:994
void insert(Node *node)
Definition: tpl_graph.H:2982
bool has_current_node() const noexcept
Return true if the iterator has a current node.
Definition: tpl_graph.H:3243
#define NODE_COOKIE(p)
Definition: aleph-graph.H:333
Node_Arc_Iterator() noexcept
The container type (a node)
Definition: tpl_graph.H:922
DynList< Arc * > arcs() const
Return a list with the arcs of path (order according to the path)
Definition: tpl_graph.H:3298
Definition: tpl_dynMapTree.H:328
void swap(List_Graph &g) noexcept
Swap in constant time this with g
Definition: tpl_graph.H:1046
auto get_tgt_node_ne() const noexcept
Definition: tpl_graph.H:1762
List_Graph(const List_Graph &g)
Definition: tpl_graph.H:817
Node * get_current_node() const
Definition: tpl_graph.H:3159
void insert_directed(Arc *arc)
Definition: tpl_graph.H:3052
Definition: tpl_graph.H:3551
Definition: tpl_graph.H:2493
Dlink * get_curr_ne() const noexcept
Return the current link guaranteeing no exception. Be careful.
Definition: dlink.H:670
Path(const Path &path)
Copy constructor.
Definition: tpl_graph.H:2769
Node_Arc_Iterator(typename GT::Node *p, Show_Arc sa=Show_Arc()) noexcept(noexcept(Itor(p, sa)))
Definition: tpl_graph.H:1200
void insert(Arc *arc)
Definition: tpl_graph.H:2951
void sort_nodes(Compare &&cmp=Compare()) noexcept
Definition: tpl_graph.H:762
bool traverse_arcs(typename GT::Node *p, Operation op=Operation()) noexcept(noexcept(op))
Definition: tpl_graph.H:2017
Definition: tpl_graph.H:988
#define IS_NODE_VISITED(p, bit)
Definition: aleph-graph.H:327
bool traverse_in_arcs(typename GT::Node *p, Op op=Op()) noexcept(noexcept(op))
Definition: tpl_graph.H:2064
GT::Node * get_node_ne() const noexcept
Return the connected node to current arc.
Definition: tpl_graph.H:1756
Node * get_curr_ne() const noexcept
Definition: tpl_graph.H:3190
Node * get_last_node() const
Definition: tpl_graph.H:3073
T & get_last() const
Return a modifiable reference to last item in the list.
Definition: tpl_dynDlist.H:240
auto get_tgt_node() const
Definition: tpl_graph.H:1753
bool contains_node(Node *node) const noexcept
Return true if node belongs to the path.
Definition: tpl_graph.H:3272
Graph_Arc(Arc_Info &&info=Arc_Info()) noexcept(noexcept(std::is_nothrow_move_constructible< Arc_Info >::value))
Definition: tpl_graph.H:235
Definition: tpl_graph.H:1693
void reset_first()
Coloca el iterador sobre el primer elemento de la secuencia.
Definition: filter_iterator.H:184
size_t out_degree(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1976
GT::Node * mapped_node(typename GT::Node *p) noexcept
Definition: tpl_graph.H:2429
DynList< ArcPair< GT > > out_pairs(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1927
Graph_Node(Graph_Node *node) noexcept(std::is_nothrow_copy_assignable< Node_Info >::value)
Definition: tpl_graph.H:160
GT::Arc * get_curr() const
Definition: tpl_graph.H:1730
DynList< typename GT::Node * > out_nodes(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1829
size_t in_degree(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1948
void copy_graph(GT >gt, const GT &gsrc, const bool cookie_map=false)
Definition: tpl_graph.H:3482
Node * remove_last_node() noexcept(noexcept(list.remove_last()))
Definition: tpl_graph.H:3105
#define ARC_COOKIE(p)
Definition: aleph-graph.H:366
void next()
Definition: tpl_graph.H:1717
auto get_current_arc() const
Definition: tpl_graph.H:1737
Definition: tpl_graph.H:1257
void map_arcs(typename GTS::Arc *p, typename GTT::Arc *q) noexcept
Definition: tpl_graph.H:3445
void append_directed(Arc *arc)
Definition: tpl_graph.H:2920
Node_Iterator(const GT &g, Show_Node sn=Show_Node()) noexcept(noexcept(Itor(g, sn)))
Definition: tpl_graph.H:1288
Definition: graph-dry.H:272
pair< Node *, Arc * > get_pair() const
Definition: tpl_graph.H:3204
void swap(Dlink *link) noexcept
Definition: dlink.H:82
Arc * get_curr_ne() const noexcept
Definition: tpl_graph.H:951
#define IS_ARC_VISITED(p, bit)
Definition: aleph-graph.H:360
void insert_directed(Node *p)
Definition: tpl_graph.H:3019
Definition: graph-dry.H:329
Path(const GT &__g) noexcept
Construct a empty path on graph __g
Definition: tpl_graph.H:2711
Arc * get_last_arc() const
Definition: tpl_graph.H:3086
T remove_last()
Definition: tpl_dynDlist.H:292
It::Item_Type Item_Type
Tipo de elemento que retorna get_curr()
Definition: filter_iterator.H:123
typename Itor::Set_Type Set_Type
The element type: Node*.
Definition: tpl_graph.H:1279
tuple< typename GT::Arc *, typename GT::Node * > ArcPair
Definition: tpl_graph.H:1629
size_t num_arcs
data associated to the node. Access it with get_info()
Definition: graph-dry.H:227
Definition: tpl_graph.H:53
Definition: graph-dry.H:42
DynList< typename GT::Arc * > arcs(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1893
void map_nodes(typename GTS::Node *p, typename GTT::Node *q) noexcept
Definition: tpl_graph.H:3419
Copy_Graph(SA __sa=SA(), SN __sn=SN())
Definition: tpl_graph.H:3645
void reset_last()
Coloca el iterador sobre el último elemento de la secuencia.
Definition: filter_iterator.H:187
Digraph_Iterator(typename GT::Node *p) noexcept(noexcept(Filter(p)) and noexcept(Itor(p, filt)))
Iterator type.
Definition: tpl_graph.H:1708
virtual Node * insert_node(Node *node) noexcept
Definition: tpl_graph.H:474
void swap(Path &path) noexcept
Fast spat between two paths (constant time)
Definition: tpl_graph.H:3124
typename Itor::Set_Type Set_Type
type of element: Arc*
Definition: tpl_graph.H:1191
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
Definition: graph-dry.H:206
Graph_Arc(const Arc_Info &info) noexcept(noexcept(std::is_nothrow_copy_constructible< Arc_Info >::value))
Definition: tpl_graph.H:219
typename Itor::Set_Type Set_Type
Type of element: Arc*.
Definition: tpl_graph.H:1231
Node * get_tgt_node() const
Definition: tpl_graph.H:1034
T & get_first() const
Return a modifiable reference to first item in the list.
Definition: tpl_dynDlist.H:232
List_Graph() noexcept
Construct an empty graph.
Definition: tpl_graph.H:1043
NodeInfo Node_Type
The node.
Definition: graph-dry.H:233
virtual void remove_arc(Arc *arc) noexcept
Definition: tpl_graph.H:608
bool all(Operation &operation) const noexcept(noexcept(operation))
Definition: htlist.H:719
void sort_arcs(Compare &cmp) noexcept
Definition: tpl_graph.H:789
Definition: tpl_graph.H:1063
void for_each_node(Operation op=Operation()) const noexcept(noexcept(op))
Definition: tpl_graph.H:3254
bool has_curr() const noexcept
Return true the iterator has an current arc.
Definition: tpl_graph.H:1726
Operate_On_Arcs(SA __sa=SA()) noexcept(std::is_nothrow_constructible< SA >::value)
Initialize the functor with the filter sa
Definition: tpl_graph.H:2547
void next()
Adelanta el iterador una posición.
Definition: filter_iterator.H:169
Path(const GT &_g, Node *start_node)
Definition: tpl_graph.H:2730
void sort_arcs(Compare &&cmp=Compare()) noexcept
Definition: tpl_graph.H:797
const GT & get_graph() const noexcept
Get a constant reference to the graph.
Definition: tpl_graph.H:2705
Arc * get_first_arc(Node *node) const
Definition: tpl_graph.H:552
Arc * get_current_arc() const
Definition: tpl_graph.H:3176
virtual void disconnect_arc(Arc *arc) noexcept
Definition: tpl_graph.H:656
bool check() const
Return true if the path is consistent.
Definition: tpl_graph.H:2683
void inter_copy_graph(GTT >gt, const GTS &gsrc, const bool cookie_map=false)
Definition: tpl_graph.H:3570
void reset_first() noexcept
Reset the iterator to the first arc.
Definition: tpl_graph.H:1765
void append_directed(Node *p)
Definition: tpl_graph.H:2880
Path< GT > find_path_depth_first(const GT &g, typename GT::Node *start_node, typename GT::Node *end_node)
Definition: tpl_graph.H:3383
Definition: tpl_graph.H:3723
Iterator get_it() const
Returns an iterator on the path.
Definition: tpl_graph.H:3247
Node * get_tgt_node() const
Definition: tpl_graph.H:965
bool forall_arc(typename GT::Node *p, std::function< bool(typename GT::Arc *)> cond, SA sa=SA()) noexcept(noexcept(cond) and noexcept(sa))
Definition: tpl_graph.H:1410
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Definition: graph-dry.H:447
Arc * get_first_arc() const
Definition: tpl_graph.H:3082
Definition: tpl_graph.H:1796
Arc * get_first_arc() const
Definition: tpl_graph.H:724
GT::Arc * search_arc(const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept
Definition: tpl_graph.H:2381
void for_each_arc(typename GT::Node *p, Operation op=Operation()) noexcept(noexcept(op))
Definition: tpl_graph.H:2044
GT::Node * get_node() const
Return the connected node to current arc.
Definition: tpl_graph.H:1747
#define NODE_BITS(p)
Definition: aleph-graph.H:305
bool is_unitarian() const noexcept
Return true if this (as header node) has exactly one element.
Definition: dlink.H:195
Definition: tpl_graph.H:1810
void reset_last() noexcept
Reset the iterator to the last arc.
Definition: tpl_graph.H:1768
Arc * get_current_arc_ne() const noexcept
Return the current arc. Throw overflow_error if there is no one.
Definition: tpl_graph.H:1004
Node_Iterator() noexcept
The set: the arcs of a graph.
Definition: tpl_graph.H:1281
Definition: tpl_graph.H:912
Dlink * get_curr() const
Definition: dlink.H:681
bool is_empty() const noexcept
Return true if this (as header node) is empty.
Definition: dlink.H:192
virtual ~List_Graph()
Destructor: all the nodes and arcs and removed and freed.
Definition: tpl_graph.H:866
void for_each_arc(Operation op=Operation()) const noexcept(noexcept(op))
Definition: tpl_graph.H:3265
Definition: tpl_graph.H:877
void init(Node *start_node)
Definition: tpl_graph.H:2722
void set_graph(const GT &__g, Node *start_node=nullptr)
Definition: tpl_graph.H:2745
typename GT::Node_Type Node_Type
The type of dfata stored in the nodes.
Definition: tpl_graph.H:2637
size_t get_num_arcs() const noexcept
Definition: graph-dry.H:494
Definition: tpl_graph.H:1667
Definition: tpl_graph.H:1270
bool is_empty() const noexcept
Return true if the path is empty.
Definition: tpl_graph.H:2758
GT::Arc * get_curr_ne() const noexcept
Definition: tpl_graph.H:1734
Path(Path &&path)
Move constructor.
Definition: tpl_graph.H:2772
Arc * get_curr() const
Definition: tpl_graph.H:945
Iterator(const Path &path) noexcept
Create an iterator on the first node of path
Definition: tpl_graph.H:3140
#define ARC_BITS(p)
Definition: aleph-graph.H:351
bool contains_arc(Arc *arc) const noexcept
Return true if arc belongs to the path.
Definition: tpl_graph.H:3281
const size_t & size() const noexcept
Return the number of elements (constant time)
Definition: tpl_dynDlist.H:74
List_Graph(List_Graph &&g) noexcept
Definition: tpl_graph.H:831
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
Definition: graph-dry.H:453
__Euclidian_Arc Arc
The node class type.
Definition: tpl_graph.H:414
Node * remove_first_node() noexcept(noexcept(list.remove_first()))
Definition: tpl_graph.H:3117
void append(Dlink *node) noexcept
Definition: dlink.H:228
__Euclidian_Node Node
The graph type.
Definition: tpl_graph.H:413
Definition: tpl_graph.H:59
Graph_Node(const Node_Info &info) noexcept
The type of data stored in the node.
Definition: tpl_graph.H:115
Operate_On_Nodes(SN __sn=SN()) noexcept(std::is_nothrow_constructible< SN >::value)
Initialize the functor with the filter sa
Definition: tpl_graph.H:2500
typename GT::Out_Iterator __Out_Iterator
Definition: tpl_graph.H:1780
T & get_curr() const
Definition: tpl_dynDlist.H:495
Dlink *& get_next() const noexcept
Return the link that is after this
Definition: dlink.H:241
void for_each_out_arc(typename GT::Node *p, Op op=Op()) noexcept(noexcept(op))
Definition: tpl_graph.H:2234
typename GT::Arc_Type Arc_Type
The type of data stored in the arc.
Definition: tpl_graph.H:2640
virtual void remove_node(Node *node) noexcept
Definition: tpl_graph.H:493
Definition: filter_iterator.H:68
Node * get_src_node() const
Definition: tpl_graph.H:1021
Arc_Iterator() noexcept
Type of set all the arcs.
Definition: tpl_graph.H:1233
bool is_cycle() const noexcept
Return true if this is a cycle.
Definition: tpl_graph.H:3098
typename GT::In_Iterator __In_Iterator
Definition: tpl_graph.H:1788
Definition: tpl_graph.H:46
void empty()
Clean the path: all the nodes and arc are removed.
Definition: tpl_graph.H:2761
T & append(const T &item)
Definition: htlist.H:1471
Arc * insert_arc(Node *src, Node *tgt, const Arc_Type &arc_info)
Definition: graph-dry.H:899
void append(Arc *arc)
Definition: tpl_graph.H:2808
Definition: tpl_graph.H:1177
Distance::Distance_Type dist
Accumutive distance from the first seen arc until the last seen.
Definition: tpl_graph.H:3726
Definition: tpl_graph.H:48
Node_Arc_Iterator() noexcept
Type of set: p's arcs.
Definition: tpl_graph.H:1193
bool traverse_out_arcs(typename GT::Node *p, Op op=Op()) noexcept(noexcept(op))
Definition: tpl_graph.H:2221
T foldl_nodes(GT &g, const T &init, std::function< T(const T &, typename GT::Node *)> operation, SN sn=SN()) noexcept(noexcept(operation) and noexcept(sn) and std::is_nothrow_copy_assignable< T >::value)
Definition: tpl_graph.H:1508
tuple< Node *, Arc * > get_tuple() const
Definition: tpl_graph.H:3219
GT::Node * get_node(typename GT::Arc *a) const noexcept
Definition: tpl_graph.H:1741
void end() noexcept
Put the iterator in end state.
Definition: tpl_graph.H:1771
Dlink * remove_first() noexcept
Definition: dlink.H:459
virtual Arc * connect_arc(Arc *arc) noexcept
Definition: tpl_graph.H:689
T remove_first()
Definition: tpl_dynDlist.H:280
bool has_current_arc() const noexcept
Definition: tpl_graph.H:3237
bool forall_node(const GT &g, std::function< bool(typename GT::Node *)> cond, SN sn=SN()) noexcept(noexcept(cond) and noexcept(sn))
Definition: tpl_graph.H:1366
Definition: tpl_graph.H:3135
T & insert(const T &item)
Definition: tpl_dynDlist.H:127
void append(Node *node)
Definition: tpl_graph.H:2841
Definition: tpl_graph.H:1638
Definition: graph-dry.H:147
Definition: tpl_graph.H:3537
DynList< Node * > nodes() const
Return a list with the nodes of path (order according to the path)
Definition: tpl_graph.H:3290
Container< T > nodes_map(GT &g, std::function< T(typename GT::Node *)> transformation, SN sn=SN())
Definition: tpl_graph.H:1435
Definition: tpl_graph.H:2540
bool check_directed() const
Return true if the directed path is consistent.
Definition: tpl_graph.H:2698
DynList< typename GT::Arc * > in_arcs(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1878
DynList< typename GT::Arc * > out_arcs(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1862
bool inside_graph(const GT &gr) const noexcept
Return true if this is on graph gr
Definition: tpl_graph.H:2708
Node_Iterator(const List_Graph &g)
Construct an iterator on the nodes of g
Definition: tpl_graph.H:882
T & append(const T &item)
Definition: tpl_dynDlist.H:149
Arc * get_current_arc() const
Definition: tpl_graph.H:958
DynList< typename GT::Node * > in_nodes(typename GT::Node *p, SA sa=SA())
Definition: tpl_graph.H:1846
Container< T > arcs_map(GT &g, typename GT::Node *p, std::function< T(typename GT::Arc *)> transformation, SA sa=SA())
Definition: tpl_graph.H:1484