graph: rename num_transitions() as num_edges()

And in fact, rename most "trans*" as "edges*", because that what they
really are.

* src/bin/autfilt.cc, src/bin/ltlcross.cc, src/bin/randaut.cc,
src/dstarparse/dra2ba.cc, src/dstarparse/dstarparse.yy,
src/dstarparse/nra2nba.cc, src/dstarparse/nsa2tgba.cc,
src/graph/graph.hh, src/graph/ngraph.hh, src/ltlvisit/exclusive.cc,
src/parseaut/parseaut.yy, src/tests/complementation.cc,
src/tests/graph.cc, src/tests/ltl2tgba.cc, src/tests/ngraph.cc,
src/tests/twagraph.cc, src/twa/twagraph.cc, src/twa/twagraph.hh,
src/twa/twamask.hh, src/twaalgos/are_isomorphic.cc,
src/twaalgos/are_isomorphic.hh, src/twaalgos/canonicalize.cc,
src/twaalgos/cleanacc.cc, src/twaalgos/complete.cc,
src/twaalgos/compsusp.cc, src/twaalgos/cycles.cc,
src/twaalgos/degen.cc, src/twaalgos/dot.cc, src/twaalgos/dtbasat.cc,
src/twaalgos/dtgbacomp.cc, src/twaalgos/dtgbasat.cc,
src/twaalgos/dupexp.cc, src/twaalgos/emptiness.cc,
src/twaalgos/isunamb.cc, src/twaalgos/isweakscc.cc,
src/twaalgos/ltl2tgba_fm.cc, src/twaalgos/mask.hh,
src/twaalgos/minimize.cc, src/twaalgos/postproc.cc,
src/twaalgos/powerset.cc, src/twaalgos/product.cc,
src/twaalgos/randomgraph.cc, src/twaalgos/randomize.cc,
src/twaalgos/randomize.hh, src/twaalgos/relabel.cc,
src/twaalgos/remfin.cc, src/twaalgos/safety.cc, src/twaalgos/sbacc.cc,
src/twaalgos/sccfilter.cc, src/twaalgos/sepsets.cc,
src/twaalgos/simulation.cc, src/twaalgos/stutter.cc,
src/twaalgos/totgba.cc: Rename these.
This commit is contained in:
Alexandre Duret-Lutz 2015-06-11 23:52:02 +02:00
parent a1ba0a89c5
commit af8634d8c4
53 changed files with 685 additions and 693 deletions

View file

@ -29,7 +29,7 @@
namespace
{
typedef spot::twa_graph::graph_t::trans_storage_t tr_t;
typedef spot::twa_graph::graph_t::edge_storage_t tr_t;
bool
tr_t_less_than(const tr_t& t1, const tr_t& t2)
{
@ -101,7 +101,7 @@ namespace
const spot::const_twa_graph_ptr aut2)
{
return aut1->num_states() != aut2->num_states() ||
aut1->num_transitions() != aut2->num_transitions() ||
aut1->num_edges() != aut2->num_edges() ||
// FIXME: At some point, it would be nice to support reordering
// of acceptance sets (issue #58).
aut1->acc().get_acceptance() != aut2->acc().get_acceptance();

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014 Laboratoire de Recherche et
// Copyright (C) 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -49,6 +49,5 @@ namespace spot
twa_graph_ptr ref_;
bool ref_deterministic_ = false;
unsigned nondet_states_ = 0;
std::vector<twa_graph::graph_t::trans_storage_t> reftrans_;
};
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014 Laboratoire de Recherche et
// Copyright (C) 2014, 2015 Laboratoire de Recherche et
// Developpement de l Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -24,13 +24,13 @@
namespace
{
typedef std::pair<spot::twa_graph::graph_t::trans_data_t, unsigned>
trans_sig_t;
typedef std::pair<spot::twa_graph::graph_t::edge_data_t, unsigned>
edge_sig_t;
struct signature_t
{
std::vector<trans_sig_t> ingoing;
std::vector<trans_sig_t> outgoing;
std::vector<edge_sig_t> ingoing;
std::vector<edge_sig_t> outgoing;
unsigned classnum;
bool
@ -49,7 +49,7 @@ namespace
{
std::vector<signature_t> signature(aut->num_states(), signature_t());
for (auto& t : aut->transitions())
for (auto& t : aut->edges())
{
signature[t.dst].ingoing.emplace_back(t.data(), state2class[t.src]);
signature[t.src].outgoing.emplace_back(t.data(), state2class[t.dst]);
@ -102,8 +102,8 @@ namespace spot
auto& g = aut->get_graph();
g.rename_states_(state2class);
aut->set_init_state(state2class[aut->get_init_state_number()]);
g.sort_transitions_();
g.chain_transitions_();
g.sort_edges_();
g.chain_edges_();
return aut;
}
}

View file

@ -31,7 +31,7 @@ namespace spot
acc_cond::mark_t used_in_cond = c.used_sets();
acc_cond::mark_t used_in_aut = 0U;
for (auto& t: aut->transitions())
for (auto& t: aut->edges())
used_in_aut |= t.acc;
auto useful = used_in_aut & used_in_cond;
@ -42,7 +42,7 @@ namespace spot
return aut;
// Remove useless marks from the automaton
for (auto& t: aut->transitions())
for (auto& t: aut->edges())
t.acc = t.acc.strip(useless);
// Remove useless marks from the acceptance condition

View file

@ -35,7 +35,7 @@ namespace spot
// We cannot safely complete an automaton if its
// acceptance is always satisfiable.
auto acc = aut->set_buchi();
for (auto& t: aut->transition_vector())
for (auto& t: aut->edge_vector())
t.acc = acc;
}
else
@ -67,7 +67,7 @@ namespace spot
}
}
unsigned t = aut->num_transitions();
unsigned t = aut->num_edges();
// Now complete all states (excluding any newly added the sink).
for (unsigned i = 0; i < n; ++i)
@ -80,39 +80,39 @@ namespace spot
// FIXME: This is ugly.
//
// In case the automaton uses state-based acceptance, we
// need to put the new transition in the same set as all
// need to put the new edge in the same set as all
// the other.
//
// In case the automaton uses transition-based acceptance,
// In case the automaton uses edge-based acceptance,
// it does not matter what acceptance set we put the new
// transition into.
// edge into.
//
// So in both cases, we put the transition in the same
// acceptance sets as the last outgoing transition of the
// So in both cases, we put the edge in the same
// acceptance sets as the last outgoing edge of the
// state.
acc = t.acc;
}
// If the state has incomplete successors, we need to add a
// transition to some sink state.
// edge to some sink state.
if (missingcond != bddfalse)
{
// If we haven't found any sink, simply add one.
if (sink == -1U)
{
sink = aut->new_state();
aut->new_transition(sink, sink, bddtrue, um.second);
aut->new_edge(sink, sink, bddtrue, um.second);
}
// In case the automaton use state-based acceptance, propagate
// the acceptance of the first transition to the one we add.
aut->new_transition(i, sink, missingcond, acc);
// the acceptance of the first edge to the one we add.
aut->new_edge(i, sink, missingcond, acc);
}
}
// Get rid of any named property if the automaton changed.
if (t < aut->num_transitions())
if (t < aut->num_edges())
aut->release_named_properties();
else
assert(t == aut->num_transitions());
assert(t == aut->num_edges());
return sink;
}

View file

@ -266,7 +266,7 @@ namespace spot
p.second = ris;
}
// This loops over all the right transitions
// This loops over all the right edges
// if RI is defined. Otherwise this just makes
// one iteration as if the right automaton was
// looping in state 0 with "true".
@ -277,7 +277,7 @@ namespace spot
if (ri)
{
cond = lc & ri->current_condition();
// Skip incompatible transitions.
// Skip incompatible edges.
if (cond == bddfalse)
{
ri->next();
@ -303,7 +303,7 @@ namespace spot
acc_cond::mark_t a =
res->acc().join(la, li->current_acceptance_conditions(),
ra, racc);
res->new_transition(src, dest, bdd_exist(cond, v), a);
res->new_edge(src, dest, bdd_exist(cond, v), a);
if (ri)
ri->next();

View file

@ -88,14 +88,14 @@ namespace spot
if (cur.succ == 0)
cur.succ = aut_->get_graph().state_storage(cur.s).succ;
else
cur.succ = aut_->trans_storage(cur.succ).next_succ;
cur.succ = aut_->edge_storage(cur.succ).next_succ;
if (cur.succ)
{
// Explore one successor.
// Ignore those that are not on the SCC, or destination
// that have been "virtually" deleted from A(v).
unsigned s = aut_->trans_storage(cur.succ).dst;
unsigned s = aut_->edge_storage(cur.succ).dst;
if ((sm_.scc_of(s) != scc) || (info_[cur.s].del[s]))
continue;

View file

@ -55,7 +55,7 @@ namespace spot
// Queue of state to be processed.
typedef std::deque<degen_state> queue_t;
// Acceptance set common to all outgoing transitions (of the same
// Acceptance set common to all outgoing edges (of the same
// SCC -- we do not care about the other) of some state.
class outgoing_acc
{
@ -75,7 +75,7 @@ namespace spot
bool seen = false;
for (auto& t: a_->out(s))
{
// Ignore transitions that leave the SCC of s.
// Ignore edges that leave the SCC of s.
unsigned d = t.dst;
unsigned s2 = sm_ ? sm_->scc_of(d) : 0;
if (s2 != s1)
@ -237,10 +237,10 @@ namespace spot
// and vice-versa.
ds2num_map ds2num;
// This map is used to find transitions that go to the same
// This map is used to find edges that go to the same
// destination with the same acceptance. The integer key is
// (dest*2+acc) where dest is the destination state number, and
// acc is 1 iff the transition is accepting. The source
// acc is 1 iff the edge is accepting. The source
// is always that of the current iteration.
typedef std::map<int, unsigned> tr_cache_t;
tr_cache_t tr_cache;
@ -268,7 +268,7 @@ namespace spot
if (want_sba && !ignaccsl && outgoing.has_acc_selfloop(s.first))
s.second = order.size();
// Otherwise, check for acceptance conditions common to all
// outgoing transitions, and assume we have already seen these and
// outgoing edges, and assume we have already seen these and
// start on the associated level.
if (s.second == 0)
{
@ -345,12 +345,12 @@ namespace spot
{
// Ignore the last expected acceptance set (the value of
// prev below) if it is common to all other outgoing
// transitions (of the current state) AND if it is not
// used by any outgoing transition of the destination
// edges (of the current state) AND if it is not
// used by any outgoing edge of the destination
// state.
//
// 1) It's correct to do that, because this acceptance
// set is common to other outgoing transitions.
// set is common to other outgoing edges.
// Therefore if we make a cycle to this state we
// will eventually see that acceptance set thanks
// to the "pulling" of the common acceptance sets
@ -360,7 +360,7 @@ namespace spot
// degeneralization idempotent (up to a renaming
// of states). Consider the following automaton
// where 1 is initial and => marks accepting
// transitions: 1=>1, 1=>2, 2->2, 2->1. This is
// edges: 1=>1, 1=>2, 2->2, 2->1. This is
// already an SBA, with 1 as accepting state.
// However if you try degeralize it without
// ignoring *prev, you'll get two copies of state
@ -389,9 +389,9 @@ namespace spot
}
}
}
// A transition in the SLEVEL acceptance set should
// A edge in the SLEVEL acceptance set should
// be directed to the next acceptance set. If the
// current transition is also in the next acceptance
// current edge is also in the next acceptance
// set, then go to the one after, etc.
//
// See Denis Oddoux's PhD thesis for a nice
@ -419,7 +419,7 @@ namespace spot
{
// Complete (or replace) the acceptance sets of
// this link with the acceptance sets common to
// all transitions leaving the destination state.
// all edges leaving the destination state.
if (s_scc == scc)
acc |= otheracc;
else
@ -452,7 +452,7 @@ namespace spot
{
// Consider both the current acceptance
// sets, and the acceptance sets common to
// the outgoing transitions of the
// the outgoing edges of the
// destination state. But don't do
// that if the state is accepting and we
// are not skipping levels.
@ -471,12 +471,12 @@ namespace spot
}
// In case we are building a TBA is_acc has to be
// set differently for each transition, and
// set differently for each edge, and
// we do not need to stay use final level.
if (!want_sba)
{
is_acc = d.second == order.size();
if (is_acc) // The transition is accepting
if (is_acc) // The edge is accepting
{
d.second = 0; // Make it go to the first level.
// Skip levels as much as possible.
@ -526,10 +526,10 @@ namespace spot
unsigned& t = tr_cache[dest * 2 + is_acc];
if (t == 0) // Create transition.
t = res->new_acc_transition(src, dest, i.cond, is_acc);
else // Update existing transition.
res->trans_data(t).cond |= i.cond;
if (t == 0) // Create edge.
t = res->new_acc_edge(src, dest, i.cond, is_acc);
else // Update existing edge.
res->edge_data(t).cond |= i.cond;
}
tr_cache.clear();
}
@ -546,7 +546,7 @@ namespace spot
delete m;
res->merge_transitions();
res->merge_edges();
return res;
}
}

View file

@ -427,7 +427,7 @@ namespace spot
}
void
process_link(const twa_graph::trans_storage_t& t, int number)
process_link(const twa_graph::edge_storage_t& t, int number)
{
std::string label = bdd_format_formula(aut_->get_dict(), t.cond);
os_ << " " << t.src << " -> " << t.dst;

View file

@ -302,7 +302,7 @@ namespace spot
// Compute the AP used in the hard way.
bdd ap = bddtrue;
for (auto& t: ref->transitions())
for (auto& t: ref->edges())
ap &= bdd_support(t.cond);
// Count the number of atomic propositions
@ -679,8 +679,8 @@ namespace spot
&& acc_states.find(t->second.src) != acc_states.end();
last_aut_trans =
a->new_acc_transition(t->second.src, t->second.dst,
t->second.cond, accept);
a->new_acc_edge(t->second.src, t->second.dst,
t->second.cond, accept);
last_sat_trans = &t->second;
dout << v << '\t' << t->second << "δ\n";
@ -697,7 +697,7 @@ namespace spot
assert(!state_based);
// This assumes that the SAT solvers output
// variables in increasing order.
a->trans_data(last_aut_trans).acc = acc;
a->edge_data(last_aut_trans).acc = acc;
}
else if (state_based)
{
@ -733,7 +733,7 @@ namespace spot
else
dout << -pit.second << "\t¬" << pit.first << "C\n";
#endif
a->merge_transitions();
a->merge_edges();
return a;
}
}

View file

@ -51,27 +51,27 @@ namespace spot
res->new_states(num_sets * n + 1);
unsigned sink = res->num_states() - 1;
// The sink state has an accepting self-loop.
res->new_acc_transition(sink, sink, bddtrue);
res->new_acc_edge(sink, sink, bddtrue);
for (unsigned src = 0; src < n; ++src)
{
// Keep track of all conditions on transition leaving state
// Keep track of all conditions on edge leaving state
// SRC, so we can complete it.
bdd missingcond = bddtrue;
for (auto& t: res->out(src))
{
if (t.dst >= n) // Ignore transitions we added.
if (t.dst >= n) // Ignore edges we added.
break;
missingcond -= t.cond;
acc_cond::mark_t curacc = t.acc;
// The original transition must not accept anymore.
// The original edge must not accept anymore.
t.acc = 0U;
// Transition that were fully accepting are never cloned.
// Edge that were fully accepting are never cloned.
if (oldacc.accepting(curacc))
continue;
// Save t.cond and t.dst as the reference to t
// is invalided by calls to new_transition().
// is invalided by calls to new_edge().
unsigned dst = t.dst;
bdd cond = t.cond;
@ -84,30 +84,30 @@ namespace spot
add += n;
if (!oldacc.has(curacc, set))
{
// Clone the transition
res->new_acc_transition(src + add, dst + add, cond);
// Clone the edge
res->new_acc_edge(src + add, dst + add, cond);
assert(dst + add < sink);
// Using `t' is disallowed from now on as it is a
// reference to a transition that may have been
// reference to a edge that may have been
// reallocated.
// At least one transition per cycle should have a
// At least one edge per cycle should have a
// nondeterministic copy from the original clone.
// We use state numbers to select it, as any cycle
// is guaranteed to have at least one transition
// is guaranteed to have at least one edge
// with dst <= src. FIXME: Computing a feedback
// arc set would be better.
if (dst <= src)
res->new_transition(src, dst + add, cond);
res->new_edge(src, dst + add, cond);
}
}
assert(add == num_sets * n);
}
// Complete the original automaton.
if (missingcond != bddfalse)
res->new_transition(src, sink, missingcond);
res->new_edge(src, sink, missingcond);
}
res->merge_transitions();
res->merge_edges();
res->purge_dead_states();
return res;
}
@ -137,7 +137,7 @@ namespace spot
if (si.is_rejecting_scc(scc) && !si.is_trivial(scc))
acc = all_acc;
// Keep track of all conditions on transition leaving state
// Keep track of all conditions on edge leaving state
// SRC, so we can complete it.
bdd missingcond = bddtrue;
for (auto& t: res->out(src))
@ -151,12 +151,12 @@ namespace spot
if (res->num_states() == sink)
{
res->new_state();
res->new_acc_transition(sink, sink, bddtrue);
res->new_acc_edge(sink, sink, bddtrue);
}
res->new_transition(src, sink, missingcond);
res->new_edge(src, sink, missingcond);
}
}
//res->merge_transitions();
//res->merge_edges();
return res;
}

View file

@ -613,7 +613,7 @@ namespace spot
// Compute the AP used in the hard way.
bdd ap = bddtrue;
for (auto& t: ref->transitions())
for (auto& t: ref->edges())
ap &= bdd_support(t.cond);
// Count the number of atomic propositions
@ -1033,10 +1033,9 @@ namespace spot
acc = i->second;
}
last_aut_trans = a->new_transition(t->second.src,
t->second.dst,
t->second.cond,
acc);
last_aut_trans = a->new_edge(t->second.src,
t->second.dst,
t->second.cond, acc);
last_sat_trans = &t->second;
dout << v << '\t' << t->second << "δ\n";
@ -1058,7 +1057,7 @@ namespace spot
ta->second.dst == last_sat_trans->dst)
{
assert(!state_based);
auto& v = a->trans_data(last_aut_trans).acc;
auto& v = a->edge_data(last_aut_trans).acc;
v |= ta->second.acc;
}
else if (state_based)
@ -1076,7 +1075,7 @@ namespace spot
dout << pit.second << '\t' << pit.first << "C\n";
#endif
a->merge_transitions();
a->merge_edges();
return a;
}
}

View file

@ -64,7 +64,7 @@ namespace spot
const state*, int out,
const twa_succ_iterator* si)
{
out_->new_transition
out_->new_edge
(in - 1, out - 1, si->current_condition(),
si->current_acceptance_conditions());
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2012, 2013, 2014 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2009, 2011, 2012, 2013, 2014, 2015 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -369,7 +369,7 @@ namespace spot
p.first->second = res->new_state();
dst = p.first->second;
res->new_transition(src, dst, label, acc);
res->new_edge(src, dst, label, acc);
src = dst;
// Sum acceptance conditions.

View file

@ -33,7 +33,7 @@ namespace spot
auto prod = product(clean_a, clean_a);
auto clean_p = scc_filter_states(prod);
return clean_a->num_states() == clean_p->num_states()
&& clean_a->num_transitions() == clean_p->num_transitions();
&& clean_a->num_edges() == clean_p->num_edges();
}
bool check_unambiguous(const twa_graph_ptr& aut)

View file

@ -43,7 +43,7 @@ namespace spot
acc_cond::mark_t acc = 0U;
for (;;)
{
acc |= aut_->trans_storage(i->succ).acc;
acc |= aut_->edge_storage(i->succ).acc;
if (i->s == start)
break;
++i;

View file

@ -1160,7 +1160,7 @@ namespace spot
dest->destroy();
}
namer->new_transition(now, dest, label);
namer->new_edge(now, dest, label);
}
}
@ -2553,8 +2553,8 @@ namespace spot
namer->new_state(t.dest);
}
namer->new_transition(now, t.dest, t.cond,
d.bdd_to_mark(t.prom));
namer->new_edge(now, t.dest, t.cond,
d.bdd_to_mark(t.prom));
if (seen)
t.dest->destroy();
}

View file

@ -25,7 +25,7 @@ namespace spot
{
/// \brief Clone and mask an automaton.
///
/// Copy the transition of the automaton \a old, into the automaton
/// Copy the edge of the automaton \a old, into the automaton
/// \a cpy, creating new states at the same time. The argument \a
/// trans should behave as a function with the following prototype:
/// <code>
@ -33,9 +33,9 @@ namespace spot
/// unsigned dst)
/// </code>
/// It can modify either the condition or the acceptance sets of
/// the transitions. Set the condition to bddfalse to remove it
/// the edges. Set the condition to bddfalse to remove it
/// (this will also remove the destination state and its descendants
/// if they are not reachable by another transition).
/// if they are not reachable by another edge).
/// \param init The optional new initial state.
template<typename Trans>
@ -75,14 +75,14 @@ namespace spot
trans(t.src, cond, acc, t.dst);
if (cond != bddfalse)
cpy->new_transition(new_src,
cpy->new_edge(new_src,
new_state(t.dst),
cond, acc);
}
}
}
/// \brief Copy an automaton and update each transitions.
/// \brief Copy an automaton and update each edge.
///
/// Copy the states of the automaton \a old, into the automaton
/// \a cpy. Each state in \a cpy will have the same id as the ones in \a old.
@ -93,7 +93,7 @@ namespace spot
/// unsigned dst)
/// </code>
/// It can modify either the condition or the acceptance sets of
/// the transitions. Set the condition to bddfalse to remove it. Note that
/// the edges. Set the condition to bddfalse to remove it. Note that
/// all transtions will be processed.
/// \param init The optional new initial state.
template<typename Trans>
@ -105,7 +105,7 @@ namespace spot
cpy->new_states(old->num_states());
cpy->set_init_state(init);
for (auto& t: old->transitions())
for (auto& t: old->edges())
{
bdd cond = t.cond;
acc_cond::mark_t acc = t.acc;
@ -114,7 +114,7 @@ namespace spot
// equivilent in old and cpy.
assert(t.src < cpy->num_states() && t.dst < cpy->num_states());
if (cond != bddfalse)
cpy->new_transition(t.src, t.dst, cond, acc);
cpy->new_edge(t.src, t.dst, cond, acc);
}
}
@ -133,10 +133,10 @@ namespace spot
transform_copy(old, cpy, trans, old->get_init_state_number());
}
/// \brief Remove all transitions that are in some given acceptance sets.
/// \brief Remove all edges that are in some given acceptance sets.
SPOT_API
twa_graph_ptr mask_acc_sets(const const_twa_graph_ptr& in,
acc_cond::mark_t to_remove);
acc_cond::mark_t to_remove);
/// \brief Keep only the states as specified by \a to_keep.
///
@ -144,6 +144,6 @@ namespace spot
/// state. The initial state will be set to \a init.
SPOT_API
twa_graph_ptr mask_keep_states(const const_twa_graph_ptr& in,
std::vector<bool>& to_keep,
unsigned int init);
std::vector<bool>& to_keep,
unsigned int init);
}

View file

@ -160,11 +160,11 @@ namespace spot
dst->destroy();
if (i == state_num.end()) // Ignore useless destinations.
continue;
res->new_acc_transition(src_num, i->second,
succit->current_condition(), accepting);
res->new_acc_edge(src_num, i->second,
succit->current_condition(), accepting);
}
}
res->merge_transitions();
res->merge_edges();
if (res->num_states() > 0)
{
const state* init_state = a->get_init_state();
@ -236,11 +236,11 @@ namespace spot
int n;
for (n = 1, i = loop.begin(); n < loop_size; ++n, ++i)
{
loop_a->new_transition(n - 1, n, i->label);
loop_a->new_edge(n - 1, n, i->label);
i->s->destroy();
}
assert(i != loop.end());
loop_a->new_transition(n - 1, 0, i->label);
loop_a->new_edge(n - 1, 0, i->label);
i->s->destroy();
assert(++i == loop.end());

View file

@ -44,7 +44,7 @@ namespace spot
if (a->num_sets() == 0)
{
auto m = a->set_buchi();
for (auto& t: a->transitions())
for (auto& t: a->edges())
t.acc = m;
}
return a;

View file

@ -93,7 +93,7 @@ namespace spot
typedef std::set<bdd, bdd_less_than> sup_map;
sup_map sup;
// Record occurrences of all guards
for (auto& t: aut->transitions())
for (auto& t: aut->edges())
sup.emplace(t.cond);
for (auto& i: sup)
allap &= bdd_support(i);
@ -206,14 +206,14 @@ namespace spot
assert(pm.map_.size() == dst_num);
pm.map_.emplace_back(std::move(ps));
}
res->new_transition(src_num, dst_num, num2bdd[c]);
res->new_edge(src_num, dst_num, num2bdd[c]);
}
}
for (auto v: toclean)
delete v;
if (merge)
res->merge_transitions();
res->merge_edges();
return res;
}
@ -232,15 +232,15 @@ namespace spot
{
public:
typedef dfs_stack::const_iterator cycle_iter;
typedef twa_graph_trans_data trans;
typedef std::set<trans*> trans_set;
typedef std::vector<trans_set> set_set;
typedef twa_graph_edge_data trans;
typedef std::set<trans*> edge_set;
typedef std::vector<edge_set> set_set;
protected:
const_twa_graph_ptr ref_;
power_map& refmap_;
trans_set reject_; // set of rejecting transitions
edge_set reject_; // set of rejecting edges
set_set accept_; // set of cycles that are accepting
trans_set all_; // all non rejecting transitions
edge_set all_; // all non rejecting edges
unsigned threshold_; // maximum count of enumerated cycles
unsigned cycles_left_; // count of cycles left to explore
@ -277,7 +277,7 @@ namespace spot
return threshold_ != 0 && cycles_left_ == 0;
}
bool is_cycle_accepting(cycle_iter begin, trans_set& ts) const
bool is_cycle_accepting(cycle_iter begin, edge_set& ts) const
{
auto a = std::const_pointer_cast<twa_graph>(aut_);
@ -289,8 +289,8 @@ namespace spot
cycle_iter i;
for (n = 1, i = begin; n <= loop_size; ++n, ++i)
{
trans* t = &a->trans_data(i->succ);
loop_a->new_transition(n - 1, n % loop_size, t->cond);
trans* t = &a->edge_data(i->succ);
loop_a->new_edge(n - 1, n % loop_size, t->cond);
if (reject_.find(t) == reject_.end())
ts.insert(t);
}
@ -318,7 +318,7 @@ namespace spot
}
std::ostream&
print_set(std::ostream& o, const trans_set& s) const
print_set(std::ostream& o, const edge_set& s) const
{
o << "{ ";
for (auto i: s)
@ -333,7 +333,7 @@ namespace spot
cycle_iter i = dfs_.begin();
while (i->s != start)
++i;
trans_set ts;
edge_set ts;
bool is_acc = is_cycle_accepting(i, ts);
do
++i;
@ -387,7 +387,7 @@ namespace spot
unsigned threshold_states, unsigned threshold_cycles)
{
power_map pm;
// Do not merge transitions in the deterministic automaton. If we
// Do not merge edges in the deterministic automaton. If we
// add two self-loops labeled by "a" and "!a", we do not want
// these to be merged as "1" before the acceptance has been fixed.
auto det = tgba_powerset(aut, pm, false);
@ -397,7 +397,7 @@ namespace spot
return nullptr;
if (fix_dba_acceptance(det, aut, pm, threshold_cycles))
return nullptr;
det->merge_transitions();
det->merge_edges();
return det;
}

View file

@ -92,9 +92,9 @@ namespace spot
if (cond == bddfalse)
continue;
auto dst = new_state(l.dst, r.dst);
res->new_transition(top.second, dst, cond,
res->acc().join(left->acc(), l.acc,
right->acc(), r.acc));
res->new_edge(top.second, dst, cond,
res->acc().join(left->acc(), l.acc,
right->acc(), r.acc));
// If right is deterministic, we can abort immediately!
}
}

View file

@ -40,7 +40,7 @@ namespace spot
random_deterministic_labels_rec(std::vector<bdd>& labels, int *props,
int props_n, bdd current, unsigned n)
{
if (n > 1 && props_n >= 1)
if (n > 1 && props_n >= 1)
{
bdd ap = bdd_ithvar(*props);
++props;
@ -184,7 +184,7 @@ namespace spot
labels = random_deterministic_labels(props, props_n, nsucc);
// if nsucc > 2^props_n, we cannot produce nsucc deterministic
// transitions so we set it to labels.size()
// edges so we set it to labels.size()
nsucc = labels.size();
}
else
@ -214,7 +214,7 @@ namespace spot
std::advance(i, index);
// Link it from src.
res->new_transition(src, *i, l, m);
res->new_edge(src, *i, l, m);
nodes_to_process.insert(*i);
unreachable_nodes.erase(*i);
break;
@ -229,7 +229,7 @@ namespace spot
state_randomizer[index] = state_randomizer[possibilities];
state_randomizer[possibilities] = dst;
res->new_transition(src, dst, l, m);
res->new_edge(src, dst, l, m);
auto j = unreachable_nodes.find(dst);
if (j != unreachable_nodes.end())
{

View file

@ -27,9 +27,9 @@ namespace spot
{
void
randomize(twa_graph_ptr& aut, bool randomize_states,
bool randomize_transitions)
bool randomize_edges)
{
if (!randomize_states && !randomize_transitions)
if (!randomize_states && !randomize_edges)
return;
auto& g = aut->get_graph();
if (randomize_states)
@ -51,16 +51,16 @@ namespace spot
aut->set_named_prop("state-names", nn);
}
}
if (randomize_transitions)
if (randomize_edges)
{
g.remove_dead_transitions_();
auto& v = g.transition_vector();
g.remove_dead_edges_();
auto& v = g.edge_vector();
mrandom_shuffle(v.begin() + 1, v.end());
}
typedef twa_graph::graph_t::trans_storage_t tr_t;
g.sort_transitions_([](const tr_t& lhs, const tr_t& rhs)
typedef twa_graph::graph_t::edge_storage_t tr_t;
g.sort_edges_([](const tr_t& lhs, const tr_t& rhs)
{ return lhs.src < rhs.src; });
g.chain_transitions_();
g.chain_edges_();
}
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014 Laboratoire de Recherche et
// Copyright (C) 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -25,10 +25,10 @@ namespace spot
{
/// \brief Randomize a TGBA
///
/// Make a random permutation of the state, and of the transitions
/// Make a random permutation of the state, and of the edges
/// leaving this state.
SPOT_API void
randomize(twa_graph_ptr& aut,
bool randomize_states = true,
bool randomize_transitions = true);
bool randomize_edges = true);
}

View file

@ -35,7 +35,7 @@ namespace spot
bdd_setpair(pairs, oldv, newv);
vars.push_back(oldv);
}
for (auto& t: aut->transitions())
for (auto& t: aut->edges())
t.cond = bdd_replace(t.cond, pairs);
for (auto v: vars)
d->unregister_variable(v, aut);

View file

@ -289,8 +289,7 @@ namespace spot
// Create the main copy
for (auto s: states)
for (auto& t: aut->out(s))
res->new_transition(s, t.dst, t.cond,
(t.acc & main_sets) | main_add);
res->new_edge(s, t.dst, t.cond, (t.acc & main_sets) | main_add);
if (si.is_rejecting_scc(n))
continue;
@ -314,17 +313,17 @@ namespace spot
if ((t.acc & r) || si.scc_of(t.dst) != n)
continue;
auto nd = state_map[t.dst];
res->new_transition(ns, nd, t.cond, (t.acc & k) | a);
res->new_edge(ns, nd, t.cond, (t.acc & k) | a);
// We need only one non-deterministic jump per
// cycle. As an approximation, we only do
// them on back-links.
//
// The acceptance marks on these transition
// The acceptance marks on these edge
// are useless, but we keep them to preserve
// state-based acceptance if any.
if (t.dst <= s)
res->new_transition(s, nd, t.cond,
(t.acc & main_sets) | main_add);
res->new_edge(s, nd, t.cond,
(t.acc & main_sets) | main_add);
}
}
}

View file

@ -46,7 +46,7 @@ namespace spot
result = false;
break;
}
// The state should have only one transition that is a
// The state should have only one edge that is a
// self-loop labelled by true.
auto src = st.front();
auto out = aut->out(src);
@ -69,7 +69,7 @@ namespace spot
throw std::runtime_error
("is_safety_mwdba() should be called on a Buchi automaton");
for (auto& t: aut->transitions())
for (auto& t: aut->edges())
if (!aut->acc().accepting(t.acc))
return false;
return true;

View file

@ -54,11 +54,11 @@ namespace spot
return p.first->second;
};
// Find any transition going into the initial state, and use its
// Find any edge going into the initial state, and use its
// acceptance as mark.
acc_cond::mark_t init_acc = 0U;
unsigned old_init = old->get_init_state_number();
for (auto& t: old->transitions())
for (auto& t: old->edges())
if (t.dst == old_init)
{
init_acc = t.acc;
@ -71,10 +71,10 @@ namespace spot
auto one = todo.back();
todo.pop_back();
for (auto& t: old->out(one.first.first))
res->new_transition(one.second,
new_state(t.dst, t.acc),
t.cond,
one.first.second);
res->new_edge(one.second,
new_state(t.dst, t.acc),
t.cond,
one.first.second);
}
return res;
}

View file

@ -36,7 +36,7 @@ namespace spot
// state(src) return true iff s should be kept
// trans(src, dst, cond, acc) returns a triplet
// (keep, cond2, acc2) where keep is a Boolean stating if the
// transition should be kept, and cond2/acc2
// edge should be kept, and cond2/acc2
// give replacement values for cond/acc
struct id_filter
{
@ -57,7 +57,7 @@ namespace spot
out->copy_acceptance_of(this->si->get_aut());
}
// Accept all transitions, unmodified
// Accept all edges, unmodified
filtered_trans trans(unsigned, unsigned, bdd cond, acc_cond::mark_t acc)
{
return filtered_trans{true, cond, acc};
@ -124,7 +124,7 @@ namespace spot
}
};
// Remove acceptance conditions from all transitions outside of
// Remove acceptance conditions from all edges outside of
// non-accepting SCCs.
template <class next_filter = id_filter>
struct acc_filter_all: next_filter
@ -145,7 +145,7 @@ namespace spot
if (keep)
{
unsigned u = this->si->scc_of(src);
// If the transition is between two SCCs, or in a
// If the edge is between two SCCs, or in a
// non-accepting SCC. Remove the acceptance sets.
if (this->si->is_rejecting_scc(u) || u != this->si->scc_of(dst))
acc = 0U;
@ -155,7 +155,7 @@ namespace spot
}
};
// Remove acceptance conditions from all transitions whose
// Remove acceptance conditions from all edges whose
// destination is not an accepting SCCs.
template <class next_filter = id_filter>
struct acc_filter_some: next_filter
@ -296,7 +296,7 @@ namespace spot
std::tie(want, cond, acc) =
filter.trans(isrc, t.dst, t.cond, t.acc);
if (want)
filtered->new_transition(osrc, odst, cond, acc);
filtered->new_edge(osrc, odst, cond, acc);
}
}
if (!given_si)
@ -346,7 +346,7 @@ namespace spot
res = scc_filter_apply<state_filter
<acc_filter_some<>>>(aut, given_si);
}
res->merge_transitions();
res->merge_edges();
res->prop_copy(aut,
{ false, // state-based acceptance is not preserved
true,
@ -378,7 +378,7 @@ namespace spot
suspvars,
ignoredvars,
early_susp);
res->merge_transitions();
res->merge_edges();
res->prop_copy(aut,
{ false, // state-based acceptance is not preserved
true,

View file

@ -84,8 +84,8 @@ namespace spot
}
}
// Fix the transitions
for (auto& t: aut->transitions())
// Fix the edges
for (auto& t: aut->edges())
{
if ((t.acc & common) == 0U)
continue;

View file

@ -38,12 +38,12 @@
// the format of the acceptance condition, it doesn't allow easy
// simplification. Instead of encoding them as: "a!b!c + !ab!c", we
// use them as: "ab". We complement them because we want a
// simplification if the condition of the transition A implies the
// transition of B, and if the acceptance condition of A is included
// simplification if the condition of the edge A implies the
// edge of B, and if the acceptance condition of A is included
// in the acceptance condition of B. To let the bdd makes the job, we
// revert them.
// Then, to check if a transition i-dominates another, we'll use the bdd:
// Then, to check if a edge i-dominates another, we'll use the bdd:
// "sig(transA) = cond(trans) & acc(trans) & implied(class(trans->state))"
// Idem for sig(transB). The 'implied'
// (represented by a hash table 'relation_' in the implementation) is
@ -65,8 +65,8 @@
// 3. Rename the class (to actualize the name in the previous_class and
// in relation_).
// 4. Building an automaton with the result, with the condition:
// "a transition in the original automaton appears in the simulated one
// iff this transition is included in the set of i-maximal neighbour."
// "a edge in the original automaton appears in the simulated one
// iff this edge is included in the set of i-maximal neighbour."
// This function is `build_output'.
// The automaton simulated is recomplemented to come back to its initial
// state when the object Simulation is destroyed.
@ -96,13 +96,13 @@ namespace spot
struct automaton_size
{
automaton_size()
: transitions(0),
: edges(0),
states(0)
{
}
automaton_size(const twa_graph_ptr& a)
: transitions(a->num_transitions()),
: edges(a->num_edges()),
states(a->num_states())
{
}
@ -110,12 +110,12 @@ namespace spot
void set_size(const twa_graph_ptr& a)
{
states = a->num_states();
transitions = a->num_transitions();
edges = a->num_edges();
}
inline bool operator!=(const automaton_size& r)
{
return transitions != r.transitions || states != r.states;
return edges != r.edges || states != r.states;
}
inline bool operator<(const automaton_size& r)
@ -125,9 +125,9 @@ namespace spot
if (states > r.states)
return false;
if (transitions < r.transitions)
if (edges < r.edges)
return true;
if (transitions > r.transitions)
if (edges > r.edges)
return false;
return false;
@ -140,15 +140,15 @@ namespace spot
if (states > r.states)
return true;
if (transitions < r.transitions)
if (edges < r.edges)
return false;
if (transitions > r.transitions)
if (edges > r.edges)
return true;
return false;
}
int transitions;
int edges;
int states;
};
@ -207,7 +207,7 @@ namespace spot
all_inf_ = all_inf;
// Replace all the acceptance conditions by their complements.
// (In the case of Cosimulation, we also flip the transitions.)
// (In the case of Cosimulation, we also flip the edges.)
if (Cosimulation)
{
a_ = make_twa_graph(in->get_dict());
@ -239,7 +239,7 @@ namespace spot
{
acc = t.acc ^ all_inf;
}
a_->new_transition(t.dst, s, t.cond, acc);
a_->new_edge(t.dst, s, t.cond, acc);
}
a_->set_init_state(init_state_number);
}
@ -247,7 +247,7 @@ namespace spot
else
{
a_ = make_twa_graph(in, twa::prop_set::all());
for (auto& t: a_->transitions())
for (auto& t: a_->edges())
t.acc ^= all_inf;
}
assert(a_->num_states() == size_a_);
@ -309,11 +309,11 @@ namespace spot
for (auto& p: bdd_lstate_)
{
// If the signature of a state is bddfalse (no
// transitions) the class of this state is bddfalse
// edges) the class of this state is bddfalse
// instead of an anonymous variable. It allows
// simplifications in the signature by removing a
// transition which has as a destination a state with
// no outgoing transition.
// edge which has as a destination a state with
// no outgoing edge.
if (p.first == bddfalse)
for (auto s: p.second)
previous_class_[s] = bddfalse;
@ -360,7 +360,7 @@ namespace spot
bdd acc = mark_to_bdd(t.acc);
// to_add is a conjunction of the acceptance condition,
// the label of the transition and the class of the
// the label of the edge and the class of the
// destination and all the class it implies.
bdd to_add = acc & t.cond & relation_[previous_class_[t.dst]];
@ -426,11 +426,11 @@ namespace spot
for (auto& p: bdd_lstate_)
{
// If the signature of a state is bddfalse (no
// transitions) the class of this state is bddfalse
// edges) the class of this state is bddfalse
// instead of an anonymous variable. It allows
// simplifications in the signature by removing a
// transition which has as a destination a state with
// no outgoing transition.
// edge which has as a destination a state with
// no outgoing edge.
bdd acc = bddfalse;
if (p.first != bddfalse)
acc = *it_bdd;
@ -511,14 +511,14 @@ namespace spot
accst.resize(res->num_states(), 0U);
stat.states = bdd_lstate_.size();
stat.transitions = 0;
stat.edges = 0;
unsigned nb_satoneset = 0;
unsigned nb_minato = 0;
auto all_inf = all_inf_;
// For each class, we will create
// all the transitions between the states.
// all the edges between the states.
for (auto& p: bdd_lstate_)
{
// All states in p.second have the same class, so just
@ -565,11 +565,11 @@ namespace spot
bdd cond_acc_dest;
while ((cond_acc_dest = isop.next()) != bddfalse)
{
++stat.transitions;
++stat.edges;
++nb_minato;
// Take the transition, and keep only the variable which
// Take the edge, and keep only the variable which
// are used to represent the class.
bdd dst = bdd_existcomp(cond_acc_dest,
all_class_var_);
@ -584,7 +584,7 @@ namespace spot
// Because we have complemented all the Inf
// acceptance conditions on the input automaton,
// we must revert them to create a new transition.
// we must revert them to create a new edge.
acc ^= all_inf;
if (Cosimulation)
@ -592,18 +592,18 @@ namespace spot
if (Sba)
{
// acc should be attached to src, or rather,
// in our transition-based representation)
// to all transitions leaving src. As we
// in our edge-based representation)
// to all edges leaving src. As we
// can't do this here, store this in a table
// so we can fix it later.
accst[gb->get_state(src.id())] = acc;
acc = 0U;
}
gb->new_transition(dst.id(), src.id(), cond, acc);
gb->new_edge(dst.id(), src.id(), cond, acc);
}
else
{
gb->new_transition(src.id(), dst.id(), cond, acc);
gb->new_edge(src.id(), dst.id(), cond, acc);
}
}
}
@ -612,7 +612,7 @@ namespace spot
res->set_init_state(gb->get_state(previous_class_
[a_->get_init_state_number()].id()));
res->merge_transitions(); // FIXME: is this really needed?
res->merge_edges(); // FIXME: is this really needed?
// Mark all accepting state in a second pass, when
// dealing with SBA in cosimulation.

View file

@ -286,7 +286,7 @@ namespace spot
get_all_ap(const const_twa_graph_ptr& a)
{
bdd res = bddtrue;
for (auto& i: a->transitions())
for (auto& i: a->edges())
res &= bdd_support(i.cond);
return res;
}
@ -360,8 +360,8 @@ namespace spot
(void)u;
}
// Create the transition.
res->new_transition(src, dest, one, t.acc);
// Create the edge.
res->new_edge(src, dest, one, t.acc);
if (src == dest)
self_loop_needed = false;
@ -369,9 +369,9 @@ namespace spot
}
if (self_loop_needed && s.second != bddfalse)
res->new_transition(src, src, s.second, 0U);
res->new_edge(src, src, s.second, 0U);
}
res->merge_transitions();
res->merge_edges();
return res;
}
@ -381,18 +381,18 @@ namespace spot
if (atomic_propositions == bddfalse)
atomic_propositions = get_all_ap(a);
unsigned num_states = a->num_states();
unsigned num_transitions = a->num_transitions();
unsigned num_edges = a->num_edges();
std::vector<bdd> selfloops(num_states, bddfalse);
std::map<std::pair<unsigned, int>, unsigned> newstates;
// Record all the conditions for which we can selfloop on each
// state.
for (auto& t: a->transitions())
for (auto& t: a->edges())
if (t.src == t.dst)
selfloops[t.src] |= t.cond;
for (unsigned t = 1; t <= num_transitions; ++t)
for (unsigned t = 1; t <= num_edges; ++t)
{
auto& td = a->trans_storage(t);
if (a->is_dead_transition(td))
auto& td = a->edge_storage(t);
if (a->is_dead_edge(td))
continue;
unsigned src = td.src;
@ -401,11 +401,11 @@ namespace spot
{
bdd all = td.cond;
// If there is a self-loop with the whole condition on
// either end of the transition, do not bother with it.
// either end of the edge, do not bother with it.
if (bdd_implies(all, selfloops[src])
|| bdd_implies(all, selfloops[dst]))
continue;
// Do not use td in the loop because the new_transition()
// Do not use td in the loop because the new_edge()
// might invalidate it.
auto acc = td.acc;
while (all != bddfalse)
@ -420,13 +420,13 @@ namespace spot
if (p.second)
p.first->second = a->new_state();
unsigned tmp = p.first->second; // intermediate state
unsigned i = a->new_transition(src, tmp, one, acc);
assert(i > num_transitions);
i = a->new_transition(tmp, tmp, one, 0U);
assert(i > num_transitions);
unsigned i = a->new_edge(src, tmp, one, acc);
assert(i > num_edges);
i = a->new_edge(tmp, tmp, one, 0U);
assert(i > num_edges);
// No acceptance here to preserve the state-based property.
i = a->new_transition(tmp, dst, one, 0U);
assert(i > num_transitions);
i = a->new_edge(tmp, dst, one, 0U);
assert(i > num_edges);
(void)i;
}
}
@ -437,7 +437,7 @@ namespace spot
false, // deterministic
false, // stutter inv.
});
a->merge_transitions();
a->merge_edges();
return a;
}
@ -474,7 +474,7 @@ namespace spot
while (!todo.empty())
{
auto t1 = a->trans_storage(todo.back());
auto t1 = a->edge_storage(todo.back());
todo.pop_back();
for (auto& t2 : a->out(t1.dst))
@ -486,7 +486,7 @@ namespace spot
acc_cond::mark_t acc = t1.acc | t2.acc;
for (auto& t: dst2trans[t2.dst])
{
auto& ts = a->trans_storage(t);
auto& ts = a->edge_storage(t);
if (acc == ts.acc)
{
if (!bdd_implies(cond, ts.cond))
@ -516,9 +516,9 @@ namespace spot
if (need_new_trans)
{
// Load t2.dst first, because t2 can be
// invalidated by new_transition().
// invalidated by new_edge().
auto dst = t2.dst;
auto i = a->new_transition(state, dst, cond, acc);
auto i = a->new_edge(state, dst, cond, acc);
dst2trans[dst].push_back(i);
todo.push_back(i);
}

View file

@ -95,7 +95,7 @@ namespace spot
assert(nterms > 0);
res->set_generalized_buchi(nterms);
for (auto& t: res->transitions())
for (auto& t: res->edges())
{
acc_cond::mark_t cur_m = t.acc;
acc_cond::mark_t new_m = 0U;