5 #include <boost/range/algorithm/sort.hpp>
10 #include <vcsn/dyn/fwd.hh>
22 template <Automaton Aut>
36 const auto& llab =
aut_->label_of(l);
37 const auto& rlab =
aut_->label_of(r);
38 if (
aut_->labelset()->less(llab, rlab))
40 else if (
aut_->labelset()->less(rlab, llab))
43 return aut_->dst_of(l) <
aut_->dst_of(r);
57 template <Automaton Aut>
62 for (
auto s: a->states())
73 template <Automaton Aut>
77 const auto& a = aut->
as<Aut>();
90 template <Automaton Aut>
113 return std::move(
res_);
119 while (!
res_->todo_.empty())
121 auto p =
res_->todo_.front();
129 std::vector<input_transition_t> ts;
140 res_->new_transition_copy(res_s,
res_->state(
res_->input_->dst_of(t)),
148 for (
auto s:
res_->input_->all_states())
159 template <Automaton Aut>
174 template <Automaton Aut>
178 const auto& a = aut->
as<Aut>();
void visit_and_update_res_()
bool is_out_sorted(const Aut &a)
Whether for each state, the outgoing transitions are sorted by increasing label.
void visit_successors_of_(input_state_t s, state_t res_s)
SharedPtr make_shared_ptr(Args &&...args)
Same as std::make_shared, but parameterized by the shared_ptr type, not the (pointed to) element_type...
Functor to compare Values of ValueSets.
transition_t_of< automaton_t > transition_t
Provide a variadic mul on top of a binary mul(), and one().
permutation_automaton< input_automaton_t > automaton_t
Result automaton type.
state_t_of< input_automaton_t > input_state_t
transition_t_of< input_automaton_t > input_transition_t
Aut input_automaton_t
Input automaton type.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
const labelset_t_of< input_automaton_t > & ls_
state_t_of< automaton_t > state_t
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
auto all_out(const Aut &aut, state_t_of< Aut > s)
Indexes of transitions leaving state s.
automaton_t res_
Sorted automaton.
void push_inaccessible_states_()
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
automaton sort(const automaton &aut)
Bridge.
sorter(const input_automaton_t &a)
ATTRIBUTE_PURE bool operator()(const transition_t l, const transition_t r) const
const weightset_t_of< input_automaton_t > & ws_
bool is_sorted_forward(const Container &container, Compare comp)
Same as std::is_sorted, but works with an input iterator, not just a forward iterator.
transition_less(const automaton_t &a)
bool is_out_sorted(const automaton &aut)
Bridge.
typename detail::transition_t_of_impl< base_t< ValueSet >>::type transition_t_of
std::shared_ptr< detail::permutation_automaton_impl< Aut >> permutation_automaton
A permutation automaton as a shared pointer.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
A function to sort an automaton.
auto sort(const Aut &a) -> permutation_automaton< Aut >
auto & as()
Extract wrapped typed automaton.
Compare transitions of an automaton.