5 #include <unordered_map>
6 #include <unordered_set>
25 template <
typename 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, bend,"
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";
92 if (
aut_->state_has_name(s))
93 os_ <<
",rounded rectangle";
97 if (prev !=
aut_->null_state())
114 os_ <<
" \\path[->] (";
117 << (src == dst ?
"[loop above]" :
"")
130 std::map<state_t, polynomial_t> dsts;
131 for (
auto src :
aut_->states())
134 for (
auto t:
aut_->out(src))
137 ps_.new_weight(dsts[
aut_->dst_of(t)],
138 aut_->label_of(t),
aut_->weight_of(t));
139 for (
const auto& p: dsts)
149 template <
typename AutPtr>
151 tikz(
const AutPtr& aut, std::ostream& out)
automaton_t aut_
The automaton we have to output.
void print_finitial_(const std::string &kind, const weight_t &w) const
Format an initial/final weight.
std::ostream & tikz(const AutPtr &aut, std::ostream &out)
Print automaton to TikZ format.
void print_states_() const
Pretty-print states.
Format automaton to TikZ format.
state_t_of< automaton_t > state_t
void print_transitions_()
Print all the transitions, sorted by src state, then dst state.
const polynomialset_t ps_
Short-hand to the polynomialset used to print the entries.
const weightset_t & ws_
Short-hand to the weightset.
std::ostream & os_
Output stream.
transition_t_of< automaton_t > transition_t
typename polynomialset_t::value_t polynomial_t
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.
weight_t_of< automaton_t > weight_t
Factor common bits in automaton formatting.