27 # ifndef TPL_INDEXGRAPH 28 # define TPL_INDEXGRAPH 30 # include <tpl_indexNode.H> 31 # include <tpl_indexArc.H> 74 template <
class GT,
class Compare = Dft_Node_Cmp<GT>,
75 template <
class ,
class >
class Tree =
Treap>
80 typedef typename GT::Arc GT_Arc;
81 typedef typename GT::Node GT_Node;
82 typedef typename GT::Arc_Type GT_Arc_Type;
83 typedef typename GT::Node_Type GT_Node_Type;
118 const GT_Arc_Type & info = GT_Arc_Type())
120 if (idx_node.
search(src) ==
nullptr)
121 throw std::domain_error(
"src node not in index");
123 if (idx_node.
search(tgt) ==
nullptr)
124 throw std::domain_error(
"tgt node not in index");
137 return idx_node.
search(p);
151 return idx_node.
search(info);
163 return idx_arc.
search(src, tgt);
174 for (
typename GT::Node_Arc_Iterator it(p); it.has_curr(); it.next_ne())
175 idx_arc.
remove(it.get_curr_ne());
193 template <
class GT>
inline 194 bool are_equal(
const GT & g1,
const GT & g2)
196 if (g1.vsize() != g2.vsize() or g1.esize() != g2.esize())
201 if (not g1.all_nodes([&t2] (
auto p)
203 auto q = t2.search(p);
213 return g1.all_arcs([idx = &t2, &g1] (
auto a)
215 auto s1 = g1.get_src_node(a);
216 auto t1 = g1.get_tgt_node(a);
217 auto s2 = mapped_node<GT>(s1);
218 auto t2 = mapped_node<GT>(t1);
219 auto a2 = idx->
search(s2, t2);
222 return a2->get_info() == a->get_info();
228 # endif // TPL_INDEXGRAPH void remove(GT_Arc *e)
Elimina del Ãndice el arco e.
Definition: tpl_indexArc.H:201
size_t get_num_arcs() const
Retorna el número de arcos que contiene el Ãndice.
Definition: tpl_indexGraph.H:187
void remove_from_graph(GT_Node *p)
Definition: tpl_indexNode.H:202
size_t get_num_nodes() const
Retorna el número de nodos que contiene el Ãndice.
Definition: tpl_indexGraph.H:190
Definition: tpl_indexGraph.H:76
GT_Node * search_node(GT_Node *p)
Definition: tpl_indexGraph.H:135
GT_Node * search_node(const GT_Node_Type &info)
Definition: tpl_indexGraph.H:149
GT_Arc * insert_in_graph(GT_Node *src, GT_Node *tgt, const GT_Arc_Type &info)
Definition: tpl_indexArc.H:171
void remove_arc(GT_Arc *a)
Elimina del grafo y del Ãndice el arco a.
Definition: tpl_indexGraph.H:181
GT_Arc * search_arc(GT_Node *src, GT_Node *tgt)
Definition: tpl_indexGraph.H:161
Definition: tpl_treap.H:535
GT_Node * insert_node(const GT_Node_Type &info)
Definition: tpl_indexGraph.H:102
void remove_from_graph(GT_Arc *a)
Elimina del Ãndice y del grafo el arco a.
Definition: tpl_indexArc.H:207
void remove_node(GT_Node *p)
Definition: tpl_indexGraph.H:170
GT_Node * search(GT_Node *p)
Definition: tpl_indexNode.H:161
Index_Graph(GT &g)
Crea un Ãndice del grafo: los nodos y arcos son indizados.
Definition: tpl_indexGraph.H:91
size_t size() const
Retorna la cantidad de arcos que contiene el Ãndice.
Definition: tpl_indexArc.H:270
GT_Arc * search(void *src, void *tgt)
Definition: tpl_indexArc.H:107
size_t size() const
Retorna la cantidad de arcos que contiene el Ãndice.
Definition: tpl_indexNode.H:261
GT_Node * insert_in_graph(const GT_Node_Type &info)
Definition: tpl_indexNode.H:117
GT_Arc * insert_arc(GT_Node *src, GT_Node *tgt, const GT_Arc_Type &info=GT_Arc_Type())
Definition: tpl_indexGraph.H:117