1 #ifndef VCSN_ALGOS_LADYBIRD_HH
2 # define VCSN_ALGOS_LADYBIRD_HH
14 template <
class Context>
15 mutable_automaton<Context>
18 using context_t = Context;
19 const auto& gens = ctx.labelset()->genset();
20 std::vector<typename context_t::labelset_t::letter_t> letters
21 {std::begin(gens), std::end(gens)};
23 "ladybird: the alphabet needs at least 3 letters");
29 automaton_t res = make_shared_ptr<automaton_t>(ctx);
31 auto p = res->new_state();
35 for (
unsigned i = 1; i < n; ++i)
37 auto y = res->new_state();
38 res->new_transition(x, y, a);
39 res->new_transition(y, y,
b);
40 res->new_transition(y, y, c);
41 res->new_transition(y, p, c);
44 res->new_transition(x, p, a);
57 template <
typename Ctx,
typename Un
signed>
61 const auto& c = ctx->as<Ctx>();
71 #endif // !VCSN_ALGOS_LADYBIRD_HH
REGISTER_DECLARE(accessible,(const automaton &) -> automaton)
std::shared_ptr< detail::automaton_base > automaton
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
std::shared_ptr< detail::mutable_automaton_impl< Context >> mutable_automaton
automaton ladybird(const dyn::context &ctx, unsigned n)
Bridge.
Provide a variadic mul on top of a binary mul(), and one().
std::shared_ptr< const detail::context_base > context
mutable_automaton< Context > ladybird(const Context &ctx, unsigned n)
void require(bool b, Args &&...args)
If b is not verified, raise an error with args as message.