1 # ifndef TPL_GRAPH_INDEXES_H
2 # define TPL_GRAPH_INDEXES_H
4 # include <tpl_dynSetTree.H>
5 # include <tpl_graph.H>
15 bool operator () (
typename GT::Node * p1,
typename GT::Node * p2)
const
17 return p1->get_info() < p2->get_info();
24 bool operator () (
typename GT::Arc * a1,
typename GT::Arc * a2)
const
26 if (a1->src_node < a2->src_node)
29 return not (a2->src_node < a1->src_node) and a1->tgt_node < a2->tgt_node;
69 template <
typename ,
class >
class Tree =
Treap,
74 typedef typename GT::Node GT_Node;
75 typedef typename GT::Node_Type GT_Node_Info;
84 this->
insert(it.get_current());
95 Nodes_Index(GT & _g, Compare && cmp = Compare(), SN && _sn = SN())
130 GT_Node * q = *ptr_node;
147 GT_Node * p = g.insert_node(info);
149 if (this->
insert(p) == NULL)
168 GT_Node * p = g.insert_node(info);
170 GT_Node * q = *ptr_node;
203 GT_Node *
search(
const GT_Node_Info & info)
205 GT_Node dummy_node(info);
206 GT_Node * dummy_node_ptr = &dummy_node;
208 return search(dummy_node_ptr);
252 template <
typename ,
class >
class Tree =
Treap,
257 typedef typename GT::Node GT_Node;
258 typedef typename GT::Node_Type GT_Node_Info;
259 typedef typename GT::Arc GT_Arc;
260 typedef typename GT::Arc_Type GT_Arc_Info;
269 this->
insert(it.get_current());
279 Arcs_Index(GT & _g, Compare && cmp = Compare(), SA && _sa = SA())
297 const GT_Arc_Info & info)
299 GT_Arc * a = g.insert_arc(src, tgt, info);
301 if (this->
insert(a) == NULL)
312 const GT_Arc_Info && info = GT_Arc_Info())
324 GT_Arc *
search(GT_Node * src, GT_Node * tgt,
const GT_Arc_Info & info)
327 arc.src_node = src; arc.tgt_node = tgt;
328 GT_Arc * ptr_arc = &arc;
338 std::swap(arc.src_node, arc.tgt_node);
343 I(((src == (*ret_val)->src_node) and (tgt == (*ret_val)->tgt_node)) or
344 ((tgt == (*ret_val)->src_node) and (src == (*ret_val)->tgt_node)));
350 GT_Arc *
search(GT_Node * src, GT_Node * tgt,
351 const GT_Arc_Info && info = GT_Arc_Info())
353 return search(src, tgt, info);
373 # endif // GRAPH_INDEXES_H
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, const GT_Arc_Info &info)
Definition: tpl_graph_indexes.H:296
Definition: tpl_graph_indexes.H:255
size_t remove(const GT_Node *&key)
Definition: tpl_dynSetTree.H:274
GT_Node * insert_in_graph(const GT_Node_Info &info)
Definition: tpl_graph_indexes.H:145
Definition: tpl_graph.H:751
Definition: tpl_treap.H:352
GT_Node * search_or_insert_in_graph(const GT_Node_Info &info)
Definition: tpl_graph_indexes.H:166
Definition: tpl_graph_indexes.H:72
GT_Node ** search(const GT_Node *&key) const
Definition: tpl_dynSetTree.H:364
Definition: tpl_graph.H:794
GT_Node * insert_in_graph(const GT_Node_Info &&info=GT_Node_Info())
Definition: tpl_graph_indexes.H:179
GT_Node * search(GT_Node *p)
Definition: tpl_graph_indexes.H:193
GT_Node * insert_in_graph(GT_Node *p)
Definition: tpl_graph_indexes.H:107
void remove_from_graph(GT_Node *p)
Definition: tpl_graph_indexes.H:217
GT_Node *& find(const GT_Node *&key)
Definition: tpl_dynSetTree.H:316
Definition: tpl_graph.H:634
void next()
Adelanta el iterador una posición.
Definition: filter_iterator.H:143
Definition: tpl_dynSetTree.H:34
GT_Arc * search(GT_Node *src, GT_Node *tgt, const GT_Arc_Info &&info=GT_Arc_Info())
Definition: tpl_graph_indexes.H:350
GT_Arc * search(GT_Node *src, GT_Node *tgt, const GT_Arc_Info &info)
Definition: tpl_graph_indexes.H:324
void remove_from_graph(GT_Arc *a)
Definition: tpl_graph_indexes.H:362
Definition: tpl_graph.H:814
Definition: tpl_graph_indexes.H:22
GT_Node * search_or_insert_in_graph(GT_Node *p)
Definition: tpl_graph_indexes.H:126
GT::Node ** search_or_insert(const GT::Node *&key)
Definition: tpl_dynSetTree.H:225
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, const GT_Arc_Info &&info=GT_Arc_Info())
Definition: tpl_graph_indexes.H:311
GT::Node ** insert(const GT::Node *&key)
Definition: tpl_dynSetTree.H:177
Definition: tpl_graph_indexes.H:13