19 #ifndef SPOT_FASTTGBAALGOS_EC_LOWLINK_STACK_HH
20 # define SPOT_FASTTGBAALGOS_EC_LOWLINK_STACK_HH
25 #include "misc/hash.hh"
26 #include "union_find.hh"
27 #include "fasttgba/fasttgba.hh"
47 while (!stack_.empty())
55 virtual void push(
int lowlink)
58 stack_.push(std::make_pair(lowlink,
empty_));
64 return stack_.top().first;
71 assert(!stack_.empty());
72 return *stack_.top().second;
78 max_size_ = max_size_ > stack_.size()? max_size_ : stack_.size();
80 if (stack_.top().second !=
empty_)
81 delete stack_.top().second;
92 stack_.top().first = ll;
93 if (stack_.top().second !=
empty_)
94 delete stack_.top().second;
95 stack_.top().second =
new markset(m);
101 stack_.top().first = ll;
113 return stack_.size();
117 std::stack<std::pair<unsigned int, markset*>> stack_;
121 unsigned int max_size_;
148 while (!stack_.empty())
160 stack_.push({lowlink,
false, {0}});
161 else if (stack_.top().backedge_updated)
162 stack_.push({lowlink,
false, {0}});
165 assert(stack_.top().backedge_updated ==
false);
166 assert(stack_.top().range + 1 + stack_.top().lowlink == lowlink);
167 stack_.top().range = stack_.top().range + 1;
174 if (stack_.top().backedge_updated)
175 return stack_.top().lowlink;
177 return stack_.top().range + stack_.top().lowlink;
184 if (!stack_.top().backedge_updated)
186 return *stack_.top().mark;
194 if (stack_.top().backedge_updated)
196 if (stack_.top().mark != empty_)
197 delete stack_.top().mark;
201 else if (stack_.top().range == 0)
203 if (stack_.top().mark != empty_)
204 delete stack_.top().mark;
210 stack_.top().range = stack_.top().range - 1;
220 if (stack_.top().backedge_updated)
222 assert(ll <= stack_.top().lowlink);
224 stack_.top().mark = empty_;
226 stack_.top().mark =
new markset(m);
227 stack_.top().lowlink = ll;
232 if (stack_.top().range == 0)
235 stack_.top().mark = empty_;
237 stack_.top().mark =
new markset(m);
238 stack_.top().backedge_updated =
true;
239 stack_.top().lowlink = ll;
243 stack_.top().range = stack_.top().range -1;
244 stack_.push({ll,
true, {0}});
246 stack_.top().mark = empty_;
248 stack_.top().mark =
new markset(m);
257 set_top(ll, *empty_);
269 return stack_.size();
273 std::stack<ll_elt> stack_;
278 #endif // SPOT_FASTTGBAALGOS_EC_LOWLINK_STACK_HH
virtual int top()
Return the lowlink at the top of the stack.
Definition: lowlink_stack.hh:62
virtual unsigned int size()
Return the current size of the stack.
Definition: lowlink_stack.hh:267
bool backedge_updated
Wether it has been updated.
Definition: lowlink_stack.hh:133
virtual void push(int lowlink)
Insert a new lowlink into the stack.
Definition: lowlink_stack.hh:55
virtual ~compressed_stack_of_lowlink()
Clean the stack before desroying it.
Definition: lowlink_stack.hh:146
Definition: lowlink_stack.hh:130
virtual void set_top(int ll)
Usefull for SCC-computation.
Definition: lowlink_stack.hh:255
virtual void set_top(int ll)
Usefull for SCC-computation.
Definition: lowlink_stack.hh:99
virtual void set_top(int ll, markset m)
Definition: lowlink_stack.hh:217
virtual unsigned int max_size()
Return the peak of this stack.
Definition: lowlink_stack.hh:261
markset * mark
Markset otherwise.
Definition: lowlink_stack.hh:136
virtual unsigned int size()
Return the current size of the stack.
Definition: lowlink_stack.hh:111
virtual const markset & top_acceptance()
Modify the acceptance set at for the elemet at the top of the stack.
Definition: lowlink_stack.hh:69
virtual int pop()
pop the element at the top of the stack
Definition: lowlink_stack.hh:76
virtual ~stack_of_lowlink()
Clean the stack before desroying it.
Definition: lowlink_stack.hh:45
virtual int pop()
pop the element at the top of the stack
Definition: lowlink_stack.hh:190
int lowlink
The lowlink.
Definition: lowlink_stack.hh:132
markset * empty_
The empty markset.
Definition: lowlink_stack.hh:120
This class represents a set of acceptance marks.
Definition: markset.hh:35
virtual void push(int lowlink)
Insert a new lowlink into the stack.
Definition: lowlink_stack.hh:155
this class represents a compaction of the lowlink stack
Definition: lowlink_stack.hh:126
Definition: acc_dict.hh:31
virtual int top()
Return the lowlink at the top of the stack.
Definition: lowlink_stack.hh:172
Definition: lowlink_stack.hh:35
virtual unsigned int max_size()
Return the peak of this stack.
Definition: lowlink_stack.hh:105
virtual void set_top(int ll, markset m)
Definition: lowlink_stack.hh:89
int range
Range when backedge_updated is false.
Definition: lowlink_stack.hh:135
virtual const markset & top_acceptance()
Modify the acceptance set at for the elemet at the top of the stack.
Definition: lowlink_stack.hh:182