Add a is_weak_scc() function based on cycle enumeration.

* src/tgbaalgos/isweakscc.cc, src/tgbaalgos/isweakscc.hh: New files.
* src/tgbaalgos/Makefile.am: Add them.
* src/tgbatest/ltl2tgba.cc: Add a -KW option.
* src/tgbatest/cycles.test: Test it on a small example.
This commit is contained in:
Alexandre Duret-Lutz 2012-09-20 18:05:34 +02:00
parent 374a489e3f
commit 420fcd62e4
5 changed files with 158 additions and 0 deletions

View file

@ -65,6 +65,7 @@
#include "tgbaalgos/scc.hh"
#include "tgbaalgos/isdet.hh"
#include "tgbaalgos/cycles.hh"
#include "tgbaalgos/isweakscc.hh"
#include "kripkeparse/public.hh"
#include "tgbaalgos/simulation.hh"
@ -283,6 +284,7 @@ syntax(char* prog)
<< " -KV verbosely dump the graph of SCCs in dot format"
<< std::endl
<< " -KC list cycles in automaton" << std::endl
<< " -KW list weak SCCs" << std::endl
<< " -N output the never clain for Spin (implies -DS)"
<< std::endl
<< " -NN output the never clain for Spin, with commented states"
@ -528,6 +530,10 @@ main(int argc, char** argv)
{
output = 15;
}
else if (!strcmp(argv[formula_index], "-KW"))
{
output = 16;
}
else if (!strcmp(argv[formula_index], "-l"))
{
translation = TransLaCIM;
@ -1428,6 +1434,20 @@ main(int argc, char** argv)
}
break;
}
case 16:
{
spot::scc_map m(a);
m.build_map();
unsigned max = m.scc_count();
for (unsigned n = 0; n < max; ++n)
{
bool w = spot::is_weak_scc(a, m, n);
std::cout << "SCC #" << n
<< (w ? " is weak" : " is not weak")
<< std::endl;
}
break;
}
default:
assert(!"unknown output option");