Adding function to canonicalize an automaton.

* src/tgbaalgos/are_isomorphic.cc, src/tgbaalgos/are_isomorphic.hh,
src/bin/autfilt.cc: are_isomorphic now uses canonicalize. It returns a
bool, because the mapping cannot be deduced easily from the
canonicalized automaton.
* src/graph/graph.hh: Add equality operator to trans_storage_t
for easy comparison of transition vectors.
* src/tgba/tgbagraph.hh: Add equality operator to tgba_graph_trans_data
and to tgba_digraph.
* src/tgbaalgos/canonicalize.cc, src/tgbaalgos/canonicalize.hh:
New files.
* src/tgbaalgos/Makefile.am: Add them.
* src/tgbatest/isomorph.test: Test them.
This commit is contained in:
Thibaud Michaud 2014-12-11 16:12:27 +01:00
parent b83d6d7f29
commit 1995602df5
9 changed files with 271 additions and 187 deletions

View file

@ -26,16 +26,18 @@
namespace spot
{
/// \ingroup tgba_misc
/// \brief Check whether two automate are isormorphic.
/// \brief Check whether two automata are isomorphic.
///
/// Return an isomorphism between a1 and a2 if such an isomorphism
/// exists. Otherwise, return an empty vector.
///
/// \return a vector indexed by states of \a a1, and containing
/// states of \a a2.
SPOT_API std::vector<unsigned>
are_isomorphic(const const_tgba_digraph_ptr a1,
const const_tgba_digraph_ptr a2);
/// Two automata are considered isomorphic if there exists a bijection f
/// between the states of a1 and the states of a2 such that for any pair of
/// states (s1, s2) of a1, there is a transition from s1 to s2 with
/// condition c and acceptance set A iff there is a transition with
/// condition c and acceptance set A between f(s1) and f(s2) in a2.
/// This can be done simply by checking if
/// canonicalize(aut1) == canonicalize(aut2).
SPOT_API bool
are_isomorphic(const const_tgba_digraph_ptr aut1,
const const_tgba_digraph_ptr aut2);
}
#endif