twa_graph: add a method to merge states with same outgoing edges

* spot/twa/twagraph.hh, spot/twa/twagraph.cc: here
* NEWS: document it
* tests/core/twagraph.cc, tests/core/tgbagraph.test: test it
This commit is contained in:
Maximilien Colange 2018-05-25 10:26:03 +02:00
parent 5b9088006c
commit 5a819e0c93
5 changed files with 89 additions and 1 deletions

View file

@ -30,7 +30,7 @@
set -e
run 0 ../tgbagraph | tee stdout
run 0 ../tgbagraph > stdout
cat >expected <<EOF
p1
@ -289,6 +289,18 @@ State: 1
State: 2
[t] 0&1
--END--
HOA: v1
States: 1
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0
[t] 0
--END--
EOF
diff stdout expected

View file

@ -158,10 +158,31 @@ static void f4()
spot::print_hoa(std::cout, tg, "1.1") << '\n';
}
// Test merge_states()
static void f5()
{
auto d = spot::make_bdd_dict();
auto tg = make_twa_graph(d);
auto s1 = tg->new_state();
auto s2 = tg->new_state();
auto s3 = tg->new_state();
tg->set_init_state(s3);
tg->new_edge(s1, s2, bddtrue);
tg->new_edge(s2, s2, bddtrue);
tg->new_edge(s3, s2, bddtrue);
tg->merge_states();
spot::print_hoa(std::cout, tg) << '\n';
}
int main()
{
f1();
f2();
f3();
f4();
f5();
}