scc_info: improve split_on_sets

* spot/twaalgos/sccinfo.cc, spot/twaalgos/sccinfo.hh (split_on_set):
Allow names to be preserved
* python/spot/impl.i: Instantiate std::vector<spot::twa_graph_ptr>.
This commit is contained in:
Alexandre Duret-Lutz 2017-05-10 16:53:22 +02:00
parent 33af116fb8
commit 11704d31eb
3 changed files with 20 additions and 11 deletions

View file

@ -577,6 +577,7 @@ def state_is_accepting(self, src) -> "bool":
%include <spot/twaalgos/sccinfo.hh>
%template(scc_info_scc_edges) spot::internal::scc_edges<spot::digraph<spot::twa_graph_state, spot::twa_graph_edge_data> const, spot::internal::keep_all>;
%template(scc_info_inner_scc_edges) spot::internal::scc_edges<spot::digraph<spot::twa_graph_state, spot::twa_graph_edge_data> const, spot::internal::keep_inner_scc>;
%template(vector_twa_graph) std::vector<spot::twa_graph_ptr>;
%include <spot/twaalgos/strength.hh>
%include <spot/twaalgos/sccfilter.hh>
%include <spot/twaalgos/stats.hh>

View file

@ -448,7 +448,8 @@ namespace spot
}
std::vector<twa_graph_ptr>
scc_info::split_on_sets(unsigned scc, acc_cond::mark_t sets) const
scc_info::split_on_sets(unsigned scc, acc_cond::mark_t sets,
bool preserve_names) const
{
std::vector<twa_graph_ptr> res;
@ -480,8 +481,12 @@ namespace spot
},
init);
if (copy->num_edges())
{
if (preserve_names)
copy->copy_state_names_from(aut_);
res.push_back(copy);
}
}
return res;
}
@ -564,5 +569,4 @@ namespace spot
return res;
}
}

View file

@ -549,14 +549,19 @@ namespace spot
bdd scc_ap_support(unsigned scc) const;
protected:
/// \brief: Remove in 'scc', edges containing any mark in 'sets'.
/// \brief Split an SCC into multiple automata separated by some
/// acceptance sets.
///
/// Such a deletion may split the SCC, in which case, the function builds
/// and returns more than one automaton representing the specified SCC.
std::vector<twa_graph_ptr>
split_on_sets(unsigned scc, acc_cond::mark_t sets) const;
/// Pretend that the transitions of SCC \a scc that belong to any
/// of the sets given in \a sets have been removed, and return a
/// set of automata necessary to cover all remaining states.
///
/// Set \a preserve_names to True if you want to keep the original
/// name of each states for display. (This is a bit slower.)
std::vector<twa_graph_ptr> split_on_sets(unsigned scc,
acc_cond::mark_t sets,
bool preserve_names = false) const;
protected:
/// \brief: Recursive function used by states_on_acc_cycle_of().
void
states_on_acc_cycle_of_rec(unsigned scc,
@ -573,7 +578,6 @@ namespace spot
/// acceptance condition.
std::vector<unsigned>
states_on_acc_cycle_of(unsigned scc) const;
};