| 227 | } |
| 228 | |
| 229 | static void BackwardDFS(GraphCycles::Rep* r, int32 n, int32 lower_bound) { |
| 230 | r->deltab_.clear(); |
| 231 | r->stack_.clear(); |
| 232 | r->stack_.push_back(n); |
| 233 | while (!r->stack_.empty()) { |
| 234 | n = r->stack_.back(); |
| 235 | r->stack_.pop_back(); |
| 236 | Node* nn = r->nodes_[n]; |
| 237 | if (nn->visited) continue; |
| 238 | |
| 239 | nn->visited = true; |
| 240 | r->deltab_.push_back(n); |
| 241 | |
| 242 | for (auto w : nn->in.GetSequence()) { |
| 243 | Node* nw = r->nodes_[w]; |
| 244 | if (!nw->visited && lower_bound < nw->rank) { |
| 245 | r->stack_.push_back(w); |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | static void Reorder(GraphCycles::Rep* r) { |
| 252 | Sort(r->nodes_, &r->deltab_); |
no test coverage detected