21#include <spot/misc/common.hh>
22#include <spot/misc/_config.h>
23#include <spot/misc/permute.hh>
32#ifdef SPOT_ENABLE_PTHREAD
43 template <
typename State_Data,
typename Edge_Data>
44 class SPOT_API digraph;
49 template <
typename Of,
typename ...Args>
50 struct first_is_base_of
52 static const bool value =
false;
55 template <
typename Of,
typename Arg1,
typename ...Args>
56 struct first_is_base_of<Of, Arg1, Args...>
58 static const bool value =
59 std::is_base_of<Of, typename std::decay<Arg1>::type>::value;
69 template <typename Data, bool boxed = !std::is_class<Data>::value>
70 struct SPOT_API boxed_label
76 template <
typename... Args,
77 typename =
typename std::enable_if<
78 !first_is_base_of<boxed_label, Args...>::value>::type>
79 boxed_label(Args&&... args)
80 noexcept(std::is_nothrow_constructible<Data, Args...>::value)
81 : label{std::forward<Args>(args)...}
88 explicit boxed_label()
89 noexcept(std::is_nothrow_constructible<Data>::value)
98 const Data& data()
const
103 bool operator<(
const boxed_label& other)
const
105 return label < other.label;
110 struct SPOT_API boxed_label<void, true>:
public std::tuple<>
112 typedef std::tuple<> data_t;
118 const std::tuple<>& data()
const
125 template <
typename Data>
126 struct SPOT_API boxed_label<Data, false>:
public Data
131 template <
typename... Args,
132 typename =
typename std::enable_if<
133 !first_is_base_of<boxed_label, Args...>::value>::type>
134 boxed_label(Args&&... args)
135 noexcept(std::is_nothrow_constructible<Data, Args...>::value)
136 : Data{std::forward<Args>(args)...}
143 explicit boxed_label()
144 noexcept(std::is_nothrow_constructible<Data>::value)
153 const Data& data()
const
166 template <
typename Edge,
typename State_Data>
167 struct SPOT_API distate_storage
final:
public State_Data
173 template <
typename... Args,
174 typename =
typename std::enable_if<
175 !first_is_base_of<distate_storage, Args...>::value>::type>
176 distate_storage(Args&&... args)
177 noexcept(std::is_nothrow_constructible<State_Data, Args...>::value)
178 : State_Data{std::forward<Args>(args)...}
190 template <
typename StateIn,
191 typename StateOut,
typename Edge,
typename Edge_Data>
192 struct SPOT_API edge_storage final:
public Edge_Data
201 explicit edge_storage()
202 noexcept(std::is_nothrow_constructible<Edge_Data>::value)
208 template <
typename... Args>
209 edge_storage(StateOut dst, Edge next_succ,
210 StateIn src, Args&&... args)
211 noexcept(std::is_nothrow_constructible<Edge_Data, Args...>::value
212 && std::is_nothrow_constructible<StateOut, StateOut>::value
213 && std::is_nothrow_constructible<Edge, Edge>::value)
214 : Edge_Data{std::forward<Args>(args)...},
215 dst(dst), next_succ(next_succ), src(src)
220 bool operator<(
const edge_storage& other)
const
231 return this->data() < other.data();
234 bool operator==(
const edge_storage& other)
const
236 return src == other.src &&
238 this->data() == other.data();
250 template <
typename Graph>
251 class SPOT_API edge_iterator
254 typedef typename std::conditional<std::is_const<Graph>::value,
255 const typename Graph::edge_storage_t,
256 typename Graph::edge_storage_t>::type
258 typedef value_type& reference;
259 typedef value_type* pointer;
260 typedef std::ptrdiff_t difference_type;
261 typedef std::forward_iterator_tag iterator_category;
263 typedef typename Graph::edge edge;
265 edge_iterator() noexcept
270 edge_iterator(Graph* g, edge t) noexcept
285 reference operator*()
const
287 return g_->edge_storage(t_);
290 pointer operator->()
const
292 return &g_->edge_storage(t_);
295 edge_iterator operator++()
297 t_ = operator*().next_succ;
301 edge_iterator operator++(
int)
303 edge_iterator ti = *
this;
304 t_ = operator*().next_succ;
308 operator bool()
const
323 template <
typename Graph>
324 class SPOT_API killer_edge_iterator:
public edge_iterator<Graph>
326 typedef edge_iterator<Graph> super;
328 typedef typename Graph::state_storage_t state_storage_t;
329 typedef typename Graph::edge edge;
331 killer_edge_iterator(Graph* g, edge t, state_storage_t& src) noexcept
332 : super(g, t), src_(src), prev_(0)
336 killer_edge_iterator operator++()
339 this->t_ = this->operator*().next_succ;
343 killer_edge_iterator operator++(
int)
345 killer_edge_iterator ti = *
this;
353 edge next = this->operator*().next_succ;
358 this->g_->edge_storage(prev_).next_succ = next;
362 if (src_.succ == this->t_)
365 if (src_.succ_tail == this->t_)
367 src_.succ_tail = prev_;
368 SPOT_ASSERT(next == 0);
372 this->operator*().next_succ = this->t_;
377 ++this->g_->killed_edge_;
381 state_storage_t& src_;
392 template <
typename Graph>
393 class SPOT_API state_out
396 typedef typename Graph::edge edge;
397 state_out(Graph* g, edge t) noexcept
402 edge_iterator<Graph> begin()
const
407 edge_iterator<Graph> end()
const
426 template <
typename Graph>
427 class SPOT_API all_edge_iterator
430 typedef typename std::conditional<std::is_const<Graph>::value,
431 const typename Graph::edge_storage_t,
432 typename Graph::edge_storage_t>::type
434 typedef value_type& reference;
435 typedef value_type* pointer;
436 typedef std::ptrdiff_t difference_type;
437 typedef std::forward_iterator_tag iterator_category;
440 typedef typename std::conditional<std::is_const<Graph>::value,
441 const typename Graph::edge_vector_t,
442 typename Graph::edge_vector_t>::type
450 unsigned s = tv_.size();
453 while (t_ < s && tv_[t_].next_succ == t_);
457 all_edge_iterator(
unsigned pos, tv_t& tv) noexcept
463 all_edge_iterator(tv_t& tv) noexcept
464 : t_(tv.size()), tv_(tv)
468 all_edge_iterator& operator++()
474 all_edge_iterator operator++(
int)
476 all_edge_iterator old = *
this;
491 reference operator*()
const
496 pointer operator->()
const
503 template <
typename Graph>
504 class SPOT_API all_trans
507 typedef typename std::conditional<std::is_const<Graph>::value,
508 const typename Graph::edge_vector_t,
509 typename Graph::edge_vector_t>::type
511 typedef all_edge_iterator<Graph> iter_t;
516 all_trans(tv_t& tv) noexcept
532 class SPOT_API const_universal_dests
535 const unsigned* begin_;
536 const unsigned* end_;
539 const_universal_dests(
const unsigned* begin,
const unsigned* end) noexcept
540 : begin_(begin), end_(end)
544 const_universal_dests(
unsigned state) noexcept
545 : begin_(&tmp_), end_(&tmp_ + 1), tmp_(state)
549 const unsigned* begin()
const
554 const unsigned* end()
const
561 class univ_dest_mapper
563 std::map<std::vector<unsigned>,
unsigned> uniq_;
567 univ_dest_mapper(
G& graph)
573 unsigned new_univ_dests(I begin, I end)
575 std::vector<unsigned> tmp(begin, end);
576 std::sort(tmp.begin(), tmp.end());
577 tmp.erase(std::unique(tmp.begin(), tmp.end()), tmp.end());
578 auto p = uniq_.emplace(tmp, 0);
580 p.first->second = g_.new_univ_dests(tmp.begin(), tmp.end());
581 return p.first->second;
584 unsigned new_univ_dests(std::vector<unsigned>&& tmp)
586 std::sort(tmp.begin(), tmp.end());
587 tmp.erase(std::unique(tmp.begin(), tmp.end()), tmp.end());
588 auto p = uniq_.emplace(tmp, 0);
590 p.first->second = g_.new_univ_dests(tmp.begin(), tmp.end());
591 return p.first->second;
603 template <
typename State_Data,
typename Edge_Data>
606 friend class internal::edge_iterator<
digraph>;
607 friend class internal::edge_iterator<const
digraph>;
608 friend class internal::killer_edge_iterator<
digraph>;
626 typedef internal::distate_storage<
edge,
627 internal::boxed_label<State_Data>>
631 internal::boxed_label<Edge_Data>>
655 digraph(
unsigned max_states = 10,
unsigned max_trans = 0)
660 max_trans = max_states * 2;
661 edges_.reserve(max_trans + 1);
694 template <
typename... Args>
698 states_.emplace_back(std::forward<Args>(args)...);
708 template <
typename... Args>
714 states_.emplace_back(std::forward<Args>(args)...);
741 typename state_storage_t::data_t&
747 const typename state_storage_t::data_t&
777 typename edge_storage_t::data_t&
783 const typename edge_storage_t::data_t&
795 template <
typename... Args>
800 edges_.emplace_back(dst, 0, src, std::forward<Args>(args)...);
803 SPOT_ASSERT(st < t || !st);
819 template <
typename I>
823 unsigned sz = std::distance(dst_begin, dst_end);
827 unsigned d =
dests_.size();
829 && &*dst_begin >= &
dests_.front()
830 && &*dst_begin <= &
dests_.back()
836 std::vector<unsigned> tmp(dst_begin, dst_end);
854 template <
typename I,
typename... Args>
859 std::forward<Args>(args)...);
867 template <
typename... Args>
873 std::forward<Args>(args)...);
882 const unsigned* d =
dests_.data();
885 return { d + 1, d + num + 1 };
909 SPOT_ASSERT(!
edges_.empty());
915 internal::state_out<digraph>
918 return {
this,
states_[src].succ};
921 internal::state_out<digraph>
927 internal::state_out<const digraph>
930 return {
this,
states_[src].succ};
933 internal::state_out<const digraph>
944 internal::killer_edge_iterator<digraph>
947 return {
this, src.succ, src};
950 internal::killer_edge_iterator<digraph>
975 internal::all_trans<const digraph>
edges()
const
980 internal::all_trans<digraph>
edges()
1015 return (t <
edges_.size() &&
1016 edges_[t].next_succ != t);
1025 return edges_[t].next_succ == t;
1053 unsigned tend =
edges_.size();
1054 for (
unsigned t = 1; t < tend; ++t)
1056 o <<
't' << t <<
": (s"
1057 <<
edges_[t].src <<
", ";
1063 o <<
") t" <<
edges_[t].next_succ <<
'\n';
1065 unsigned send =
states_.size();
1066 for (
unsigned s = 0; s < send; ++s)
1068 o <<
's' << s <<
": t"
1070 <<
states_[s].succ_tail <<
'\n';
1072 unsigned dend =
dests_.size();
1074 for (
unsigned s = 0; s < dend; ++s)
1076 o <<
'd' << s <<
": ";
1093 DSI_GraphHeader = 1,
1094 DSI_GraphFooter = 2,
1095 DSI_StatesHeader = 4,
1097 DSI_StatesFooter = 16,
1098 DSI_States = DSI_StatesHeader | DSI_StatesBody | DSI_StatesFooter,
1099 DSI_EdgesHeader = 32,
1101 DSI_EdgesFooter = 128,
1102 DSI_Edges = DSI_EdgesHeader | DSI_EdgesBody | DSI_EdgesFooter,
1103 DSI_DestsHeader = 256,
1104 DSI_DestsBody = 512,
1105 DSI_DestsFooter = 1024,
1106 DSI_Dests = DSI_DestsHeader | DSI_DestsBody | DSI_DestsFooter,
1108 DSI_GraphHeader | DSI_States | DSI_Edges | DSI_Dests | DSI_GraphFooter,
1114 if (dsi & DSI_GraphHeader)
1115 o <<
"digraph g { \nnode [shape=plaintext]\n";
1116 unsigned send =
states_.size();
1117 if (dsi & DSI_StatesHeader)
1119 o << (
"states [label=<\n"
1120 "<table border='0' cellborder='1' cellspacing='0'>\n"
1121 "<tr><td sides='b' bgcolor='yellow' port='s'>states</td>\n");
1122 for (
unsigned s = 0; s < send; ++s)
1123 o <<
"<td sides='b' bgcolor='yellow' port='s" << s <<
"'>"
1127 if (dsi & DSI_StatesBody)
1129 o <<
"<tr><td port='ss'>succ</td>\n";
1130 for (
unsigned s = 0; s < send; ++s)
1132 o <<
"<td port='ss" << s;
1134 o <<
"' bgcolor='cyan";
1135 o <<
"'>" <<
states_[s].succ <<
"</td>\n";
1137 o <<
"</tr><tr><td port='st'>succ_tail</td>\n";
1138 for (
unsigned s = 0; s < send; ++s)
1140 o <<
"<td port='st" << s;
1142 o <<
"' bgcolor='cyan";
1143 o <<
"'>" <<
states_[s].succ_tail <<
"</td>\n";
1147 if (dsi & DSI_StatesFooter)
1148 o <<
"</table>>]\n";
1149 unsigned eend =
edges_.size();
1150 if (dsi & DSI_EdgesHeader)
1152 o << (
"edges [label=<\n"
1153 "<table border='0' cellborder='1' cellspacing='0'>\n"
1154 "<tr><td sides='b' bgcolor='cyan' port='e'>edges</td>\n");
1155 for (
unsigned e = 1; e < eend; ++e)
1157 o <<
"<td sides='b' bgcolor='"
1158 << (e !=
edges_[e].next_succ ?
"cyan" :
"gray")
1159 <<
"' port='e" << e <<
"'>" << e <<
"</td>\n";
1163 if (dsi & DSI_EdgesBody)
1165 o <<
"<tr><td port='ed'>dst</td>\n";
1166 for (
unsigned e = 1; e < eend; ++e)
1168 o <<
"<td port='ed" << e;
1171 o <<
"' bgcolor='pink'>~" << ~d;
1173 o <<
"' bgcolor='yellow'>" << d;
1176 o <<
"</tr><tr><td port='en'>next_succ</td>\n";
1177 for (
unsigned e = 1; e < eend; ++e)
1179 o <<
"<td port='en" << e;
1182 if (
edges_[e].next_succ != e)
1183 o <<
"' bgcolor='cyan";
1185 o <<
"' bgcolor='gray";
1187 o <<
"'>" <<
edges_[e].next_succ <<
"</td>\n";
1189 o <<
"</tr><tr><td port='es'>src</td>\n";
1190 for (
unsigned e = 1; e < eend; ++e)
1191 o <<
"<td port='es" << e <<
"' bgcolor='yellow'>"
1192 <<
edges_[e].src <<
"</td>\n";
1195 if (dsi & DSI_EdgesFooter)
1196 o <<
"</table>>]\n";
1199 unsigned dend =
dests_.size();
1200 if (dsi & DSI_DestsHeader)
1202 o << (
"dests [label=<\n"
1203 "<table border='0' cellborder='1' cellspacing='0'>\n"
1204 "<tr><td sides='b' bgcolor='pink' port='d'>dests</td>\n");
1208 o <<
"<td sides='b' bgcolor='pink' port='d"
1209 << d <<
"'>~" << d <<
"</td>\n";
1210 unsigned cnt =
dests_[d];
1213 o <<
"<td sides='b'></td>\n";
1217 if (dsi & DSI_DestsBody)
1219 o <<
"<tr><td port='dd'>#cnt/dst</td>\n";
1223 unsigned cnt =
dests_[d];
1224 o <<
"<td port='d'>#" << cnt <<
"</td>\n";
1228 o <<
"<td bgcolor='yellow' port='dd"
1229 << d <<
"'>" <<
dests_[d] <<
"</td>\n";
1235 if (dsi & DSI_DestsFooter)
1236 o <<
"</table>>]\n";
1238 if (dsi & DSI_GraphFooter)
1251 auto i = std::remove_if(
edges_.begin() + 1,
edges_.end(),
1253 return this->is_dead_edge(t);
1264 template<
class Predicate = std::less<edge_storage_t>>
1281 template<
class Predicate = std::less<edge_storage_t>>
1285 SPOT_ASSERT(!
edges_.empty());
1287 std::vector<unsigned> idx_list(ns+1);
1289 new_edges.reserve(
edges_.size());
1290 new_edges.resize(1);
1292 new_edges[0].next_succ = 0;
1294 for (
unsigned s = 0; s < ns; ++s)
1296 idx_list[s] = new_edges.size();
1297 for (
const auto& e :
out(s))
1298 new_edges.push_back(e);
1300 idx_list[ns] = new_edges.size();
1304 auto bne = new_edges.begin();
1305#ifndef SPOT_ENABLE_PTHREAD
1308 unsigned nthreads = ppolicy.nthreads();
1312 for (
unsigned s = 0u; s < ns; ++s)
1313 std::stable_sort(bne + idx_list[s],
1314 bne + idx_list[s+1], p);
1316#ifdef SPOT_ENABLE_PTHREAD
1319 static std::vector<std::thread> tv;
1320 SPOT_ASSERT(tv.empty());
1321 tv.resize(nthreads);
1326 for (
unsigned id = 0;
id < nthreads; ++id)
1327 tv[
id] = std::thread(
1328 [bne,
id, ns, &idx_list, p, nthreads]()
1330 for (
unsigned s =
id; s < ns; s += nthreads)
1331 std::stable_sort(bne + idx_list[s],
1332 bne + idx_list[s+1], p);
1340 std::swap(
edges_, new_edges);
1351 template<
bool Stable = false,
class Predicate = std::less<edge_storage_t>>
1353 const std::vector<bool>* to_sort_ptr =
nullptr)
1355 SPOT_ASSERT((to_sort_ptr ==
nullptr)
1359 auto pi = [&](
unsigned t1,
unsigned t2)
1364 std::vector<unsigned> sort_idx_;
1366 for (
unsigned i = 0; i < ns; ++i)
1368 if (to_sort_ptr && !(*to_sort_ptr)[i])
1376 sort_idx_.push_back(t);
1379 if constexpr (Stable)
1380 std::stable_sort(sort_idx_.begin(), sort_idx_.end(), pi);
1382 std::sort(sort_idx_.begin(), sort_idx_.end(), pi);
1384 states_[i].succ = sort_idx_.front();
1385 states_[i].succ_tail = sort_idx_.back();
1386 const unsigned n_outs_n1 = sort_idx_.size() - 1;
1387 for (
unsigned k = 0; k < n_outs_n1; ++k)
1388 edges_[sort_idx_[k]].next_succ = sort_idx_[k+1];
1389 edges_[sort_idx_.back()].next_succ = 0;
1400 state last_src = -1U;
1402 for (
edge t = 1; t < tend; ++t)
1405 if (src != last_src)
1408 if (last_src != -1U)
1410 states_[last_src].succ_tail = t - 1;
1411 edges_[t - 1].next_succ = 0;
1413 while (++last_src != src)
1416 states_[last_src].succ_tail = 0;
1421 edges_[t - 1].next_succ = t;
1424 if (last_src != -1U)
1426 states_[last_src].succ_tail = tend - 1;
1427 edges_[tend - 1].next_succ = 0;
1429 unsigned send =
states_.size();
1430 while (++last_src != send)
1433 states_[last_src].succ_tail = 0;
1446 SPOT_ASSERT(newst.size() ==
states_.size());
1447 unsigned tend =
edges_.size();
1448 for (
unsigned t = 1; t < tend; t++)
1473 SPOT_ASSERT(newst.size() >=
states_.size());
1474 SPOT_ASSERT(used_states > 0);
1482 unsigned send =
states_.size();
1483 for (
state s = used_states; s < send; ++s)
1490 std::swap(t,
edges_[t].next_succ);
1502 unsigned tend =
edges_.size();
1503 std::vector<edge> newidx(tend);
1505 for (
edge t = 1; t < tend; ++t)
1518 for (
edge t = 1; t < dest; ++t)
1521 tr.src = newst[tr.src];
1522 tr.dst = newst[tr.dst];
1523 tr.next_succ = newidx[tr.next_succ];
1529 s.succ = newidx[s.succ];
1530 s.succ_tail = newidx[s.succ_tail];
1538 SPOT_DEPRECATED(
"use reference version of this method")
A directed graph.
Definition graph.hh:605
unsigned num_states() const
The number of states in the automaton.
Definition graph.hh:670
const dests_vector_t & dests_vector() const
The vector used to store universal destinations.
Definition graph.hh:1039
void dump_storage_as_dot(std::ostream &o, int dsi=DSI_All) const
Dump the state and edge storage for debugging.
Definition graph.hh:1112
internal::distate_storage< edge, internal::boxed_label< State_Data > > state_storage_t
State storage type.
Definition graph.hh:628
bool is_dead_edge(const edge_storage_t &t) const
Test whether an edge has been erased.
Definition graph.hh:1028
void dump_storage(std::ostream &o) const
Dump the state and edge storage for debugging.
Definition graph.hh:1051
internal::state_out< digraph > out(state_storage_t &src)
Return a fake container with all edges leaving src.
Definition graph.hh:922
internal::all_trans< digraph > edges()
Return a fake container with all edges (excluding erased edges)
Definition graph.hh:980
dests_vector_t & dests_vector()
The vector used to store universal destinations.
Definition graph.hh:1044
void sort_edges_of_(Predicate p=Predicate(), const std::vector< bool > *to_sort_ptr=nullptr)
Sort edges of the given states.
Definition graph.hh:1352
state new_states(unsigned n, Args &&... args)
Create n new states.
Definition graph.hh:709
state new_state(Args &&... args)
Create a new state.
Definition graph.hh:695
edge index_of_edge(const edge_storage_t &tt) const
Convert a storage reference into an edge number.
Definition graph.hh:907
dump_storage_items
Flags controlling dump_storage() output.
Definition graph.hh:1092
const edge_vector_t & edge_vector() const
Return the vector of all edges.
Definition graph.hh:994
internal::killer_edge_iterator< digraph > out_iteraser(state src)
Return a fake container with all edges leaving src, allowing erasure.
Definition graph.hh:951
dests_vector_t dests_
Used by alternating automata.
Definition graph.hh:646
bool is_valid_edge(edge t) const
Test whether the given edge is valid.
Definition graph.hh:1011
internal::state_out< digraph > out(state src)
Return a fake container with all edges leaving src.
Definition graph.hh:916
std::vector< edge_storage_t > edge_vector_t
Vector of edge storage.
Definition graph.hh:636
internal::state_out< const digraph > out(state_storage_t &src) const
Return a fake container with all edges leaving src.
Definition graph.hh:934
void sort_edges_srcfirst_(Predicate p=Predicate(), parallel_policy ppolicy=parallel_policy())
Sort all edges by src first, then, within edges of the same source, use the predicate.
Definition graph.hh:1282
unsigned edge
Edge number type.
Definition graph.hh:623
edge new_univ_edge(state src, const std::initializer_list< state > &dsts, Args &&... args)
Create a new universal edge.
Definition graph.hh:869
bool is_existential() const
Whether the automaton uses only existential branching.
Definition graph.hh:684
edge_vector_t & edge_vector()
Return the vector of all edges.
Definition graph.hh:999
const state_storage_t::data_t & state_data(state s) const
Return the State_Data associated to a state.
Definition graph.hh:748
internal::edge_iterator< const digraph > const_iterator
Const iterator over edges of a digraph.
Definition graph.hh:614
internal::state_out< const digraph > out(state src) const
Return a fake container with all edges leaving src.
Definition graph.hh:928
state_storage_t::data_t & state_data(state s)
Return the State_Data associated to a state.
Definition graph.hh:742
state_vector states_
State storage.
Definition graph.hh:644
void remove_dead_edges_()
Remove all dead edges.
Definition graph.hh:1247
digraph(unsigned max_states=10, unsigned max_trans=0)
Construct an empty graph.
Definition graph.hh:655
state new_univ_dests(I dst_begin, I dst_end)
Create a new universal destination group.
Definition graph.hh:821
internal::const_universal_dests univ_dests(state src) const
Return universal destinations for state src.
Definition graph.hh:877
const edge_storage_t::data_t & edge_data(edge s) const
Return the Edge_Data of an edge.
Definition graph.hh:784
unsigned killed_edge_
Number of erased edges.
Definition graph.hh:647
edge_storage_t & edge_storage(edge s)
Return a reference to the storage of an edge.
Definition graph.hh:760
void rename_states_(const std::vector< unsigned > &newst)
Rename all the states in the edge vector.
Definition graph.hh:1444
void defrag_states(const std::vector< unsigned > &newst, unsigned used_states)
Rename and remove states.
Definition graph.hh:1471
internal::killer_edge_iterator< digraph > out_iteraser(state_storage_t &src)
Return a fake container with all edges leaving src, allowing erasure.
Definition graph.hh:945
const state_vector & states() const
Return the vector of states.
Definition graph.hh:960
Edge_Data edge_data_t
Edge data type.
Definition graph.hh:618
internal::all_trans< const digraph > edges() const
Return a fake container with all edges (excluding erased edges)
Definition graph.hh:975
State_Data state_data_t
State data type.
Definition graph.hh:617
internal::const_universal_dests univ_dests(const edge_storage_t &e) const
Return universal destinations for edge e.
Definition graph.hh:894
unsigned num_edges() const
The number of edges in the automaton.
Definition graph.hh:678
std::vector< unsigned > dests_vector_t
Vector of universal destinations.
Definition graph.hh:641
edge_storage_t::data_t & edge_data(edge s)
Return the Edge_Data of an edge.
Definition graph.hh:778
internal::edge_iterator< digraph > iterator
Iterator over edges of a digraph.
Definition graph.hh:612
state_storage_t & state_storage(state s)
Return a reference to the storage of a state.
Definition graph.hh:724
std::vector< state_storage_t > state_vector
Vector of state storage.
Definition graph.hh:634
state index_of_state(const state_storage_t &ss) const
Convert a storage reference into a state number.
Definition graph.hh:900
void sort_edges_(Predicate p=Predicate())
Sort all edges according to a predicate.
Definition graph.hh:1265
bool is_dead_edge(unsigned t) const
Test whether an edge has been erased.
Definition graph.hh:1023
internal::edge_storage< state, state, edge, internal::boxed_label< Edge_Data > > edge_storage_t
Edge storage type.
Definition graph.hh:632
edge new_univ_edge(state src, I dst_begin, I dst_end, Args &&... args)
Create a new universal edge.
Definition graph.hh:856
void chain_edges_()
Reconstruct the chain of outgoing edges.
Definition graph.hh:1398
edge_vector_t edges_
Edge storage.
Definition graph.hh:645
unsigned state
State number type.
Definition graph.hh:622
const edge_storage_t & edge_storage(edge s) const
Return a reference to the storage of an edge.
Definition graph.hh:766
edge new_edge(state src, state dst, Args &&... args)
Create a new edge.
Definition graph.hh:797
state_vector & states()
Return the vector of states.
Definition graph.hh:965
const state_storage_t & state_storage(state s) const
Return a reference to the storage of a state.
Definition graph.hh:730
This class is used to tell parallel algorithms what resources they may use.
Definition common.hh:157
Abstract class for states.
Definition twa.hh:49
Definition automata.hh:26
constexpr bool operator==(trival a, trival b)
Equality comparison of two trival values.
Definition trival.hh:134
constexpr bool operator!=(trival a, trival b)
Inequality comparison of two trival values.
Definition trival.hh:140