spot/src/tgbaalgos/dotty.cc
Alexandre Duret-Lutz 1276abd290 * wrap/python/cgi/ltl2tgba.in: Convert GIFs to PNGs. Restrict
the size of dot's output to 1024x1024.
* src/tgbaalgos/dotty.cc (dotty_bfs::start): Do not preset
the size of the graph.  Set height=0 for the invisible state.
2003-08-07 12:14:01 +00:00

61 lines
1.2 KiB
C++

#include "tgba/tgba.hh"
#include "dotty.hh"
#include "tgba/bddprint.hh"
#include "reachiter.hh"
namespace spot
{
class dotty_bfs : public tgba_reachable_iterator_breadth_first
{
public:
dotty_bfs(const tgba* a, std::ostream& os)
: tgba_reachable_iterator_breadth_first(a), os_(os)
{
}
void
start()
{
os_ << "digraph G {" << std::endl;
os_ << " 0 [label=\"\", style=invis, height=0]" << std::endl;
os_ << " 0 -> 1" << std::endl;
}
void
end()
{
os_ << "}" << std::endl;
}
void
process_state(const state* s, int n, tgba_succ_iterator*)
{
os_ << " " << n << " [label=\""
<< automata_->format_state(s) << "\"]" << std::endl;
}
void
process_link(int in, int out, const tgba_succ_iterator* si)
{
os_ << " " << in << " -> " << out << " [label=\"";
bdd_print_set(os_, automata_->get_dict(),
si->current_condition()) << "\\n";
bdd_print_set(os_, automata_->get_dict(),
si->current_accepting_conditions()) << "\"]" << std::endl;
}
private:
std::ostream& os_;
};
std::ostream&
dotty_reachable(std::ostream& os, const tgba* g)
{
dotty_bfs d(g, os);
d.run();
return os;
}
}