decompose_scc: factor autfilt into decompose_acc_scc

Put what is done by `autfilt` in a new function, `decompose_acc_scc`.

* bin/autfilt.cc: Move code from here...
* spot/twaalgos/strength.cc, spot/twaalgos/strength.hh: To here.
* tests/python/decompose_scc.py: Test python binding.
This commit is contained in:
Clément Gillard 2017-02-16 15:35:01 +01:00
parent c0eeea2c5f
commit 5d143cc1f8
4 changed files with 79 additions and 14 deletions

View file

@ -391,4 +391,23 @@ namespace spot
return res;
}
twa_graph_ptr
decompose_acc_scc(const const_twa_graph_ptr& aut, int scc_index)
{
scc_info si(aut);
unsigned scc_num = 0;
for (; scc_num < si.scc_count(); ++scc_num)
{
if (si.is_accepting_scc(scc_num))
{
if (!scc_index)
break;
--scc_index;
}
}
return decompose_scc(si, scc_num);
}
}

View file

@ -181,4 +181,14 @@ namespace spot
/// \param scc_num the index in the map of the SCC to keep
SPOT_API twa_graph_ptr
decompose_scc(scc_info& sm, unsigned scc_num);
/// \brief Extract a sub-automaton of an accepting SCC
///
/// This algorithm returns a subautomaton that contains the `scc_index'th
/// accepting SCC, plus any upstream SCC (but adjusted not to be accepting).
///
/// \param aut the automaton to decompose
/// \param scc_index the ID of the accepting SCC to keep
SPOT_API twa_graph_ptr
decompose_acc_scc(const const_twa_graph_ptr& aut, int scc_index);
}