Improve purge_unreachable_states()
* NEWS: document it * spot/twa/twagraph.hh, spot/twa/twagraph.cc: implement it * tests/core/tgbagraph.test, tests/core/twagraph.cc: test it
This commit is contained in:
parent
d08ca97624
commit
d44cc82eb7
5 changed files with 35 additions and 4 deletions
|
|
@ -231,7 +231,7 @@ namespace spot
|
|||
g_.chain_edges_();
|
||||
}
|
||||
|
||||
void twa_graph::purge_unreachable_states()
|
||||
void twa_graph::purge_unreachable_states(shift_action* f, void* action_data)
|
||||
{
|
||||
unsigned num_states = g_.num_states();
|
||||
// The TODO vector serves two purposes:
|
||||
|
|
@ -280,6 +280,9 @@ namespace spot
|
|||
if (prop_complete().is_false())
|
||||
prop_complete(trival::maybe());
|
||||
|
||||
if (f)
|
||||
(*f)(todo, action_data);
|
||||
|
||||
defrag_states(std::move(todo), current);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -576,8 +576,16 @@ namespace spot
|
|||
/// purge_dead_states() will remove more states than
|
||||
/// purge_unreachable_states(), but it is more costly.
|
||||
///
|
||||
/// You can pass a function to this method, which will be invoked
|
||||
/// with a vector indicating the renumbering of states.
|
||||
/// newst[i] == -1U means that state i is unreachable and thus deleted.
|
||||
/// Otherwise, state i is renumbered newst[i].
|
||||
///
|
||||
/// \see purge_dead_states
|
||||
void purge_unreachable_states();
|
||||
typedef void (*shift_action)(const std::vector<unsigned>& newst,
|
||||
void* action_data);
|
||||
void purge_unreachable_states(shift_action* f = nullptr,
|
||||
void* action_data = nullptr);
|
||||
|
||||
/// \brief Remove unused atomic propositions
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue