6 # include <tpl_dynArray.H>
7 # include <tpl_sort_utils.H>
8 # include <tpl_dynMapTree.H>
9 # include <tpl_dynDlist.H>
10 # include <tpl_treapRk.H>
11 # include <tpl_aleph_graph.H>
12 # include <filter_iterator.H>
15 using namespace Aleph;
19 template <
typename Node_Info>
class Graph_Node;
21 template <
typename Arc_Info>
class Graph_Arc;
28 template <
typename __Graph_Node,
typename __Graph_Arc>
31 template <
typename __Graph_Node,
typename __Graph_Arc>
37 template <
typename MT,
typename Entry_Info,
typename Copy>
77 template <
typename __Node_Info = Empty_Class>
86 typedef __Node_Info Node_Info;
110 : Base_Node(std::move(node))
135 : Base_Node(std::move(info))
200 template <
typename __Arc_Info = Empty_Class>
206 typedef __Arc_Info Arc_Info;
212 : src_arc_node(NULL), tgt_arc_node(NULL)
218 : Base_Arc(info), src_arc_node(NULL), tgt_arc_node(NULL)
224 : Base_Arc(std::move(info)), src_arc_node(NULL), tgt_arc_node(NULL)
229 Graph_Arc(
void * src,
void * tgt,
const Arc_Info & info)
230 : Base_Arc(src, tgt, info), src_arc_node(NULL), tgt_arc_node(NULL)
235 Graph_Arc(
void * src,
void * tgt, Arc_Info && info)
236 : Base_Arc(src, tgt, std::move(info)),
237 src_arc_node(NULL), tgt_arc_node(NULL)
243 : Base_Arc(src, tgt), src_arc_node(NULL), tgt_arc_node(NULL)
253 Arc_Node(
void * __arc) : arc(__arc) {}
284 template <
typename __Graph_Node = Graph_Node<
int>,
285 typename __Graph_Arc = Graph_Arc<
int>>
289 typedef __Graph_Node Node;
290 typedef __Graph_Arc Arc;
291 typedef typename Node::Node_Info Node_Type;
292 typedef typename Arc::Arc_Info Arc_Type;
300 static Node * dlink_to_node(
Dlink * p) {
return (Node*) p; }
302 static Arc * dlink_to_arc(
Dlink * p) {
return (Arc*) p; }
306 static Arc * void_to_arc(
Arc_Node * arc_node)
308 return (Arc*) arc_node->arc;
317 Cmp_Arc(Cmp && __cmp = Cmp()) : cmp(__cmp) { }
319 Cmp_Arc(Cmp & __cmp) : cmp(__cmp) { }
321 bool operator () (
Dlink * d1,
Dlink * d2)
const
323 Arc * arc1 = dlink_to_arc(d1);
324 Arc * arc2 = dlink_to_arc(d2);
325 return cmp(arc1, arc2);
361 inline virtual Node *
insert_node(
const Node_Type & node_info);
365 inline virtual Node *
insert_node(Node_Type && node_info = Node_Type());
419 const typename Arc::Arc_Type & arc_info);
423 typename Arc::Arc_Type && arc_info);
425 inline virtual Arc *
insert_arc(Node * src_node, Node * tgt_node);
494 template <
class Compare>
inline
495 void sort_arcs(Compare && cmp = Compare());
497 template <
class Compare>
inline
500 GRAPH_SEARCH_METHODS;
649 GRAPH_ITERATIVE_METHODS;
660 node_list.swap(&g.node_list);
661 arc_list.swap(&g.arc_list);
672 bool operator () (
typename GT::Arc * )
const
679 template <
class GT,
class SA1,
class SA2>
684 typename GT::Node * s;
688 Double_SA(SA1 && __sa1 = SA1(), SA2 && __sa2 = SA2())
689 : sa1(__sa1) , sa2(__sa2)
695 : sa1(__sa1) , sa2(__sa2)
700 Double_SA(SA1 & __sa1, SA2 && __sa2 = SA2())
701 : sa1(__sa1) , sa2(__sa2)
707 : sa1(__sa1) , sa2(__sa2)
712 bool operator () (
typename GT::Arc * a)
714 return sa1(a) and sa2(a);
736 typename GT::Node_Arc_Iterator,
737 Show_Arc> Filter_Itor;
741 <
typename GT::Node*,
typename GT::Node_Arc_Iterator, Show_Arc> Itor;
749 Node_Arc_Iterator() { }
757 : Itor(p, std::move(sa))
786 template <
class GT,
class Show_Arc = Dft_Show_Arc<GT>>
808 : Itor(g, std::move(sa))
832 bool operator () (
typename GT::Node *)
const
849 template <
class GT,
class Show_Node = Dft_Show_Node<GT>>
871 : Itor (g, std::move(sn))
905 template <
typename __Graph_Node = Graph_Node<
int>,
906 typename __Graph_Arc = Graph_Arc<
int>>
913 typedef __Graph_Node Node;
915 typedef __Graph_Arc Arc;
919 this->digraph =
true;
924 this->digraph =
true;
930 this->digraph =
true;
964 template <
class GT,
class Show_Arc = Dft_Show_Arc<GT>>
967 typename GT::Out_Iterator,
973 <
typename GT::Node*,
typename GT::Out_Iterator, Show_Arc> Itor;
1011 template <
class GT,
class Show_Arc = Dft_Show_Arc<GT>>
1014 typename GT::In_Iterator,
1020 <
typename GT::Node*,
typename GT::In_Iterator, Show_Arc> Itor;
1092 template <
class GT,
class SA>
typename GT::Arc *
1093 search_arc(GT & g,
typename GT::Node * src_node,
1094 typename GT::Node * tgt_node);
1098 typename GT::Node * mapped_node(
typename GT::Node * p)
1105 typename GT::Arc * mapped_arc(
typename GT::Arc * a)
1112 template <
class GTSRC,
class GTTGT>
1113 typename GTTGT::Node * mapped_node(
typename GTSRC::Node * p)
1119 template <
class GTSRC,
class GTTGT>
1120 typename GTTGT::Arc * mapped_arc(
typename GTSRC::Arc * a)
1122 return (
typename GTTGT::Arc *)
ARC_COOKIE(a);
1144 void copy_graph(GT & gtgt, GT & gsrc,
const bool cookie_map =
false);
1151 template <
class GT>
inline void clear_graph(GT & g);
1167 template <
class GT,
class Operation,
class SN = Dft_Show_Node<GT>>
1184 void operator () (GT & g, Operation op = Operation())
const
1187 op (g, it.get_curr());
1199 void operator () (GT & g,
void * ptr, Operation op = Operation())
const
1202 op (g, it.get_curr(), ptr);
1220 template <
class GT,
class Operation,
1238 void operator () (GT & g, Operation op = Operation())
const
1241 op (g, it.get_curr());
1252 void operator () (GT & g,
void * ptr, Operation op = Operation())
const
1255 op (g, itor.get_curr(), ptr);
1264 void operator () (GT & g,
typename GT::Node * p,
1265 Operation op = Operation())
const
1268 op (g, it.get_current_arc());
1280 void operator () (GT & g,
typename GT::Node * node,
1281 void * ptr, Operation op = Operation())
const
1284 op (g, it.get_current_arc(), ptr);
1319 typedef typename GT::Node Node;
1320 typedef typename GT::Arc Arc;
1326 Path_Desc(Node * _node = NULL, Arc * _arc = NULL)
1327 : node(_node), arc(_arc) {}
1337 void *& get_cookie() {
return cookie; }
1347 Path(GT & _g,
void * __cookie = NULL) : g(&_g), cookie(__cookie) {}
1358 void init(Node * start_node) {
list.append(Path_Desc(start_node)); }
1368 Path(GT & _g, Node * start_node,
void * __cookie = NULL)
1369 : g(&_g), cookie(__cookie) { init(start_node); }
1386 if (start_node == NULL)
1400 while (not
list.is_empty())
1401 list.remove_first();
1451 if (
list.is_empty())
1452 throw std::domain_error(
"path is empty");
1454 Path_Desc & last_path_desc =
list.get_last();
1457 throw std::domain_error(
"Graph has not been specified");
1459 last_path_desc.arc = arc;
1460 list.append(Path_Desc(g->get_connected_node(arc, last_path_desc.node)));
1492 if (
list.is_empty())
1499 throw std::domain_error(
"Graph has not been specified");
1501 Node * last_node = get_last_node();
1505 throw std::domain_error(
"There is no an arc connecting to the node");
1538 if (
list.is_empty())
1539 throw std::domain_error(
"path is empty");
1542 throw std::domain_error(
"Graph has not been specified");
1544 Path_Desc & first_path_desc =
list.get_first();
1546 Path_Desc item(g->get_connected_node(arc, first_path_desc.node), arc);
1580 if (
list.is_empty())
1587 throw std::domain_error(
"Graph has not been specified");
1589 Node * first_node = get_first_node();
1590 Arc * arc =
search_arc(*g, node, first_node);
1592 throw std::domain_error(
"There is no arc connecting node");
1609 if (
list.is_unitarian())
1610 throw std::domain_error(
"Path with only a node (without any arc");
1615 return it.get_current().arc;
1619 bool is_cycle()
const {
return get_first_node() == get_last_node(); }
1625 list.get_last().arc = NULL;
1631 list.remove_first();
1637 std::swap(g, path.g);
1646 class Iterator :
public DynDlist<Path_Desc>::Iterator
1655 Path_Desc & get_curr_path_desc()
1670 if (this->is_in_last())
1671 throw std::overflow_error(
"Path iterator is in last node of path");
1673 return this->get_curr_path_desc().arc;
1687 return this->has_current() and not this->is_in_last();
1700 template <
class Operation>
1704 op (it.get_current_node());
1713 template <
class Operation>
1717 op (it.get_current_arc());
1730 template <
class Operation>
1734 Operation(ptr) (it.get_current_node());
1747 template <
class Operation>
1751 Operation(ptr) (it.get_current_arc());
1758 if (it.get_current_node() == node)
1767 if (it.get_current_arc() == arc)
1773 template <
class GT,
class SA = Dft_Show_Arc<GT>>
inline
1775 typename GT::Node * end_node,
Path<GT> & path);
1777 template <
class GT,
class SA>
inline
1778 bool __find_path_depth_first(GT& g,
typename GT::Node * curr_node,
1779 typename GT::Arc * curr_arc,
1780 typename GT::Node * end_node,
Path<GT> & curr_path)
1782 if (curr_node == end_node)
1784 curr_path.
append(curr_arc);
1791 curr_path.
append(curr_arc);
1792 NODE_BITS(curr_node).set_bit(Find_Path,
true);
1797 typename GT::Arc * next_arc = i.get_current_arc();
1801 ARC_BITS(next_arc).set_bit(Find_Path,
true);
1802 typename GT::Node * next_node = i.get_tgt_node();
1803 if (__find_path_depth_first<GT, SA> (g, next_node, next_arc,
1804 end_node, curr_path))
1847 template <
class GT,
class SA = Dft_Show_Arc<GT>>
inline
1849 typename GT::Node * end_node,
Path<GT> & path)
1852 throw std::invalid_argument(
"Path does not belong to graph");
1855 path.
init(start_node);
1856 g.reset_bit_nodes(Find_Path);
1857 g.reset_bit_arcs(Find_Path);
1858 NODE_BITS(start_node).set_bit(Find_Path,
true);
1863 typename GT::Arc * arc = i.get_current_arc();
1864 ARC_BITS(arc).set_bit(Find_Path,
true);
1865 typename GT::Node * next_node = i.get_tgt_node();
1869 if (__find_path_depth_first<GT, SA>(g, next_node, arc, end_node, path))
1876 template <
class GTS,
class GTT>
1877 void map_nodes(
typename GTS::Node * p,
typename GTT::Node * q)
1879 I(p != NULL and q != NULL);
1892 template <
class GTS,
class GTT>
1893 void map_arcs(
typename GTS::Arc * p,
typename GTT::Arc * q)
1895 I(p != NULL and q != NULL);
1915 template <
typename Node,
typename Arc>
1918 if (Base_Graph::num_nodes == 0)
1919 throw std::range_error(
"Graph has not nodes");
1921 return dlink_to_node(node_list.get_next());
1924 template <
typename Node,
typename Arc>
1927 if (Base_Graph::num_arcs == 0)
1928 throw std::range_error(
"Graph has not arcs");
1930 return dlink_to_arc(arc_list.get_next());
1933 template <
typename Node,
typename Arc>
1936 if (get_num_arcs(node) == 0)
1937 throw std::range_error(
"node has not arcs");
1939 void * arc = dlink_to_arc_node(node->arc_list.get_next())->arc;
1940 return reinterpret_cast <Arc *> (arc);
1942 template <
typename Node,
typename Arc>
1944 :
Dlink::Iterator(&_g.node_list)
1949 template <
typename Node,
typename Arc>
1955 template <
typename Node,
typename Arc>
1957 :
Dlink::Iterator(&_g.arc_list)
1962 template <
typename Node,
typename Arc>
1968 template <
typename Node,
typename Arc>
1971 return static_cast<Arc*
>(get_current_arc_node()->arc);
1974 template <
typename Node,
typename Arc>
1977 return static_cast<Node*
>(get_current_arc()->get_connected_node(src_node));
1980 template <
typename Node,
typename Arc>
1983 ++Base_Graph::num_nodes;
1988 template <
typename Node,
typename Arc> Node *
1994 template <
typename Node,
typename Arc> Node *
1998 (
new Node (std::move(node_info)) );
2001 template <
typename Node,
typename Arc> Arc *
2005 unique_ptr<Arc> arc (
new Arc );
2006 arc->src_node = src_node;
2007 arc->tgt_node = tgt_node;
2010 unique_ptr<Arc_Node> src_arc_node (
new Arc_Node (arc.get()));
2013 if (not Base_Graph::digraph)
2015 if (src_node == tgt_node)
2016 arc->tgt_arc_node = src_arc_node.get();
2019 unique_ptr<Arc_Node> tgt_arc_node(
new Arc_Node(arc.get()));
2022 arc->tgt_arc_node = tgt_arc_node.get();
2023 tgt_node->arc_list.append(tgt_arc_node.get());
2024 tgt_node->num_arcs++;
2025 tgt_arc_node.release();
2030 arc->src_arc_node = src_arc_node.get();
2031 src_node->arc_list.append(src_arc_node.get());
2032 src_node->num_arcs++;
2034 arc_list.
append(arc.get());
2035 ++Base_Graph::num_arcs;
2036 src_arc_node.release();
2038 return arc.release();
2042 template <
typename Node,
typename Arc>
2045 Node * src_node = get_src_node(arc);
2046 Node * tgt_node = get_tgt_node(arc);
2047 Arc_Node * src_arc_node = arc->src_arc_node;
2048 Arc_Node * tgt_arc_node = arc->tgt_arc_node;
2050 if (not Base_Graph::digraph)
2052 if (src_node != tgt_node)
2054 tgt_node->arc_list.
append(tgt_arc_node);
2055 tgt_node->num_arcs++;
2059 src_node->arc_list.append(src_arc_node);
2060 src_node->num_arcs++;
2062 ++Base_Graph::num_arcs;
2067 template <
typename Node,
typename Arc> Arc *
2069 const typename Arc::Arc_Type & arc_info)
2072 arc->get_info() = arc_info;
2077 template <
typename Node,
typename Arc> Arc *
2079 typename Arc::Arc_Type && arc_info)
2082 arc->get_info() = std::move(arc_info);
2088 template <
typename Node,
typename Arc>
2091 Node * src_node = get_src_node(arc);
2092 Arc_Node * src_arc_node = arc->src_arc_node;
2094 src_arc_node->
del();
2095 src_node->num_arcs--;
2096 delete src_arc_node;
2098 if (not Base_Graph::digraph)
2100 Node * tgt_node = get_tgt_node(arc);
2101 if (src_node != tgt_node)
2103 Arc_Node * tgt_arc_node = arc->tgt_arc_node;
2104 tgt_arc_node->
del();
2105 tgt_node->num_arcs--;
2106 delete tgt_arc_node;
2112 --Base_Graph::num_arcs;
2116 template <
typename Node,
typename Arc>
2119 Node * src_node = get_src_node(arc);
2120 Arc_Node * src_arc_node = arc->src_arc_node;
2121 src_arc_node->
del();
2122 src_node->num_arcs--;
2124 if (not Base_Graph::digraph)
2126 Node * tgt_node = get_tgt_node(arc);
2127 if (src_node != tgt_node)
2129 Arc_Node * tgt_arc_node = arc->tgt_arc_node;
2130 tgt_arc_node->
del();
2131 tgt_node->num_arcs--;
2137 --Base_Graph::num_arcs;
2140 template <
typename Node,
typename Arc>
2143 if (not Base_Graph::digraph)
2145 while (not node->arc_list.is_empty())
2148 dlink_to_arc_node(node->arc_list.get_next());
2149 Arc * arc = void_to_arc(arc_node);
2155 Arc * arc = it.get_current();
2156 if (get_src_node(arc) == node or get_tgt_node(arc) == node)
2167 --Base_Graph::num_nodes;
2171 template <
typename Node,
typename Arc>
2178 template <
typename Node,
typename Arc>
2185 template <
typename Node,
typename Arc>
2195 template <
typename Node,
typename Arc>
2203 template <
typename Node,
typename Arc>
2209 template <
typename Node,
typename Arc>
2210 template <
class Compare>
2213 mergesort<Dlink, Cmp_Arc<Compare>>(arc_list, Cmp_Arc<Compare>(cmp));
2216 template <
typename Node,
typename Arc>
2217 template <
class Compare>
2220 Cmp_Arc<Compare> comp(cmp);
2221 mergesort<Dlink, Cmp_Arc<Compare>>(arc_list, comp);
2226 template <
class GT,
class SA>
2228 typename GT::Node * src,
typename GT::Node * tgt)
2230 I(src != NULL and tgt != NULL);
2233 if (not g.is_digraph() and tgt->num_arcs < src->num_arcs)
2234 std::swap(tgt, src);
2237 if (itor.get_tgt_node() == tgt)
2238 return itor.get_current_arc();
2245 typename GT::Arc *
search_arc(GT & g,
typename GT::Node * src_node,
2246 typename GT::Node * tgt_node)
2248 return search_arc<GT, Dft_Show_Arc<GT>>(g, src_node, tgt_node);
2254 for (
typename GT::Arc_Iterator it(g); it.has_current(); )
2256 typename GT::Arc * arc = it.get_current();
2261 for (
typename GT::Node_Iterator it(g); it.has_current(); )
2263 typename GT::Node * p = it.get_current();
2271 void copy_graph(GT & gtgt, GT & gsrc,
const bool cookie_map)
2273 IG(not gtgt.is_digraph() and gsrc.is_digraph(),
2274 gtgt.is_digraph() != gsrc.is_digraph());
2282 for (
typename GT::Node_Iterator it(gsrc); it.has_curr(); it.next())
2284 typename GT::Node * src_node = it.get_current_node();
2285 unique_ptr<typename GT::Node>
2286 tgt_node(
new typename GT::Node(src_node));
2287 map.
insert(src_node, tgt_node.get());
2289 typename GT::Node * tgt = tgt_node.release();
2290 gtgt.insert_node(tgt);
2293 GT::map_nodes(src_node, tgt);
2296 I(gtgt.get_num_nodes() == gsrc.get_num_nodes());
2300 for (
typename GT::Arc_Iterator it(gsrc); it.has_current(); it.next())
2302 typename GT::Arc * src_arc = it.get_current_arc();
2305 typename GT::Node * src_node = map(gsrc.get_src_node(src_arc));
2306 typename GT::Node * tgt_node = map(gsrc.get_tgt_node(src_arc));
2307 typename GT::Arc * tgt_arc = gtgt.insert_arc(src_node, tgt_node);
2308 tgt_arc->get_info() = src_arc->get_info();
2310 GT::map_arcs(src_arc, tgt_arc);
2313 I(gtgt.get_num_arcs() == gsrc.get_num_arcs());
2322 template <
class GTT,
class GTS>
2325 void operator () (
typename GTT::Node * tgt,
typename GTS::Node * src)
2327 tgt->get_info() = src->get_info();
2332 template <
class GTT,
class GTS>
2335 void operator () (
typename GTT::Arc * tgt,
typename GTS::Arc * src)
2337 tgt->get_info() = src->get_info();
2345 template <
class GTT,
class GTS,
2348 void inter_copy_graph(GTT & gtgt, GTS & gsrc,
const bool cookie_map =
false)
2350 IG(not gtgt.is_digraph() and gsrc.is_digraph(),
2351 gtgt.is_digraph() != gsrc.is_digraph());
2359 for (
typename GTS::Node_Iterator it(gsrc); it.has_current(); it.next())
2361 typename GTS::Node * src_node = it.get_current_node();
2362 unique_ptr<typename GTT::Node> tgt_node(
new typename GTT::Node);
2363 Copy_Node () (tgt_node.get(), src_node);
2364 map.
insert(src_node, tgt_node.get());
2366 typename GTT::Node * tgt = tgt_node.release();
2367 gtgt.insert_node(tgt);
2370 map_nodes<GTS, GTT>(src_node, tgt);
2373 I(gtgt.get_num_nodes() == gsrc.get_num_nodes());
2377 for (
typename GTS::Arc_Iterator it(gsrc); it.has_current(); it.next())
2379 typename GTS::Arc * src_arc = it.get_current_arc();
2382 typename GTT::Node * src_node = map[gsrc.get_src_node(src_arc)];
2383 typename GTT::Node * tgt_node = map[gsrc.get_tgt_node(src_arc)];
2384 typename GTT::Arc * tgt_arc = gtgt.insert_arc(src_node, tgt_node);
2385 Copy_Arc () (tgt_arc, src_arc);
2387 map_arcs<GTS, GTT>(src_arc, tgt_arc);
2390 I(gtgt.get_num_arcs() == gsrc.get_num_arcs());
2436 : sn(__sn), sa(__sa)
2443 : sn(__sn), sa(__sa)
2450 : sn(__sn), sa(__sa)
2457 void copy(GT & gtgt, GT & gsrc,
const bool cookie_map)
2459 IG(not gtgt.is_digraph() and gsrc.is_digraph(),
2460 gtgt.is_digraph() != gsrc.is_digraph());
2470 typename GT::Node * src_node = it.get_curr();
2471 unique_ptr<typename GT::Node>
2472 tgt_node(
new typename GT::Node(src_node));
2473 map.
insert(src_node, tgt_node.get());
2475 typename GT::Node * tgt = tgt_node.release();
2476 gtgt.insert_node(tgt);
2479 GT::map_nodes(src_node, tgt);
2486 typename GT::Arc * src_arc = it.get_curr();
2489 typename GT::Node * src_node = map[gsrc.get_src_node(src_arc)];
2490 typename GT::Node * tgt_node = map[gsrc.get_tgt_node(src_arc)];
2491 typename GT::Arc * tgt_arc =
2492 gtgt.insert_arc(src_node, tgt_node, src_arc->get_info());
2495 GT::map_arcs(src_arc, tgt_arc);
2519 void operator () (GT & gtgt, GT & gsrc,
const bool cookie_map =
true)
2521 copy(gtgt, gsrc, cookie_map);
Definition: tpl_graph.H:2657
void operate_on_arcs(void *ptr)
Definition: tpl_graph_try.H:1748
Copy_Graph(SA &__sa, SN &__sn)
Definition: tpl_graph_try.H:2435
Node_Arc_Iterator(Node *src)
Instancia un iterador sobre el nodo _src_node.
Definition: tpl_graph_try.H:588
void inter_copy_graph(GTT >gt, GTS &gsrc, const bool cookie_map=false)
Definition: tpl_graph.H:2582
Definition: tpl_graph.H:29
virtual void remove_node(Node *node)
Definition: tpl_graph.H:2375
Node * get_current()
Definition: tpl_graph_try.H:559
const size_t & size() const
Retorna la longitud del camino en nodos.
Definition: tpl_graph_try.H:1392
Node_Iterator(GT &g, Show_Node &sn)
Definition: tpl_graph_try.H:881
void insert(Node *node)
Definition: tpl_graph_try.H:1578
Node * get_first_node() const
Definition: tpl_graph.H:2150
virtual void remove_arc(Arc *arc)
Definition: tpl_graph.H:2323
void sort_arcs(Compare &&cmp=Compare())
Definition: tpl_graph.H:2445
#define NODE_COOKIE(p)
Definition: aleph-graph.H:248
virtual ~List_Graph()
Definition: tpl_graph.H:2438
Definition: tpl_dynMapTree.H:260
Path()
Constructor vacío.
Definition: tpl_graph_try.H:1350
Node * Set_Type
El tipo de conjunto sobre el cual se itera.
Definition: tpl_graph_try.H:582
Out_Iterator(typename GT::Node *p, Show_Arc &&sa=Show_Arc())
Definition: tpl_graph_try.H:982
Definition: tpl_graph.H:38
Definition: tpl_graph.H:21
bool is_cycle() const
Retorna true si el camino conforma un ciclo.
Definition: tpl_graph_try.H:1619
Definition: tpl_graph.H:217
Node * get_last_node()
Retorna el último nodo del camino.
Definition: tpl_graph_try.H:1601
bool is_empty() const
Retorna true si el camino está vacío.
Definition: tpl_graph_try.H:1395
size_type size()
Retorna la cantidad de elementos que tiene la lista.
Definition: List.H:340
Node * Item_Type
Tipo de elemento que retorna get_current()
Definition: tpl_graph_try.H:546
Arc * get_current()
Retorna un puntero al arco actual.
Definition: tpl_graph_try.H:637
Definition: tpl_graph.H:751
Definition: tpl_graph.H:2567
Definition: tpl_graph.H:1389
Iterador sobre enlaces.
Definition: dlink.H:437
Node * get_curr()
Definition: tpl_graph_try.H:562
Path(const Path &path)
Constructor copia de camino; todos los nodos y arcos se copian.
Definition: tpl_graph_try.H:1408
void insert(Arc *arc)
Definition: tpl_graph_try.H:1536
Arc * get_curr()
Definition: tpl_graph_try.H:640
#define IS_NODE_VISITED(p, bit)
Definition: aleph-graph.H:242
void swap(list &c)
Definition: List.H:486
void operate_on_nodes(Operation &&op=Operation())
Definition: tpl_graph_try.H:1701
Node * get_src_node()
Retorna el nodo origen del arco actual (sólo cuenta si es digrafo)
Definition: tpl_graph_try.H:643
Arc * get_current_arc() const
Retorna un puntero al arco actual.
In_Iterator(typename GT::Node *p, Show_Arc &&sa=Show_Arc())
Definition: tpl_graph_try.H:1029
Itor::Set_Type Set_Type
El tipo de conjunto sobre el cual se itera.
Definition: tpl_graph_try.H:861
List_Graph Set_Type
El tipo de conjunto sobre el cual se itera.
Definition: tpl_graph_try.H:549
Itor::Item_Type Item_Type
Tipo de elemento que retorna get_current()
Definition: tpl_graph_try.H:858
Node * get_current()
Definition: tpl_graph_try.H:1677
Copy_Graph(SA &__sa, SN &&__sn=SN())
Definition: tpl_graph_try.H:2449
#define ARC_COOKIE(p)
Definition: aleph-graph.H:281
Copy_Graph(SA &&__sa=SA(), SN &&__sn=SN())
Definition: tpl_graph_try.H:2442
Definition: tpl_graph.H:794
Node_Arc_Iterator()
Instancia un iterador vacío (inválido).
Definition: tpl_graph_try.H:585
Arc * get_current_arc()
Definition: tpl_graph_try.H:1668
bool inside_graph(GT &gr) const
retorna true si el camino this refiere al grafo gr
Definition: tpl_graph_try.H:1340
Arc_Iterator(GT &g, Show_Arc &sa)
Definition: tpl_graph_try.H:818
bool contains_arc(Arc *arc)
Retorna true si nodo pertenece al camino; false de lo contrario.
Definition: tpl_graph_try.H:1764
Itor::Item_Type Item_Type
Tipo de elemento que retorna get_current()
Definition: tpl_graph_try.H:744
void clear_graph(GT &g)
Definition: tpl_graph.H:2486
#define IS_ARC_VISITED(p, bit)
Definition: aleph-graph.H:275
It::Item_Type Item_Type
Tipo de elemento que retorna get_current()
Definition: filter_iterator.H:93
Itor::Set_Type Set_Type
El tipo de conjunto sobre el cual se itera.
Definition: tpl_graph_try.H:798
Definition: tpl_graph.H:1186
Out_Iterator(typename GT::Node *p, Show_Arc &sa)
Definition: tpl_graph_try.H:993
Definition: tpl_graph.H:26
Node_Arc_Iterator(typename GT::Node *p, Show_Arc &sa)
Definition: tpl_graph_try.H:767
bool find_path_depth_first(GT &g, typename GT::Node *start_node, typename GT::Node *end_node, Path< GT > &path)
Definition: tpl_graph.H:2082
Node_Arc_Iterator(typename GT::Node *p, Show_Arc &&sa=Show_Arc())
Definition: tpl_graph_try.H:756
Arc * get_last_arc()
Retorna el último arco del camino.
Definition: tpl_graph_try.H:1607
List_Graph & operator=(const List_Graph &g)
Definition: tpl_graph.H:2421
void remove_first_node()
Elimina el primer nodo del camino.
Definition: tpl_graph_try.H:1629
bool has_current() const
Retorna true si iterador aún tiene elemento actual.
Definition: dlink.H:554
void swap(Path &path)
Intercambias los contenidos del camino this con el de path.
Definition: tpl_graph_try.H:1635
GT::Arc_Type Arc_Type
El tipo de atributo que contienen los arcos del camino.
Definition: tpl_graph_try.H:1312
void remove_last_node()
Elimina el último nodo del camino.
Definition: tpl_graph_try.H:1622
Definition: tpl_graph.H:582
void operate_on_nodes(void *ptr)
Definition: tpl_graph_try.H:1731
Graph_Node()
Definition: tpl_graph_try.H:97
Definition: tpl_graph.H:634
void next()
Adelanta el iterador una posición.
Definition: filter_iterator.H:143
Graph_Node(const Node_Info &info)
Definition: tpl_graph_try.H:128
In_Iterator(typename GT::Node *p, Show_Arc &sa)
Definition: tpl_graph_try.H:1040
Arc * get_current_arc() const
Retorna el arco actual.
Definition: tpl_aleph_graph.H:373
Arc * Item_Type
Tipo de elemento que retorna get_current()
Definition: tpl_graph_try.H:624
Node * get_last_node() const
Retorna el último nodo del camino.
Definition: tpl_graph.H:1823
Node * get_first_node()
Retorna el primer nodo del camino.
Definition: tpl_graph_try.H:1598
Definition: tpl_graph.H:504
virtual Arc * insert_arc(Node *src_node, Node *tgt_node, const typename Arc::Arc_Type &arc_info)
Definition: tpl_graph.H:2302
Path(GT &_g, Node *start_node, void *__cookie=NULL)
Definition: tpl_graph_try.H:1368
bool has_current_arc() const
Definition: tpl_graph_try.H:1685
#define NODE_BITS(p)
Definition: aleph-graph.H:221
Definition: tpl_graph.H:1233
Node * get_curr()
Definition: tpl_graph_try.H:1680
Iterator(Path &path)
Instancia un iterador sobre el camino path.
Definition: tpl_graph_try.H:1651
Definition: tpl_graph.H:644
Arc * get_current()
Definition: tpl_graph_try.H:598
void init(Node *start_node)
Definition: tpl_graph_try.H:1358
void clear_path()
Limpia el camino (se eliminan todos sus nodos y arcos).
Definition: tpl_graph_try.H:1398
GT::Node_Type Node_Type
El tipo de atributo que contienen los nodos del camino.
Definition: tpl_graph_try.H:1310
virtual Arc * connect_arc(Arc *arc)
Definition: tpl_graph.H:2277
Definition: tpl_aleph_graph.H:244
Definition: tpl_graph.H:19
Definition: tpl_graph.H:814
GT & get_graph()
Obtiene una referencia al grafo sobre el cual se encuentra el camino.
Definition: tpl_graph_try.H:1335
Arc * get_first_arc() const
Definition: tpl_graph.H:2159
#define ARC_BITS(p)
Definition: aleph-graph.H:266
void operate_on_arcs(Operation &&op=Operation())
Definition: tpl_graph_try.H:1714
void copy_graph(GT >gt, GT &gsrc, const bool cookie_map=false)
Definition: tpl_graph.H:2505
Arc_Iterator(GT &g, Show_Arc &&sa=Show_Arc())
Definition: tpl_graph_try.H:807
Arc * Item_Type
El tipo de dato que retorna get_current().
Definition: tpl_graph_try.H:579
T & get_current() const
Retorna el elemento actual del iterador.
Definition: tpl_dynDlist.H:427
Node * get_current_node()
Definition: tpl_graph_try.H:1664
Graph_Node(Graph_Node *node)
Definition: tpl_graph_try.H:155
Arc * get_first_arc()
Retorna el primer arco del camino.
Definition: tpl_graph_try.H:1604
GT::Arc * search_arc(GT &g, typename GT::Node *src_node, typename GT::Node *tgt_node)
Definition: tpl_graph.H:2461
Definition: tpl_graph.H:32
Node_Iterator(GT &g, Show_Node &&sn=Show_Node())
Definition: tpl_graph_try.H:870
Definition: filter_iterator.H:42
void append(Dlink *node)
Definition: dlink.H:166
virtual void disconnect_arc(Arc *arc)
Definition: tpl_graph.H:2351
iterator insert(const iterator &pos, const T &value)
Definition: List.H:525
Dlink * get_current() const
Retorna dirección de nodo actual.
Definition: dlink.H:564
Path(GT &_g, void *__cookie=NULL)
Definition: tpl_graph_try.H:1347
bool contains_node(Node *node)
Retorna true si nodo pertenece al camino; false de lo contrario.
Definition: tpl_graph_try.H:1755
void append(Arc *arc)
Definition: tpl_graph_try.H:1449
Definition: tpl_graph.H:694
Itor::Item_Type Item_Type
Tipo de elemento que retorna get_current()
Definition: tpl_graph_try.H:795
List_Graph Set_Type
El tipo de conjunto sobre el cual se itera.
Definition: tpl_graph_try.H:627
Node * get_tgt_node() const
Retorna el nodo destino del arco actual.
Key * insert(const Key &key, const Type &data)
Definition: tpl_dynMapTree.H:74
Definition: tpl_graph.H:35
Definition: tpl_aleph_graph.H:187
Definition: tpl_graph.H:1868
Iterator()
Constructor por omisión.
Definition: dlink.H:492
void clear()
Definition: tpl_graph_try.H:1405
Node * get_current_node()
retorna el nodo actual.
Itor::Set_Type Set_Type
El tipo de conjunto sobre el cual se itera.
Definition: tpl_graph_try.H:747
void del()
Elimina this de su contexto en una lista.
Definition: dlink.H:278
void set_graph(GT &__g, Node *start_node=NULL)
Definition: tpl_graph_try.H:1382
void append(Node *node)
Definition: tpl_graph_try.H:1490
Definition: tpl_graph.H:2557
bool has_current_node() const
Retorna true si el iterador tiene nodo actual; false de lo contrario.
Definition: tpl_graph_try.H:1691
Definition: tpl_graph.H:1443
Arc * get_curr()
Definition: tpl_graph_try.H:601
virtual Node * insert_node(Node *node)
Definition: tpl_graph.H:2215
Node * get_tgt_node()
Retorna el nodo destino del arco actual (sólo cuenta si es digrafo)
Definition: tpl_graph_try.H:646