Commit af8634d8 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

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.
parent a1ba0a89
......@@ -216,7 +216,7 @@ static const struct argp_child children[] =
{ 0, 0, 0, 0 }
};
typedef spot::twa_graph::graph_t::trans_storage_t tr_t;
typedef spot::twa_graph::graph_t::edge_storage_t tr_t;
typedef std::set<std::vector<tr_t>> unique_aut_t;
static long int match_count = 0;
static spot::option_map extra_options;
......@@ -502,7 +502,7 @@ namespace
// If --stats or --name is used, duplicate the automaton so we
// never modify the original automaton (e.g. with
// merge_transitions()) and the statistics about it make sense.
// merge_edges()) and the statistics about it make sense.
auto aut = ((automaton_format == Stats) || opt_name)
? spot::make_twa_graph(haut->aut, spot::twa::prop_set::all())
: haut->aut;
......@@ -512,7 +512,7 @@ namespace
if (opt_stripacc)
spot::strip_acceptance_here(aut);
if (opt_merge)
aut->merge_transitions();
aut->merge_edges();
if (opt_clean_acc || opt_rem_fin)
cleanup_acceptance_here(aut);
if (opt_sep_sets)
......@@ -534,7 +534,7 @@ namespace
bool matched = true;
matched &= opt_states.contains(aut->num_states());
matched &= opt_edges.contains(aut->num_transitions());
matched &= opt_edges.contains(aut->num_edges());
matched &= opt_accsets.contains(aut->acc().num_sets());
if (opt_is_complete)
matched &= is_complete(aut);
......@@ -602,8 +602,8 @@ namespace
auto tmp =
spot::canonicalize(make_twa_graph(aut,
spot::twa::prop_set::all()));
if (!opt->uniq->emplace(tmp->transition_vector().begin() + 1,
tmp->transition_vector().end()).second)
if (!opt->uniq->emplace(tmp->edge_vector().begin() + 1,
tmp->edge_vector().end()).second)
return 0;
}
......@@ -681,7 +681,7 @@ main(int argc, char** argv)
if (opt->are_isomorphic)
{
if (opt_merge)
opt->are_isomorphic->merge_transitions();
opt->are_isomorphic->merge_edges();
opt->isomorphism_checker = std::unique_ptr<spot::isomorphism_checker>
(new spot::isomorphism_checker(opt->are_isomorphic));
}
......
......@@ -1151,7 +1151,7 @@ namespace
if (x[i]->acc().uses_fin_acceptance()) \
{ \
auto st = x[i]->num_states(); \
auto tr = x[i]->num_transitions(); \
auto tr = x[i]->num_edges(); \
auto ac = x[i]->acc().num_sets(); \
x[i] = remove_fin(x[i]); \
if (verbose) \
......@@ -1161,7 +1161,7 @@ namespace
<< tr << " ed., " \
<< ac << " sets) -> (" \
<< x[i]->num_states() << " st., " \
<< x[i]->num_transitions() << " ed., " \
<< x[i]->num_edges() << " ed., " \
<< x[i]->acc().num_sets() << " sets)\n"; \
} \
}
......@@ -1246,7 +1246,7 @@ namespace
if (verbose)
std::cerr << "info: state-space has "
<< statespace->num_transitions()
<< statespace->num_edges()
<< " edges\n";
// Products of the state space with the positive automata.
......@@ -1263,7 +1263,7 @@ namespace
std::cerr << ("info: building product between state-space and"
" P") << i
<< " (" << pos[i]->num_states() << " st., "
<< pos[i]->num_transitions() << " ed.)\n";
<< pos[i]->num_edges() << " ed.)\n";
auto p = spot::product(pos[i], statespace);
pos_prod[i] = p;
auto sm = new spot::scc_info(p);
......@@ -1287,7 +1287,7 @@ namespace
std::cerr << ("info: building product between state-space and"
" N") << i
<< " (" << neg[i]->num_states() << " st., "
<< neg[i]->num_transitions() << " ed.)\n";
<< neg[i]->num_edges() << " ed.)\n";
auto p = spot::product(neg[i], statespace);
neg_prod[i] = p;
......
......@@ -63,7 +63,7 @@ states, 1 to 3 acceptance sets, and three atomic propositions:\n\
\n\
Build 3 random, complete, and deterministic Rabin automata\n\
with 2 to 3 acceptance pairs, state-based acceptance, 8 states, \n\
a high density of transitions, and 3 to 4 atomic propositions:\n\
a high density of edges, and 3 to 4 atomic propositions:\n\
% randaut -n3 -D -H -Q8 -d.8 -S -A 'Rabin 2..3' 3..4\n\
";
......@@ -79,15 +79,15 @@ static const argp_option options[] =
{ "acceptance", 'A', "ACCEPTANCE", 0,
"specify the acceptance type of the automaton", 0 },
{ "acc-probability", 'a', "FLOAT", 0,
"probability that a transition belong to one acceptance set (0.2)", 0 },
"probability that an edge belongs to one acceptance set (0.2)", 0 },
{ "automata", 'n', "INT", 0, "number of automata to output (1)\n"\
"use a negative value for unbounded generation", 0 },
{ "ba", 'B', 0, 0,
"build a Buchi automaton (implies --acceptance=Buchi --state-acc)", 0 },
{ "colored", OPT_COLORED, 0, 0,
"build an automaton in which each transition (or state if combined with "
"build an automaton in which each edge (or state if combined with "
"-S) belong to a single acceptance set", 0 },
{ "density", 'd', "FLOAT", 0, "density of the transitions (0.2)", 0 },
{ "density", 'd', "FLOAT", 0, "density of the edges (0.2)", 0 },
{ "deterministic", 'D', 0, 0, "build a complete, deterministic automaton ",
0 },
{ "unique", 'u', 0, 0,
......@@ -133,7 +133,7 @@ static const struct argp_child children[] =
};
static const char* opt_acceptance = nullptr;
typedef spot::twa_graph::graph_t::trans_storage_t tr_t;
typedef spot::twa_graph::graph_t::edge_storage_t tr_t;
typedef std::set<std::vector<tr_t>> unique_aut_t;
static spot::ltl::atomic_prop_set aprops;
static range ap_count_given = {-1, -2}; // Must be two different negative val
......@@ -364,8 +364,8 @@ main(int argc, char** argv)
{
auto tmp = spot::canonicalize
(make_twa_graph(aut, spot::twa::prop_set::all()));
std::vector<tr_t> trans(tmp->transition_vector().begin() + 1,
tmp->transition_vector().end());
std::vector<tr_t> trans(tmp->edge_vector().begin() + 1,
tmp->edge_vector().end());
if (!opt_uniq->emplace(trans).second)
{
--trials;
......
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
......@@ -247,12 +247,12 @@ namespace spot
unsigned in_scc = sm_.scc_of_state(sin);
bdd cond = si->current_condition();
unsigned t = out_->new_transition(in, out, cond);
unsigned t = out_->new_edge(in, out, cond);
if (realizable_[in_scc])
{
if (final_.find(sin) != final_.end())
out_->trans_data(t).acc = acc_;
out_->edge_data(t).acc = acc_;
}
else if (sm_.scc_of_state(sout) == in_scc)
{
......@@ -278,12 +278,11 @@ namespace spot
// implementation create more transitions than needed:
// we do not need more than one transition per
// accepting cycle.
out_->new_transition(in, out + shift, cond);
out_->new_edge(in, out + shift, cond);
// Acceptance transitions are those in the Li
// set. (Löding's Fi set.)
out_->new_acc_transition(in + shift, out + shift, cond,
l.get(i));
out_->new_acc_edge(in + shift, out + shift, cond, l.get(i));
}
}
}
......
......@@ -275,7 +275,7 @@ states:
{
for (map_t::const_iterator i = result.dest_map.begin();
i != result.dest_map.end(); ++i)
result.d->aut->new_transition(result.cur_state, i->first, i->second);
result.d->aut->new_edge(result.cur_state, i->first, i->second);
}
%%
......
......@@ -70,7 +70,7 @@ namespace spot
int out = d_->aut->state_number(sout);
bdd cond = si->current_condition();
out_->new_transition(in, out, cond);
out_->new_edge(in, out, cond);
// Create one clone of the automaton per accepting pair,
// removing states from the Ui part of the (Li, Ui) pairs.
......@@ -94,12 +94,11 @@ namespace spot
// implementation create more transitions than needed:
// we do not need more than one transition per
// accepting cycle.
out_->new_transition(in, out + shift, cond);
out_->new_edge(in, out + shift, cond);
// A transition is accepting if it is in the Li
// set. (Löding's Fi set.)
out_->new_acc_transition(in + shift, out + shift, cond,
l.get(i));
out_->new_acc_edge(in + shift, out + shift, cond, l.get(i));
}
}
}
......
......@@ -155,7 +155,7 @@ namespace spot
dest = dres.first->second = res->new_state();
todo.push_back(d);
}
res->new_transition(src, dest, t.cond, acc);
res->new_edge(src, dest, t.cond, acc);
// Jump to level ∅
if (s.pend == 0)
......@@ -175,7 +175,7 @@ namespace spot
dest = dres.first->second = res->new_state();
todo.push_back(d);
}
res->new_transition(src, dest, t.cond);
res->new_edge(src, dest, t.cond);
}
}
}
......
This diff is collapsed.
// -*- coding: utf-8 -*-
// Copyright (C) 2014 Laboratoire de Recherche et Développement de
// l'Epita.
// Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement
// de l'Epita.
//
// This file is part of Spot, a model checking library.
//
......@@ -36,7 +36,7 @@ namespace spot
public:
typedef typename Graph::state state;
typedef typename Graph::transition transition;
typedef typename Graph::edge edge;
typedef State_Name name;
typedef std::unordered_map<name, state,
......@@ -90,13 +90,13 @@ namespace spot
auto old = p.first->second;
p.first->second = s;
// Add the successor of OLD to those of S.
auto& trans = g_.transition_vector();
auto& trans = g_.edge_vector();
auto& states = g_.states();
trans[states[s].succ_tail].next_succ = states[old].succ;
states[s].succ_tail = states[old].succ_tail;
states[old].succ = 0;
states[old].succ_tail = 0;
// Remove all references to old in transitions:
// Remove all references to old in edges:
unsigned tend = trans.size();
for (unsigned t = 1; t < tend; ++t)
{
......@@ -130,35 +130,34 @@ namespace spot
}
template <typename... Args>
transition
new_transition(name src, name dst, Args&&... args)
edge
new_edge(name src, name dst, Args&&... args)
{
return g_.new_transition(get_state(src), get_state(dst),
std::forward<Args>(args)...);
return g_.new_edge(get_state(src), get_state(dst),
std::forward<Args>(args)...);
}
template <typename... Args>
transition
new_transition(name src,
const std::vector<State_Name>& dst, Args&&... args)
edge
new_edge(name src, const std::vector<State_Name>& dst, Args&&... args)
{
std::vector<State_Name> d;
d.reserve(dst.size());
for (auto n: dst)
d.push_back(get_state(n));
return g_.new_transition(get_state(src), d, std::forward<Args>(args)...);
return g_.new_edge(get_state(src), d, std::forward<Args>(args)...);
}
template <typename... Args>
transition
new_transition(name src,
edge
new_edge(name src,
const std::initializer_list<State_Name>& dst, Args&&... args)
{
std::vector<state> d;
d.reserve(dst.size());
for (auto n: dst)
d.push_back(get_state(n));
return g_.new_transition(get_state(src), d, std::forward<Args>(args)...);
return g_.new_edge(get_state(src), d, std::forward<Args>(args)...);
}
};
}
......@@ -168,7 +168,7 @@ namespace spot
bdd support = bddtrue;
{
std::set<int> bdd_seen;
for (auto& t: aut->transitions())
for (auto& t: aut->edges())
if (bdd_seen.insert(t.cond.id()).second)
support &= bdd_support(t.cond);
}
......
......@@ -1021,16 +1021,14 @@ incorrectly-unlabeled-edge: checked-state-num trans-acc_opt
"(previous edge is labeled)");
else
cond = res.state_label;
res.h->aut->new_transition(res.cur_state, $1,
cond,
$2 | res.acc_state);
res.h->aut->new_edge(res.cur_state, $1,
cond, $2 | res.acc_state);
}
labeled-edge: trans-label checked-state-num trans-acc_opt
{
if (res.cur_label != bddfalse)
res.h->aut->new_transition(res.cur_state, $2,
res.cur_label,
$3 | res.acc_state);
res.h->aut->new_edge(res.cur_state, $2,
res.cur_label, $3 | res.acc_state);
}
| trans-label state-conj-2 trans-acc_opt
{
......@@ -1067,8 +1065,8 @@ unlabeled-edge: checked-state-num trans-acc_opt
}
}
if (cond != bddfalse)
res.h->aut->new_transition(res.cur_state, $1,
cond, $2 | res.acc_state);
res.h->aut->new_edge(res.cur_state, $1,
cond, $2 | res.acc_state);
}
| state-conj-2 trans-acc_opt
{
......@@ -1097,7 +1095,7 @@ never: "never" { res.namer = res.h->aut->create_namer<std::string>();
if (res.accept_all_needed && !res.accept_all_seen)
{
unsigned n = res.namer->new_state("accept_all");
res.h->aut->new_acc_transition(n, n, bddtrue);
res.h->aut->new_acc_edge(n, n, bddtrue);
}
// If we aliased existing state, we have some unreachable
// states to remove.
......@@ -1172,7 +1170,7 @@ nc-state:
auto acc = !strncmp("accept", $1->c_str(), 6) ?
res.h->aut->acc().all_sets() : spot::acc_cond::mark_t(0U);
res.namer->new_transition(*$1, *$1, bddtrue, acc);
res.namer->new_edge(*$1, *$1, bddtrue, acc);
delete $1;
}
| nc-ident-list { delete $1; }
......@@ -1185,7 +1183,7 @@ nc-state:
{
bdd c = bdd_from_int(p.first);
bdd_delref(p.first);
res.namer->new_transition(*$1, *p.second, c, acc);
res.namer->new_edge(*$1, *p.second, c, acc);
delete p.second;
}
delete $1;
......@@ -1445,9 +1443,9 @@ lbtt-transitions:
{
res.states_map.emplace(dst, dst);
}
res.h->aut->new_transition(res.cur_state, dst,
res.cur_label,
res.acc_state | $3);
res.h->aut->new_edge(res.cur_state, dst,
res.cur_label,
res.acc_state | $3);
}
%%
......@@ -1563,7 +1561,7 @@ static void fix_acceptance(result_& r)
auto onlyneg = r.neg_acc_sets - r.pos_acc_sets;
if (onlyneg)
{
for (auto& t: r.h->aut->transition_vector())
for (auto& t: r.h->aut->edge_vector())
t.acc ^= onlyneg;
}
......@@ -1579,7 +1577,7 @@ static void fix_acceptance(result_& r)
auto v = acc.sets(both);
auto vs = v.size();
base = acc.add_sets(vs);
for (auto& t: r.h->aut->transition_vector())
for (auto& t: r.h->aut->edge_vector())
if ((t.acc & both) != both)
for (unsigned i = 0; i < vs; ++i)
if (!t.acc.has(v[i]))
......@@ -1631,7 +1629,7 @@ static void fix_initial_state(result_& r)
// unless one of the actual initial state has no incoming edge.
auto& aut = r.h->aut;
std::vector<unsigned> has_incoming(aut->num_states(), 0);
for (auto& t: aut->transitions())
for (auto& t: aut->edges())
has_incoming[t.dst] = true;
bool found = false;
......@@ -1649,7 +1647,7 @@ static void fix_initial_state(result_& r)
for (auto p: start)
if (p != init)
for (auto& t: aut->out(p))
aut->new_transition(init, t.dst, t.cond);
aut->new_edge(init, t.dst, t.cond);
}
}
......
......@@ -198,7 +198,7 @@ int main(int argc, char* argv[])
auto buchi = spot::degeneralize(a);
std::cout << "Buchi: "
<< buchi->num_states()
<< buchi->num_transitions()
<< buchi->num_edges()
<< buchi->acc().num_sets()
<< std::endl;
......
// -*- coding: utf-8 -*-
// Copyright (C) 2014 Laboratoire de Recherche et Développement de
// l'Epita.
// Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement
// de l'Epita.
//
// This file is part of Spot, a model checking library.
//
......@@ -89,12 +89,12 @@ bool f1()
auto s1 = g.new_state();
auto s2 = g.new_state();
auto s3 = g.new_state();
g.new_transition(s1, s2);
g.new_transition(s1, s3);
g.new_transition(s2, s3);
g.new_transition(s3, s1);
g.new_transition(s3, s2);
g.new_transition(s3, s3);
g.new_edge(s1, s2);
g.new_edge(s1, s3);
g.new_edge(s2, s3);
g.new_edge(s3, s1);
g.new_edge(s3, s2);
g.new_edge(s3, s3);
dot(std::cout, g);
......@@ -118,10 +118,10 @@ bool f2()
auto s1 = g.new_state(1);
auto s2 = g.new_state(2);
auto s3 = g.new_state(3);
g.new_transition(s1, s2);
g.new_transition(s1, s3);
g.new_transition(s2, s3);
g.new_transition(s3, s2);
g.new_edge(s1, s2);
g.new_edge(s1, s3);
g.new_edge(s2, s3);
g.new_edge(s3, s2);
dot(std::cout, g);
......@@ -140,10 +140,10 @@ bool f3()
auto s1 = g.new_state();
auto s2 = g.new_state();
auto s3 = g.new_state();
g.new_transition(s1, s2, 1);
g.new_transition(s1, s3, 2);
g.new_transition(s2, s3, 3);
g.new_transition(s3, s2, 4);
g.new_edge(s1, s2, 1);
g.new_edge(s1, s3, 2);
g.new_edge(s2, s3, 3);
g.new_edge(s3, s2, 4);
dot(std::cout, g);
......@@ -162,10 +162,10 @@ bool f4()
auto s1 = g.new_state(2);
auto s2 = g.new_state(3);
auto s3 = g.new_state(4);
g.new_transition(s1, s2, 1);
g.new_transition(s1, s3, 2);
g.new_transition(s2, s3, 3);
g.new_transition(s3, s2, 4);
g.new_edge(s1, s2, 1);
g.new_edge(s1, s3, 2);
g.new_edge(s2, s3, 3);
g.new_edge(s3, s2, 4);
dot(std::cout, g);
......@@ -184,10 +184,10 @@ bool f5()
auto s1 = g.new_state();
auto s2 = g.new_state();
auto s3 = g.new_state();
g.new_transition(s1, s2, std::make_pair(1, 1.2f));
g.new_transition(s1, s3, std::make_pair(2, 1.3f));
g.new_transition(s2, s3, std::make_pair(3, 1.4f));
g.new_transition(s3, s2, std::make_pair(4, 1.5f));
g.new_edge(s1, s2, std::make_pair(1, 1.2f));
g.new_edge(s1, s3, std::make_pair(2, 1.3f));
g.new_edge(s2, s3, std::make_pair(3, 1.4f));
g.new_edge(s3, s2, std::make_pair(4, 1.5f));
int f = 0;
float h = 0;
......@@ -206,10 +206,10 @@ bool f6()
auto s1 = g.new_state();
auto s2 = g.new_state();
auto s3 = g.new_state();
g.new_transition(s1, s2, 1, 1.2f);
g.new_transition(s1, s3, 2, 1.3f);
g.new_transition(s2, s3, 3, 1.4f);
g.new_transition(s3, s2, 4, 1.5f);
g.new_edge(s1, s2, 1, 1.2f);
g.new_edge(s1, s3, 2, 1.3f);
g.new_edge(s2, s3, 3, 1.4f);
g.new_edge(s3, s2, 4, 1.5f);
int f = 0;
float h = 0;
......@@ -227,10 +227,10 @@ bool f7()
auto s1 = g.new_state(2);
auto s2 = g.new_state(3);
auto s3 = g.new_state(4);
g.new_transition(s1, {s2, s3}, 1);
g.new_transition(s1, {s3}, 2);
g.new_transition(s2, {s3}, 3);
g.new_transition(s3, {s2}, 4);
g.new_edge(s1, {s2, s3}, 1);
g.new_edge(s1, {s3}, 2);
g.new_edge(s2, {s3}, 3);
g.new_edge(s3, {s2}, 4);
int f = 0;
for (auto& t: g.out(s1))
......@@ -273,10 +273,10 @@ bool f8()
auto s1 = g.new_state(2, 4);
auto s2 = g.new_state(3, 6);
auto s3 = g.new_state(4, 8);
g.new_transition(s1, s2, 1, 3);
g.new_transition(s1, s3, 2, 5);
g.new_transition(s2, s3, 3, 7);
g.new_transition(s3, s2, 4, 9);
g.new_edge(s1, s2, 1, 3);
g.new_edge(s1, s3, 2, 5);
g.new_edge(s2, s3, 3, 7);
g.new_edge(s3, s2, 4, 9);
dot(std::cout, g);
......
......@@ -613,7 +613,7 @@ checked_main(int argc, char** argv)
if (spot::format_parse_aut_errors(std::cerr,
argv[formula_index] + 2, pel))
return 2;
daut->aut->merge_transitions();
daut->aut->merge_edges();
system_aut = daut->aut;
tm.stop("reading -P's argument");
}
......@@ -1018,7 +1018,7 @@ checked_main(int argc, char** argv)
tm.stop("parsing hoa");
if (spot::format_parse_aut_errors(std::cerr, input, pel))
return 2;
daut->aut->merge_transitions();
daut->aut->merge_edges();
a = daut->aut;
assume_sba = a->is_sba();
}
......
// -*- coding: utf-8 -*-
// Copyright (C) 2014 Laboratoire de Recherche et Développement de
// l'Epita.
// Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement
// de l'Epita.
//
// This file is part of Spot, a model checking library.
//
......@@ -128,12 +128,12 @@ bool f1()
auto s1 = gg.new_state("s1");
auto s2 = gg.new_state("s2");
auto s3 = gg.new_state("s3");
gg.new_transition("s1", "s2");
gg.new_transition("s1", "s3");
gg.new_transition("s