twagraph: improve copy of kripke_graph
Fix #505, Reported by Edmond Irani Liu. * spot/twa/twagraph.cc (copy): Deal with kripke_graph in a better way. * spot/twaalgos/hoa.cc: Do not force the use of named-states since when the input is a kripke_graph. * tests/python/kripke.py: Adjust test cases. * NEWS: Mention the change. * THANKS: Add Edmund.
This commit is contained in:
parent
ef9267a58e
commit
013c879b41
5 changed files with 54 additions and 14 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#include <spot/misc/bddlt.hh>
|
||||
#include <spot/misc/timer.hh>
|
||||
#include <spot/twa/bddprint.hh>
|
||||
#include <spot/kripke/kripkegraph.hh>
|
||||
#include <spot/misc/escape.hh>
|
||||
#include <spot/priv/robin_hood.hh>
|
||||
#include <vector>
|
||||
|
|
@ -1600,6 +1601,17 @@ namespace spot
|
|||
return p.first->second;
|
||||
};
|
||||
|
||||
// If the input is a kripke_graph and the number of states is
|
||||
// not restricted, predeclare all states to keep their
|
||||
// numbering, and also copy unreachable states.
|
||||
if (max_states == -1U)
|
||||
if (auto kg = std::dynamic_pointer_cast<const kripke_graph>(aut))
|
||||
{
|
||||
unsigned ns = kg->num_states();
|
||||
for (unsigned s = 0; s < ns; ++s)
|
||||
new_state(kg->state_from_number(s));
|
||||
}
|
||||
|
||||
out->set_init_state(new_state(aut->get_init_state()));
|
||||
while (!todo.empty())
|
||||
{
|
||||
|
|
@ -1638,7 +1650,6 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
auto s = seen.begin();
|
||||
while (s != seen.end())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <spot/twa/formula2bdd.hh>
|
||||
#include <spot/tl/formula.hh>
|
||||
#include <spot/kripke/fairkripke.hh>
|
||||
#include <spot/kripke/kripkegraph.hh>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
|
@ -973,7 +974,11 @@ namespace spot
|
|||
strcpy(tmpopt, opt);
|
||||
tmpopt[n] = 'k';
|
||||
tmpopt[n + 1] = 0;
|
||||
preserve_names = true;
|
||||
// Preserve names if we have some state names, or if we are
|
||||
// not a kripke_graph.
|
||||
auto sn = aut->get_named_prop<std::vector<std::string>>("state-names");
|
||||
preserve_names =
|
||||
!!sn || !std::dynamic_pointer_cast<const kripke_graph>(aut);
|
||||
}
|
||||
|
||||
auto a = std::dynamic_pointer_cast<const twa_graph>(aut);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue