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:
Maximilien Colange 2018-02-23 11:39:17 +01:00
parent d08ca97624
commit d44cc82eb7
5 changed files with 35 additions and 4 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Laboratoire de Recherche et Développement de
# Copyright (C) 2014-2018 Laboratoire de Recherche et Développement de
# l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
@ -230,6 +230,9 @@ digraph G {
1 [label="s2"]
2 [label="s3", style="bold", color="#505050"]
}
0 -> deleted
1 -> deleted
2 -> 0
digraph G {
rankdir=LR
node [shape="circle"]

View file

@ -105,7 +105,19 @@ static void f2()
}
tg->set_init_state(s3);
spot::print_dot(std::cout, tg);
tg->purge_unreachable_states();
void (*action)(const std::vector<unsigned>&, void*) =
[](const std::vector<unsigned>& newst, void*)
{
for (unsigned i = 0; i != newst.size(); ++i)
{
std::cout << i << " -> ";
if (newst[i] == -1U)
std::cout << "deleted" << std::endl;
else
std::cout << newst[i] << std::endl;
}
};
tg->purge_unreachable_states(&action);
spot::print_dot(std::cout, tg);
}