Fix a bug in scc_info, and clarify documentation

* spot/twaalgos/sccinfo.hh, spot/twaalgos/sccinfo.cc: Implement it
* tests/python/sccinfo.py: Test it
* NEWS: Document the fix
This commit is contained in:
Maximilien Colange 2017-09-25 14:12:12 +02:00
parent d6ae7af5f5
commit 2697fcddbf
4 changed files with 71 additions and 24 deletions

View file

@ -368,26 +368,32 @@ namespace spot
void scc_info::determine_unknown_acceptance()
{
std::vector<bool> k;
unsigned n = scc_count();
unsigned s = scc_count();
bool changed = false;
for (unsigned s = 0; s < n; ++s)
if (!is_rejecting_scc(s) && !is_accepting_scc(s))
{
if (!aut_->is_existential())
throw std::runtime_error("scc_info::determine_unknown_acceptance() "
"does not support alternating automata");
auto& node = node_[s];
if (k.empty())
k.resize(aut_->num_states());
for (auto i: node.states_)
k[i] = true;
if (mask_keep_accessible_states(aut_, k, node.states_.front())
->is_empty())
node.rejecting_ = true;
else
node.accepting_ = true;
changed = true;
}
// iterate over SCCs in topological order
do
{
--s;
if (!is_rejecting_scc(s) && !is_accepting_scc(s))
{
if (!aut_->is_existential())
throw std::runtime_error(
"scc_info::determine_unknown_acceptance() "
"does not support alternating automata");
auto& node = node_[s];
if (k.empty())
k.resize(aut_->num_states());
for (auto i: node.states_)
k[i] = true;
if (mask_keep_accessible_states(aut_, k, node.states_.front())
->is_empty())
node.rejecting_ = true;
else
node.accepting_ = true;
changed = true;
}
}
while (s);
if (changed)
determine_usefulness();
}