17 #ifndef AWALI_ALGOS_IS_EPS_ACYCLIC_HH
18 # define AWALI_ALGOS_IS_EPS_ACYCLIC_HH
20 # include <unordered_map>
25 namespace awali {
namespace sttc {
30 template <
typename Aut,
31 bool has_one = context_t_of<Aut>::has_one()>
32 struct epsilon_acyclic;
38 template <
typename Aut>
39 struct epsilon_acyclic<Aut, true>
41 using automaton_t =
typename std::remove_cv<Aut>::type;
42 using label_t = label_t_of<automaton_t>;
43 std::unordered_map<state_t, char> tag;
54 const automaton_t& aut_;
59 bool has_epsilon_circuit(
state_t s)
61 auto it = tag.find(s);
65 for (
auto t : aut_->out(s, empty_word))
66 if (has_epsilon_circuit(aut_->dst_of(t)))
91 epsilon_acyclic(
const automaton_t& aut)
93 , empty_word(aut->labelset()->
one())
99 for (
auto s : aut_->states())
100 if (has_epsilon_circuit(s))
106 template <
typename Aut>
107 struct epsilon_acyclic<Aut, false>
109 using automaton_t =
typename std::remove_cv<Aut>::type;
111 constexpr epsilon_acyclic(
const automaton_t&)
121 template <
typename Aut>
125 epsilon_acyclic<Aut> t{aut};
126 return t.is_eps_acyclic();
any_t label_t
Type for (transition) labels; it is an alias to any_t since its precise type depends on the weightset...
Definition: typedefs.hh:48
constant< type_t::one, Label, Weight > one
Definition: fwd.hh:116
ATTRIBUTE_CONST bool is_eps_acyclic(const Aut &aut)
Definition: is_eps_acyclic.hh:123
Main namespace of Awali.
Definition: ato.hh:22
unsigned state_t
Definition: types.hh:21