21#include <spot/misc/hash.hh>
22#include <spot/twa/twa.hh>
84 const state* out_s,
int out,
154 const state* out_s,
int out,
195 virtual void pop()
override;
Abstract class for states.
Definition twa.hh:49
An implementation of spot::twa_reachable_iterator that browses states breadth first.
Definition reachiter.hh:98
virtual void add_state(const state *s) override
Called by run() to obtain the next state to process.
twa_reachable_iterator_breadth_first(const const_twa_ptr &a)
Construct a breadth-first iterator.
virtual const state * next_state() override
Called by run() to obtain the next state to process.
std::deque< const state * > todo
A queue of states yet to explore.
Definition reachiter.hh:107
Iterate over all states of an automaton using a DFS.
Definition reachiter.hh:184
std::unordered_set< int > stack_
DFS stack of pending states.
Definition reachiter.hh:197
virtual void pop() override
Pop the DFS stack.
bool on_stack(int sn) const
Whether state sn is on the DFS stack.
twa_reachable_iterator_depth_first_stack(const const_twa_ptr &a)
Construct a depth-first iterator that exposes its stack.
virtual void push(const state *s, int sn) override
Push a new state in todo.
Iterate over all states of an automaton using a DFS.
Definition reachiter.hh:113
virtual void push(const state *s, int sn)
Push a new state in todo.
virtual void pop()
Pop the DFS stack.
virtual void run()
Iterate over all reachable states of a spot::tgba.
virtual void process_state(const state *s, int n, twa_succ_iterator *si)
virtual bool want_state(const state *s) const
virtual void process_link(const state *in_s, int in, const state *out_s, int out, const twa_succ_iterator *si)
twa_reachable_iterator_depth_first(const const_twa_ptr &a)
Construct a depth-first iterator.
virtual void end()
Called by run() once all states have been explored.
const_twa_ptr aut_
The spot::tgba to explore.
Definition reachiter.hh:158
state_map< int > seen
Definition reachiter.hh:160
std::deque< stack_item > todo
the DFS stack
Definition reachiter.hh:169
virtual void start()
Called by run() before starting its iteration.
Iterate over all reachable states of a spot::tgba.
Definition reachiter.hh:31
state_map< int > seen
States already seen.
Definition reachiter.hh:90
virtual void process_state(const state *s, int n, twa_succ_iterator *si)
virtual void process_link(const state *in_s, int in, const state *out_s, int out, const twa_succ_iterator *si)
virtual void add_state(const state *s)=0
Called by run() to obtain the next state to process.
virtual void end()
Called by run() once all states have been explored.
virtual void run()
Iterate over all reachable states of a spot::tgba.
virtual void start()
Called by run() before starting its iteration.
virtual bool want_state(const state *s) const
twa_reachable_iterator(const const_twa_ptr &a)
Construct an iterator over reachable states.
const_twa_ptr aut_
The spot::tgba to explore.
Definition reachiter.hh:88
virtual const state * next_state()=0
Called by run() to obtain the next state to process.
Iterate over the successors of a state.
Definition twa.hh:425
std::shared_ptr< const twa > const_twa_ptr
Shared pointer to a const twa.
Definition fwd.hh:36
Definition automata.hh:26
std::unordered_map< const state *, val, state_ptr_hash, state_ptr_equal > state_map
Unordered map of abstract states.
Definition twa.hh:204
DFS stack entry holding a state, its DFS number, and its active successor iterator.
Definition reachiter.hh:164
const state * src
Source state (as a const_state*).
Definition reachiter.hh:165
twa_succ_iterator * it
Iterator over successors of src.
Definition reachiter.hh:167
int src_n
Source state index.
Definition reachiter.hh:166