twagraph: merge_edges supports finite automata

* spot/twa/twagraph.cc: don't remove false-labeled edges if the
  automaton uses state-based acceptance and the edge is a self loop
This commit is contained in:
Antoine Martin 2022-03-10 12:16:18 +01:00
parent c4e3509d18
commit 28416cf82c

View file

@ -230,11 +230,15 @@ namespace spot
// them. // them.
}); });
bool is_state_acc = this->prop_state_acc().is_true();
unsigned out = 0; unsigned out = 0;
unsigned in = 1; unsigned in = 1;
// Skip any leading false edge. // Skip any leading false edge.
while (in < tend && trans[in].cond == bddfalse) while (in < tend
&& trans[in].cond == bddfalse
&& (!is_state_acc || trans[in].src != trans[in].dst))
++in; ++in;
if (in < tend) if (in < tend)
{ {
@ -243,7 +247,9 @@ namespace spot
trans[out] = trans[in]; trans[out] = trans[in];
for (++in; in < tend; ++in) for (++in; in < tend; ++in)
{ {
if (trans[in].cond == bddfalse) // Unusable edge if (trans[in].cond == bddfalse
&& (!is_state_acc
|| trans[in].src != trans[in].dst)) // Unusable edge
continue; continue;
// Merge edges with the same source, destination, and // Merge edges with the same source, destination, and
// colors. (We test the source last, because this is the // colors. (We test the source last, because this is the