7 #include <vcsn/dyn/fwd.hh>
18 template <Automaton Aut>
19 using states_t = std::unordered_set<state_t_of<Aut>>;
25 template <Automaton Aut>
29 using automaton_t = Aut;
36 using worklist_t = std::queue<state_t>;
37 auto todo = worklist_t{};
38 todo.emplace(aut->pre());
42 const state_t src = todo.front();
45 if (strict || !aut->is_lazy(src))
46 for (
auto tr :
all_out(aut, src))
48 state_t dst = aut->dst_of(tr);
50 if (
res.emplace(dst).second)
62 template <Automaton Aut>
73 template <Automaton Aut>
88 template <Automaton Aut>
103 template <Automaton Aut>
111 template <Automaton Aut>
132 template <Automaton Aut>
133 filter_automaton<Aut>
140 template <Automaton Aut>
141 filter_automaton<Aut>
148 template <Automaton Aut>
149 filter_automaton<Aut>
160 template <Automaton Aut>
167 template <Automaton Aut>
174 template <Automaton Aut>
181 template <Automaton Aut>
187 template <Automaton Aut>
188 bool is_empty(
const Aut& a) ATTRIBUTE_PURE;
191 template <Automaton Aut>
196 return a->num_states() == 0;
204 template <Automaton Aut>
208 const auto& a = aut->
as<Aut>();
213 template <Automaton Aut>
217 const auto& a = aut->
as<Aut>();
222 template <Automaton Aut>
226 const auto& a = aut->
as<Aut>();
231 template <Automaton Aut>
235 const auto& a = aut->
as<Aut>();
240 template <Automaton Aut>
244 const auto& a = aut->
as<Aut>();
249 template <Automaton Aut>
253 const auto& a = aut->
as<Aut>();
258 template <Automaton Aut>
262 const auto& a = aut->
as<Aut>();
267 template <Automaton Aut>
271 const auto& a = aut->
as<Aut>();
filter_automaton< Aut > trim(const Aut &a)
Useful part of an automaton.
bool is_trim(const automaton &aut)
Bridge.
Aut transpose(const transpose_automaton< Aut > &aut)
std::unordered_set< state_t_of< Aut >> states_t
bool is_empty(const Aut &a) ATTRIBUTE_PURE
Whether has no states.
bool is_useless(const Aut &a)
Whether all no state is useful.
filter_automaton< Aut > accessible(const Aut &a)
Accessible part of an automaton.
Container set_intersection(const Container &s1, const Container &s2)
The intersection of two sets.
automaton trim(const automaton &aut)
Bridge.
automaton accessible(const automaton &aut)
Bridge.
bool is_accessible(const automaton &aut)
Bridge.
ATTRIBUTE_PURE bool has(const boost::container::flat_set< Key, Compare, Allocator > &s, const Key &e)
Whether e is member of s.
automaton coaccessible(const automaton &aut)
Bridge.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
states_t< Aut > coaccessible_states(const Aut &a, bool strict=true)
The set of coaccessible states, including post(), and possibly pre().
size_t num_accessible_states(const Aut &a)
Number of accessible states, not counting pre() and post().
bool is_useless(const automaton &aut)
Bridge.
filter_automaton< Aut, Trans > filter(const Aut &aut, boost::optional< dynamic_bitset > ss={}, boost::optional< dynamic_bitset > ts={})
Get an automaton who is a part state set ss of aut.
bool is_coaccessible(const automaton &aut)
Bridge.
bool is_accessible(const Aut &a)
Whether all its states are accessible.
states_t< Aut > useful_states(const Aut &a, bool strict=true)
The set of useful states, including possibly pre() and post().
bool is_coaccessible(const Aut &a)
Whether all its states are coaccessible.
Request the set implementation (bool weights).
size_t num_coaccessible_states(const Aut &a)
Number of accessible states, not counting pre() and post().
auto & as()
Extract wrapped typed automaton.
filter_automaton< Aut > coaccessible(const Aut &a)
Coaccessible part of an automaton.
auto all_out(const Aut &aut, state_t_of< Aut > s)
Indexes of transitions leaving state s.
states_t< Aut > accessible_states(const Aut &aut, bool strict=true)
The set of accessible states, including pre(), and possibly post().
bool is_empty(const automaton &aut)
Bridge.
bool is_trim(const Aut &a)
Whether all its states are useful.
size_t num_useful_states(const Aut &a)
Number of accessible states, not counting pre() and post().