1 # ifndef TPL_INDEXARC_H
2 # define TPL_INDEXARC_H
4 # include <tpl_dynSetTree.H>
5 # include <tpl_graph.H>
38 template <
class ,
class >
class Tree =
Rand_Tree,
45 typedef typename GT::Arc GT_Arc;
46 typedef typename GT::Node GT_Node;
47 typedef typename GT::Arc_Type GT_Arc_Type;
48 typedef typename GT::Node_Type GT_Node_Type;
50 typedef std::pair<void*, void*> Node_Pair;
54 bool operator () (GT_Arc * a1, GT_Arc * a2)
const
56 if (a1->src_node < a2->src_node)
59 return not (a2->src_node < a1->src_node) and a1->tgt_node < a2->tgt_node;
81 GT_Arc *
search(
void * src,
void * tgt)
87 GT_Arc ** ret_val = index.
search(&arc);
95 std::swap(arc.src_node, arc.tgt_node);
96 ret_val = index.
search(&arc);
101 I(((src == (*ret_val)->src_node) and (tgt == (*ret_val)->tgt_node)) or
102 ((tgt == (*ret_val)->src_node) and (src == (*ret_val)->tgt_node)));
114 return search(a->src_node, a->tgt_node);
129 const GT_Arc_Type & info)
130 throw (std::exception, std::domain_error)
132 GT_Arc * a =
search(src, tgt);
135 throw std::domain_error(
"There is already in arc between these nodes");
137 a = g.insert_arc(src, tgt, info);
145 GT_Arc_Type && info = GT_Arc_Type())
146 throw (std::exception, std::domain_error)
148 GT_Arc * a =
search(src, tgt);
151 throw std::domain_error(
"There is already in arc between these nodes");
153 a = g.insert_arc(src, tgt, std::move(info));
160 void remove(GT_Arc * e)
183 GT_Arc * a = it.get_curr();
208 IndexArc(GT & __g,
bool with_init =
true, SA && __sa = SA())
223 IndexArc(GT & __g,
bool with_init, SA & __sa) : g(__g), sa(__sa)
IndexArc(GT &__g, bool with_init, SA &__sa)
Definition: tpl_indexArc.H:223
size_t remove(const Key &key)
Definition: tpl_dynSetTree.H:274
const size_t & size() const
Retorna la cardinalidad del conjunto.
Definition: tpl_dynSetTree.H:408
Definition: tpl_graph.H:751
GT_Arc * search(GT_Arc *a)
Definition: tpl_indexArc.H:112
void clear_index()
Elimina todos los arcos del índice.
Definition: tpl_indexArc.H:173
GT_Arc * insert(GT_Arc *e)
Inserta en el índice el arco a.
Definition: tpl_indexArc.H:70
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, const GT_Arc_Type &info)
Definition: tpl_indexArc.H:128
Key * search(const Key &key) const
Definition: tpl_dynSetTree.H:364
size_t size() const
Retorna la cantidad de arcos que contiene el índice.
Definition: tpl_indexArc.H:230
IndexArc(GT &__g, bool with_init=true, SA &&__sa=SA())
Definition: tpl_indexArc.H:208
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, GT_Arc_Type &&info=GT_Arc_Type())
Definition: tpl_indexArc.H:144
Definition: tpl_graph.H:634
void next()
Adelanta el iterador una posición.
Definition: filter_iterator.H:143
void remove_from_graph(GT_Arc *a)
Elimina del índice y del grafo el arco a.
Definition: tpl_indexArc.H:166
Definition: tpl_rand_tree.H:547
Definition: tpl_indexArc.H:41
GT_Arc * search(void *src, void *tgt)
Definition: tpl_indexArc.H:81
void empty()
Elimina todos los elementos del conjunto.
Definition: tpl_dynSetTree.H:112
Key * put(const Key &key)
Seudo sinonimo de insert; no retorna ningún valor.
Definition: tpl_dynSetTree.H:257
void build_index()
Inserta todos los arcos del grafo en el índice.
Definition: tpl_indexArc.H:179