1 # ifndef TPL_GRAPH_INDEXS_H
2 # define TPL_GRAPH_INDEXS_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 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;
89 : Tree_Type(cmp), g(_g), sn(_sn)
94 Nodes_Index(GT & _g, Compare && cmp = Compare(), SN && _sn = SN())
95 : Tree_Type(cmp), g(_g), sn(_sn)
127 GT_Node * p = g.insert_node(info);
163 GT_Node *
search(
const GT_Node_Info & info)
165 GT_Node dummy_node(info);
166 GT_Node * dummy_node_ptr = &dummy_node;
168 return search(dummy_node_ptr);
212 template <
typename ,
class >
class Tree =
Treap,
217 typedef typename GT::Node GT_Node;
218 typedef typename GT::Node_Type GT_Node_Info;
219 typedef typename GT::Arc GT_Arc;
220 typedef typename GT::Arc_Type GT_Arc_Info;
234 : Tree_Type(cmp), g(_g), sa(_sa)
239 Arcs_Index(GT & _g, Compare && cmp = Compare(), SA && _sa = SA())
240 : Tree_Type(cmp), g(_g), sa(_sa)
257 const GT_Arc_Info & info)
259 GT_Arc * a = g.insert_arc(src, tgt, info);
272 const GT_Arc_Info && info = GT_Arc_Info())
284 GT_Arc *
search(GT_Node * src, GT_Node * tgt,
const GT_Arc_Info & info)
287 arc.src_node = src; arc.tgt_node = tgt;
288 GT_Arc * ptr_arc = &arc;
298 std::swap(arc.src_node, arc.tgt_node);
303 I(((src == (*ret_val)->src_node) and (tgt == (*ret_val)->tgt_node)) or
304 ((tgt == (*ret_val)->src_node) and (src == (*ret_val)->tgt_node)));
310 GT_Arc *
search(GT_Node * src, GT_Node * tgt,
311 const GT_Arc_Info && info = GT_Arc_Info())
313 return search(src, tgt, info);
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, const GT_Arc_Info &info)
Definition: tpl_graph_indexs.H:256
Definition: tpl_graph_indexes.H:255
GT_Node * insert_in_graph(const GT_Node_Info &info)
Definition: tpl_graph_indexs.H:125
Definition: tpl_graph.H:751
Definition: tpl_treap.H:352
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_indexs.H:139
GT_Node * search(GT_Node *p)
Definition: tpl_graph_indexs.H:153
GT_Node * insert_in_graph(GT_Node *p)
Definition: tpl_graph_indexs.H:105
void remove_from_graph(GT_Node *p)
Definition: tpl_graph_indexs.H:177
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_indexs.H:310
GT_Arc * search(GT_Node *src, GT_Node *tgt, const GT_Arc_Info &info)
Definition: tpl_graph_indexs.H:284
void remove_from_graph(GT_Arc *a)
Definition: tpl_graph_indexs.H:322
Definition: tpl_graph.H:814
Definition: tpl_graph_indexes.H:22
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, const GT_Arc_Info &&info=GT_Arc_Info())
Definition: tpl_graph_indexs.H:271
GT::Node ** insert(const GT::Node *&key)
Definition: tpl_dynSetTree.H:177
Definition: tpl_graph_indexes.H:13