graph: let transitions() iterate only on valid transitions

This fixes #6.

* src/graph/graph.hh: Rename the old transitions() as
transition_vector(), and implement a new transitions() that iterates
only on non-dead transitions.
* src/tgba/tgbagraph.hh, src/tgba/tgbagraph.cc, src/graph/ngraph.hh:
Adjust wrappers.
* src/hoaparse/hoaparse.yy, src/tgbaalgos/complete.cc,
src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc,
src/tgbaalgos/randomize.cc, src/tgbaalgos/safety.cc: Adjust calls.
This commit is contained in:
Alexandre Duret-Lutz 2014-12-08 12:04:09 +01:00
parent 8014833ae3
commit fbbf584bbb
10 changed files with 147 additions and 17 deletions

View file

@ -32,7 +32,7 @@ namespace spot
// acceptance set as the added sink would become accepting.
// In this case, add an acceptance set to all transitions.
allacc = aut->set_single_acceptance_set();
for (auto& t: aut->transitions())
for (auto& t: aut->transition_vector())
t.acc = allacc;
}
else

View file

@ -303,8 +303,7 @@ namespace spot
// Compute the AP used in the hard way.
bdd ap = bddtrue;
for (auto& t: ref->transitions())
if (!ref->is_dead_transition(t))
ap &= bdd_support(t.cond);
ap &= bdd_support(t.cond);
// Count the number of atomic propositions
int nap = 0;

View file

@ -432,8 +432,7 @@ namespace spot
// Compute the AP used in the hard way.
bdd ap = bddtrue;
for (auto& t: ref->transitions())
if (!ref->is_dead_transition(t))
ap &= bdd_support(t.cond);
ap &= bdd_support(t.cond);
// Count the number of atomic propositions
int nap = 0;

View file

@ -42,9 +42,9 @@ namespace spot
}
if (randomize_transitions)
{
auto begin = g.transitions().begin() + 1;
auto end = g.transitions().end();
std::random_shuffle(begin, end, spot::mrand);
g.remove_dead_transitions_();
auto& v = g.transition_vector();
std::random_shuffle(v.begin() + 1, v.end(), spot::mrand);
}
typedef tgba_digraph::graph_t::trans_storage_t tr_t;

View file

@ -66,9 +66,8 @@ namespace spot
bool is_safety_mwdba(const const_tgba_digraph_ptr& aut)
{
for (auto& t: aut->transitions())
if (!aut->is_dead_transition(t))
if (!aut->acc().accepting(t.acc))
return false;
if (!aut->acc().accepting(t.acc))
return false;
return true;
}