1 # ifndef TPL_TEST_ACYCLIQUE_H
2 # define TPL_TEST_ACYCLIQUE_H
27 template <
class GT,
class SA = Dft_Show_Arc<GT>>
32 bool is_acyclique(
typename GT::Node * curr)
37 NODE_BITS(curr).set_bit(Is_Acyclique,
true);
41 typename GT::Arc * arc = i.get_current_arc();
45 ARC_BITS(arc).set_bit(Is_Acyclique,
true);
47 if (not is_acyclique(i.get_tgt_node()))
56 bool is_acyclique(GT & g,
size_t num_arcs)
59 throw std::domain_error(
"is_graph_acyclique() does not work for digraps");
61 if (num_arcs >= g.get_num_nodes())
64 g.reset_bit_arcs(Is_Acyclique);
65 g.reset_bit_nodes(Is_Acyclique);
67 for (
typename GT::Node_Iterator it(g); it.has_current(); it.next())
69 typename GT::Node * curr = it.get_current_node();
73 if (not is_acyclique(curr))
107 return is_acyclique(g, num_arcs);
127 return is_acyclique(g, g.get_num_arcs());
150 template <
class GT,
class SA = Dft_Show_Arc<GT>>
157 Has_Cycle(SA && __sa = SA()) : sa(__sa) { }
207 # endif // TPL_TEST_ACYCLIQUE_H
bool operator()(GT &g) const
Definition: tpl_test_acyclique.H:176
Definition: tpl_test_acyclique.H:151
#define IS_NODE_VISITED(p, bit)
Definition: aleph-graph.H:242
#define IS_ARC_VISITED(p, bit)
Definition: aleph-graph.H:275
bool operator()(GT &g, size_t num_arcs)
Definition: tpl_test_acyclique.H:105
void next()
Adelanta el iterador una posición.
Definition: filter_iterator.H:143
#define NODE_BITS(p)
Definition: aleph-graph.H:221
Definition: tpl_test_acyclique.H:28
#define ARC_BITS(p)
Definition: aleph-graph.H:266
Definition: tpl_graph.H:694