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

@ -53,6 +53,7 @@
#include "tgbaalgos/reducerun.hh"
#include "tgbaalgos/word.hh"
#include "tgbaalgos/are_isomorphic.hh"
#include "tgbaalgos/canonicalize.hh"
static const char argp_program_doc[] ="\
@ -573,7 +574,10 @@ namespace
if (opt_is_deterministic)
matched &= is_deterministic(aut);
if (opt_are_isomorphic)
matched &= !are_isomorphic(aut, opt_are_isomorphic).empty();
{
spot::tgba_digraph_ptr tmp = make_tgba_digraph(aut);
matched &= (*spot::canonicalize(tmp) == *opt_are_isomorphic);
}
if (opt_is_empty)
matched &= aut->is_empty();
@ -700,8 +704,13 @@ main(int argc, char** argv)
if (jobs.empty())
jobs.emplace_back("-", true);
if (opt_are_isomorphic && opt_merge)
opt_are_isomorphic->merge_transitions();
if (opt_are_isomorphic)
{
if (opt_merge)
opt_are_isomorphic->merge_transitions();
spot::canonicalize(opt_are_isomorphic);
}
spot::srand(opt_seed);