5 #include <unordered_map>
6 #include <unordered_set>
11 #include <vcsn/dyn/fwd.hh>
25 template <Automaton Aut>
41 using super_t::super_t;
51 if (
ws_.show_one() || !
ws_.is_one(w))
53 os_ <<
',' << kind <<
" text=$\\left\\langle ";
62 "\\documentclass{standalone}\n"
63 " \\usepackage{tikz}\n"
64 " \\usetikzlibrary{arrows.meta, automata, bending,"
65 " positioning, shapes.misc}\n"
66 " \\tikzstyle{automaton}=[shorten >=1pt,"
67 " >={Stealth[bend,round]}, initial text=]\n"
68 " \\tikzstyle{accepting}=[accepting by arrow]\n"
71 "\\begin{tikzpicture}[automaton, auto]\n"
78 "\\end{tikzpicture}\n"
87 for (
auto s :
aut_->states())
89 os_ <<
" \\node[state";
97 if (
aut_->state_has_name(s))
98 os_ <<
",rounded rectangle";
102 if (prev !=
aut_->null_state())
104 os_ <<
" [right=of ";
119 os_ <<
" \\path[->] (";
122 << (src == dst ?
"[loop above]" :
"")
135 std::map<state_t, polynomial_t> dsts;
136 for (
auto src :
aut_->states())
137 if (!
aut_->is_lazy(src))
143 ps_.new_weight(dsts[
aut_->dst_of(t)],
144 aut_->label_of(t),
aut_->weight_of(t));
145 for (
const auto& p: dsts)
155 template <Automaton AutPtr>
state_t_of< automaton_t > state_t
transition_t_of< automaton_t > transition_t
std::ostream & os_
Output stream.
void print_states_() const
Pretty-print states.
void print_finitial_(const std::string &kind, const weight_t &w) const
Format an initial/final weight.
typename polynomialset_t::value_t polynomial_t
weight_t_of< automaton_t > weight_t
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
Factor common bits in automaton formatting.
const polynomialset_t ps_
Short-hand to the polynomialset used to print the entries.
void print_transitions_()
Print all the transitions, sorted by src state, then dst state.
automaton_t aut_
The automaton we have to output.
std::ostream & tikz(const AutPtr &aut, std::ostream &out)
Print automaton to TikZ format.
void print_transitions_(const state_t src, const state_t dst, const polynomial_t &entry) const
Print the transitions between state src and state dst.
const weightset_t & ws_
Short-hand to the weightset.
Format automaton to TikZ format.