[5f4d9c3] | 1 | #ifndef _SGRAPH_HH |
---|
| 2 | #define _SGRAPH_HH |
---|
| 3 | |
---|
| 4 | #include <stdio.h> |
---|
| 5 | |
---|
| 6 | #include <list> |
---|
| 7 | #include <vector> |
---|
| 8 | #include <bitset> |
---|
[3b02b04] | 9 | #include <stack> |
---|
[5f4d9c3] | 10 | |
---|
| 11 | #include "const.hh" |
---|
[e7de6cc] | 12 | #include "mgraph.hh" |
---|
[5f4d9c3] | 13 | #include "thesymbols.hh" |
---|
[e7de6cc] | 14 | #include "boubble.hh" |
---|
[5f4d9c3] | 15 | |
---|
| 16 | |
---|
[e7de6cc] | 17 | using namespace std; |
---|
[5f4d9c3] | 18 | |
---|
[e7de6cc] | 19 | //==================================================================================================== |
---|
| 20 | // CLASS Arc |
---|
| 21 | //==================================================================================================== |
---|
[5f4d9c3] | 22 | struct Arc |
---|
| 23 | { |
---|
| 24 | int dst; |
---|
| 25 | Role role; |
---|
[e7de6cc] | 26 | int headanc; |
---|
| 27 | int depanc; |
---|
[5f4d9c3] | 28 | |
---|
[e7de6cc] | 29 | Arc(int d, Role r, int ha, int da) : dst(d), role(r), headanc(ha), depanc(da) {}; |
---|
| 30 | }; |
---|
[5f4d9c3] | 31 | |
---|
[e7de6cc] | 32 | //==================================================================================================== |
---|
| 33 | // CLASS NodeProp |
---|
| 34 | //==================================================================================================== |
---|
[5f4d9c3] | 35 | |
---|
| 36 | struct NodeProp |
---|
| 37 | { |
---|
[e7de6cc] | 38 | NodeProp(); |
---|
| 39 | NodeProp(const NodeProp& p); |
---|
| 40 | ~NodeProp(); |
---|
| 41 | |
---|
| 42 | bool operator==(const NodeProp& p); |
---|
| 43 | NodeProp& operator=(const NodeProp& p); |
---|
| 44 | |
---|
| 45 | void clear_boubbles(); |
---|
| 46 | void merge_boubbles(list<Boubble*> new_boubbles); |
---|
[5f4d9c3] | 47 | |
---|
[e7de6cc] | 48 | void copy(const NodeProp& p); |
---|
| 49 | void clear(); |
---|
[5f4d9c3] | 50 | |
---|
[e7de6cc] | 51 | RoleSet required; |
---|
| 52 | RoleSet forbidden; |
---|
| 53 | RoleSet attached; |
---|
[5f4d9c3] | 54 | |
---|
[e7de6cc] | 55 | bool init_attached; |
---|
| 56 | bool fin_attached; |
---|
| 57 | |
---|
| 58 | FlagSet flags; |
---|
| 59 | |
---|
| 60 | list<Boubble*> boubbles; |
---|
[5f4d9c3] | 61 | }; |
---|
| 62 | |
---|
[e7de6cc] | 63 | //---------------------------------------------------------------------------------------------------- |
---|
| 64 | |
---|
| 65 | inline |
---|
| 66 | bool NodeProp::operator==(const NodeProp& p) |
---|
| 67 | { |
---|
| 68 | if(required != p.required) return false; |
---|
| 69 | if(forbidden != p.forbidden) return false; |
---|
| 70 | if(attached != p.attached) return false; |
---|
| 71 | if(flags != p.flags) return false; |
---|
| 72 | if(init_attached != p.init_attached) return false; |
---|
| 73 | if(fin_attached != p.fin_attached) return false; |
---|
[3b02b04] | 74 | |
---|
| 75 | list<Boubble*>::const_iterator b,b1; |
---|
| 76 | for(b=boubbles.begin(), b1=p.boubbles.begin(); b != boubbles.end() && b1 != p.boubbles.end(); b++,b1++) |
---|
| 77 | if(!(**b == **b1)) |
---|
| 78 | return false; |
---|
| 79 | if(b != boubbles.end() || b1 != p.boubbles.end()) |
---|
[e7de6cc] | 80 | return false; |
---|
[3b02b04] | 81 | |
---|
[e7de6cc] | 82 | return true; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | //---------------------------------------------------------------------------------------------------- |
---|
| 86 | |
---|
| 87 | inline |
---|
| 88 | void NodeProp::clear_boubbles() |
---|
| 89 | { |
---|
| 90 | for(list<Boubble*>::iterator b = boubbles.begin(); b!=boubbles.end(); b++) |
---|
| 91 | delete *b; |
---|
| 92 | boubbles.clear(); |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | //---------------------------------------------------------------------------------------------------- |
---|
| 96 | |
---|
| 97 | inline |
---|
| 98 | void NodeProp::merge_boubbles(list<Boubble*> new_boubbles) |
---|
| 99 | { |
---|
| 100 | boubbles.merge(new_boubbles); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | //---------------------------------------------------------------------------------------------------- |
---|
| 104 | |
---|
| 105 | inline |
---|
| 106 | void NodeProp::copy(const NodeProp& p) |
---|
| 107 | { |
---|
| 108 | required=p.required; |
---|
| 109 | forbidden=p.forbidden; |
---|
| 110 | attached=p.attached; |
---|
| 111 | flags=p.flags; |
---|
| 112 | init_attached=p.init_attached; |
---|
| 113 | fin_attached=p.fin_attached; |
---|
| 114 | for(list<Boubble*>::const_iterator b = p.boubbles.begin(); b!=p.boubbles.end(); b++) |
---|
| 115 | boubbles.push_back(new Boubble(**b)); |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | //---------------------------------------------------------------------------------------------------- |
---|
| 119 | |
---|
| 120 | inline |
---|
| 121 | NodeProp::~NodeProp() |
---|
| 122 | { |
---|
| 123 | clear_boubbles(); |
---|
| 124 | } |
---|
| 125 | //---------------------------------------------------------------------------------------------------- |
---|
| 126 | |
---|
| 127 | inline |
---|
| 128 | NodeProp::NodeProp() |
---|
| 129 | { |
---|
| 130 | clear(); |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | //---------------------------------------------------------------------------------------------------- |
---|
| 134 | |
---|
| 135 | inline |
---|
| 136 | NodeProp::NodeProp(const NodeProp& p) |
---|
| 137 | { |
---|
| 138 | copy(p); |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | //---------------------------------------------------------------------------------------------------- |
---|
| 142 | |
---|
| 143 | inline |
---|
| 144 | NodeProp& NodeProp::operator=(const NodeProp& p) |
---|
| 145 | { |
---|
| 146 | clear(); |
---|
| 147 | copy(p); |
---|
| 148 | return *this; |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | //---------------------------------------------------------------------------------------------------- |
---|
| 152 | |
---|
| 153 | inline |
---|
| 154 | void NodeProp::clear() |
---|
| 155 | { |
---|
| 156 | required.reset(); |
---|
| 157 | forbidden.reset(); |
---|
| 158 | attached.reset(); |
---|
| 159 | init_attached=false; |
---|
| 160 | fin_attached=false; |
---|
| 161 | clear_boubbles(); |
---|
| 162 | } |
---|
| 163 | |
---|
| 164 | //==================================================================================================== |
---|
| 165 | // CLASS SNode |
---|
| 166 | //==================================================================================================== |
---|
[5f4d9c3] | 167 | |
---|
| 168 | struct SNode |
---|
| 169 | { |
---|
| 170 | |
---|
[3b02b04] | 171 | SNode() { visible_as_neighbour = true; } |
---|
| 172 | |
---|
[e7de6cc] | 173 | int mnode; |
---|
[5f4d9c3] | 174 | |
---|
| 175 | NodeProp prop; |
---|
| 176 | |
---|
[3b02b04] | 177 | vector<int> edge; |
---|
| 178 | bool edge_contains_self; |
---|
| 179 | bool visible_as_neighbour; |
---|
| 180 | |
---|
[5f4d9c3] | 181 | bitset<MAXNODES> LV; |
---|
| 182 | bitset<MAXNODES> LH; |
---|
| 183 | bitset<MAXNODES> LD; |
---|
| 184 | bool in_LH; |
---|
| 185 | |
---|
| 186 | vector<Arc> heads; |
---|
| 187 | vector<Arc> deps; |
---|
| 188 | |
---|
[e7de6cc] | 189 | void clear(); |
---|
| 190 | bool saturated(); |
---|
[5f4d9c3] | 191 | }; |
---|
| 192 | |
---|
[e7de6cc] | 193 | //---------------------------------------------------------------------------------------------------- |
---|
| 194 | inline |
---|
| 195 | void SNode::clear() |
---|
| 196 | { prop.clear(), LV.reset(), LD.reset(), LH.reset(), heads.clear(), deps.clear(); } |
---|
| 197 | //---------------------------------------------------------------------------------------------------- |
---|
| 198 | inline |
---|
| 199 | bool SNode::saturated() |
---|
| 200 | { return prop.required.none(); } |
---|
[5f4d9c3] | 201 | |
---|
[e7de6cc] | 202 | //==================================================================================================== |
---|
| 203 | // SGraph CLASS |
---|
| 204 | //==================================================================================================== |
---|
[5f4d9c3] | 205 | |
---|
| 206 | class SGraph |
---|
| 207 | { |
---|
| 208 | public: |
---|
| 209 | |
---|
[e7de6cc] | 210 | enum Output { HEADS=1, DEPS=2, SETS=4, CONSTRAINTS=8, BOUBBLES=16 }; |
---|
[5f4d9c3] | 211 | |
---|
[e7de6cc] | 212 | SGraph(MGraph& mg) : mgraph(mg) { clear(); } |
---|
[5f4d9c3] | 213 | |
---|
[e7de6cc] | 214 | SNode& operator[](const int i) { return nodes[i]; } |
---|
[5f4d9c3] | 215 | |
---|
[e7de6cc] | 216 | void clear() { nodes.clear(); } |
---|
| 217 | int add_base_snode(int mnodeind); |
---|
| 218 | int clone(int ancind, NodeProp newprop); |
---|
[5f4d9c3] | 219 | void update_left(int headind, int depind); |
---|
| 220 | void update_right(int headind, int depind); |
---|
| 221 | bool visible(int left, int right); |
---|
| 222 | bool saturated(int node); |
---|
| 223 | |
---|
[e7de6cc] | 224 | Cat cat(int i) const { return mgraph[nodes[i].mnode].cat; } |
---|
| 225 | char* form(int i) const { return mgraph[nodes[i].mnode].form; } |
---|
[5f4d9c3] | 226 | |
---|
| 227 | int print_node(FILE* f, int n, unsigned int info); |
---|
[e7de6cc] | 228 | int print_node_debug(FILE* f, const char* pref, int n, int anc); |
---|
[5f4d9c3] | 229 | |
---|
| 230 | void print_arc(FILE* f, int left, int right, Role role, int dir); // 0 - left, 1 - right |
---|
| 231 | |
---|
[e7de6cc] | 232 | //private: |
---|
| 233 | |
---|
| 234 | int size() {return nodes.size(); } |
---|
| 235 | |
---|
[3b02b04] | 236 | friend class LViterator; |
---|
| 237 | friend class LHiterator; |
---|
| 238 | friend class LDiterator; |
---|
| 239 | friend class LNiterator; |
---|
| 240 | |
---|
[e7de6cc] | 241 | private: |
---|
| 242 | |
---|
| 243 | MGraph& mgraph; |
---|
| 244 | |
---|
| 245 | vector<SNode> nodes; |
---|
| 246 | |
---|
| 247 | int lastnodeind() { return nodes.size()-1; } |
---|
| 248 | SNode& makenewnode() { nodes.push_back(SNode()); nodes.back().clear(); return nodes.back(); } |
---|
| 249 | |
---|
| 250 | int sprint_node(char* buf, int n, int anc, unsigned int info); |
---|
| 251 | int sprint_node_debug(char* buf, const char* pref, int n, int anc); |
---|
[5f4d9c3] | 252 | }; |
---|
| 253 | |
---|
[e7de6cc] | 254 | //---------------------------------------------------------------------------------------------------- |
---|
[5f4d9c3] | 255 | |
---|
| 256 | inline bool SGraph::visible(int left, int right) |
---|
| 257 | { |
---|
| 258 | return nodes[right].LV[left]; |
---|
| 259 | } |
---|
| 260 | |
---|
[e7de6cc] | 261 | //---------------------------------------------------------------------------------------------------- |
---|
| 262 | |
---|
[5f4d9c3] | 263 | inline bool SGraph::saturated(int node) |
---|
| 264 | { |
---|
| 265 | return nodes[node].saturated(); |
---|
| 266 | } |
---|
| 267 | |
---|
[e7de6cc] | 268 | //---------------------------------------------------------------------------------------------------- |
---|
[3b02b04] | 269 | //---------------------------------------------------------------------------------------------------- |
---|
| 270 | |
---|
| 271 | class XXiterator |
---|
| 272 | { |
---|
| 273 | protected: |
---|
| 274 | |
---|
| 275 | bool checked(int i) { return _checked[i]; } |
---|
| 276 | void check(int i) { _checked.set(i); } |
---|
| 277 | |
---|
| 278 | void push(stack<int>& s, int i) |
---|
| 279 | { |
---|
| 280 | if(!checked(i)) |
---|
| 281 | { |
---|
| 282 | s.push(i); |
---|
| 283 | check(i); |
---|
| 284 | } |
---|
| 285 | } |
---|
| 286 | |
---|
| 287 | bitset<MAXNODES> _checked; |
---|
| 288 | }; |
---|
| 289 | |
---|
| 290 | //---------------------------------------------------------------------------------------------------- |
---|
| 291 | //---------------------------------------------------------------------------------------------------- |
---|
| 292 | |
---|
| 293 | class LViterator : public XXiterator |
---|
| 294 | { |
---|
| 295 | public: |
---|
| 296 | LViterator(SGraph& sg, int n, bool s); |
---|
| 297 | int next(); |
---|
| 298 | |
---|
| 299 | private: |
---|
| 300 | |
---|
| 301 | SGraph& sgraph; |
---|
| 302 | MGraph& mgraph; |
---|
| 303 | stack<int> waydown; |
---|
| 304 | stack<int> wayup; |
---|
| 305 | bool strict; |
---|
| 306 | |
---|
| 307 | void push_ld(int i); |
---|
| 308 | void push_lh(int i); |
---|
| 309 | void push_ln(int i); |
---|
| 310 | }; |
---|
| 311 | |
---|
| 312 | inline LViterator::LViterator(SGraph& sg, int n, bool s=true) : sgraph(sg), mgraph(sg.mgraph), strict(s) |
---|
| 313 | { |
---|
| 314 | if(sg[n].edge_contains_self) // TO DODAÆ PO PRZEJŠCIU NA EDGE_CONTAINS_SELF |
---|
| 315 | { |
---|
| 316 | push_ld(n); |
---|
| 317 | push_ln(n); |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | for(vector<int>::iterator i=sg[n].edge.begin(); i!=sg[n].edge.end(); ++i) |
---|
| 321 | { |
---|
| 322 | if(*i != n) |
---|
| 323 | { |
---|
| 324 | push_ld(*i); |
---|
| 325 | push_ln(*i); |
---|
| 326 | } |
---|
| 327 | |
---|
| 328 | } |
---|
| 329 | // if(!strict) |
---|
| 330 | // { |
---|
| 331 | // push_ld(n); |
---|
| 332 | // push_ln(n); |
---|
| 333 | // } |
---|
| 334 | } |
---|
| 335 | |
---|
| 336 | inline int LViterator::next() |
---|
| 337 | { |
---|
| 338 | if(wayup.empty()) |
---|
| 339 | { |
---|
| 340 | if(waydown.empty()) |
---|
| 341 | return -1; // |
---|
| 342 | else |
---|
| 343 | { |
---|
| 344 | int k = waydown.top(); |
---|
| 345 | waydown.pop(); |
---|
| 346 | push_ld(k); |
---|
| 347 | push_ln(k); |
---|
| 348 | if(wayup.empty()) |
---|
| 349 | return -1; // k NIE MA POPRZEDNIKÓW, NIE MO¯E TE¯ ZATEM MIEÆ LEWOSTRONNYCH PODRZÊDNIKÓW |
---|
| 350 | else |
---|
| 351 | { |
---|
| 352 | int i = wayup.top(); |
---|
| 353 | wayup.pop(); |
---|
| 354 | push_lh(i); |
---|
| 355 | return i; |
---|
| 356 | } |
---|
| 357 | } |
---|
| 358 | |
---|
| 359 | } |
---|
| 360 | else |
---|
| 361 | { |
---|
| 362 | int i = wayup.top(); |
---|
| 363 | wayup.pop(); |
---|
| 364 | push_lh(i); |
---|
| 365 | return i; |
---|
| 366 | }; |
---|
| 367 | } |
---|
| 368 | |
---|
| 369 | inline void LViterator::push_ld(int i) |
---|
| 370 | { |
---|
| 371 | vector<Arc>& arcs = sgraph[i].deps; |
---|
| 372 | for(vector<Arc>::iterator a = arcs.begin(); a != arcs.end(); ++a) |
---|
| 373 | if(mgraph[sgraph[a->dst].mnode].pos < mgraph[sgraph[i].mnode].pos) |
---|
| 374 | push(waydown,a->dst); |
---|
| 375 | } |
---|
| 376 | |
---|
| 377 | inline void LViterator::push_lh(int i) |
---|
| 378 | { |
---|
| 379 | vector<Arc>& arcs = sgraph[i].heads; |
---|
| 380 | for(vector<Arc>::iterator a = arcs.begin(); a != arcs.end(); ++a) |
---|
| 381 | if(mgraph[sgraph[a->dst].mnode].pos < mgraph[sgraph[i].mnode].pos) |
---|
| 382 | push(wayup,a->dst); |
---|
| 383 | } |
---|
| 384 | |
---|
| 385 | inline void LViterator::push_ln(int i) |
---|
| 386 | { |
---|
| 387 | vector<int>& mpredecessors = mgraph[sgraph[i].mnode].pred; |
---|
| 388 | for(vector<int>::iterator mp = mpredecessors.begin(); mp != mpredecessors.end(); ++mp) // poprzedniki w mgraph |
---|
| 389 | { |
---|
| 390 | vector<int>& spredecessors = mgraph[*mp].snodes; |
---|
| 391 | for(vector<int>::iterator sp = spredecessors.begin(); sp != spredecessors.end(); ++sp ) |
---|
| 392 | if(sgraph[*sp].visible_as_neighbour || !strict) |
---|
| 393 | push(wayup,*sp); |
---|
| 394 | } |
---|
| 395 | } |
---|
| 396 | |
---|
| 397 | |
---|
| 398 | //---------------------------------------------------------------------------------------------------- |
---|
| 399 | //---------------------------------------------------------------------------------------------------- |
---|
| 400 | |
---|
| 401 | class LNiterator |
---|
| 402 | { |
---|
| 403 | public: |
---|
| 404 | LNiterator(SGraph& sg, int n); |
---|
| 405 | |
---|
| 406 | int next(); |
---|
| 407 | |
---|
| 408 | private: |
---|
| 409 | |
---|
| 410 | SGraph& sgraph; |
---|
| 411 | MGraph& mgraph; |
---|
| 412 | int thenode; |
---|
| 413 | stack<int> wayup; |
---|
| 414 | |
---|
| 415 | void push_ln(int i); |
---|
| 416 | }; |
---|
| 417 | |
---|
| 418 | inline LNiterator::LNiterator(SGraph& sg, int n) : sgraph(sg), mgraph(sg.mgraph), thenode(n) |
---|
| 419 | { |
---|
| 420 | push_ln(n); |
---|
| 421 | } |
---|
| 422 | |
---|
| 423 | inline int LNiterator::next() |
---|
| 424 | { |
---|
| 425 | if(wayup.empty()) |
---|
| 426 | return -1; |
---|
| 427 | else |
---|
| 428 | { |
---|
| 429 | int i = wayup.top(); |
---|
| 430 | wayup.pop(); |
---|
| 431 | return i; |
---|
| 432 | }; |
---|
| 433 | } |
---|
| 434 | |
---|
| 435 | inline void LNiterator::push_ln(int i) |
---|
| 436 | { |
---|
| 437 | vector<int>& mpredecessors = mgraph[sgraph[i].mnode].pred; |
---|
| 438 | for(vector<int>::iterator mp = mpredecessors.begin(); mp != mpredecessors.end(); ++mp) // poprzedniki w mgraph |
---|
| 439 | { |
---|
| 440 | vector<int>& spredecessors = mgraph[*mp].snodes; |
---|
| 441 | for(vector<int>::iterator sp = spredecessors.begin(); sp != spredecessors.end(); ++sp ) |
---|
| 442 | wayup.push(*sp); |
---|
| 443 | } |
---|
| 444 | } |
---|
| 445 | |
---|
| 446 | |
---|
| 447 | //---------------------------------------------------------------------------------------------------- |
---|
| 448 | //---------------------------------------------------------------------------------------------------- |
---|
| 449 | |
---|
| 450 | class LHiterator |
---|
| 451 | { |
---|
| 452 | public: |
---|
| 453 | LHiterator(SGraph& sg, int n); |
---|
| 454 | |
---|
| 455 | int next(); |
---|
| 456 | |
---|
| 457 | private: |
---|
| 458 | |
---|
| 459 | SGraph& sgraph; |
---|
| 460 | MGraph& mgraph; |
---|
| 461 | stack<int> wayup; |
---|
| 462 | |
---|
| 463 | void push_lh(int i); |
---|
| 464 | }; |
---|
| 465 | |
---|
| 466 | inline LHiterator::LHiterator(SGraph& sg, int n) : sgraph(sg), mgraph(sg.mgraph) |
---|
| 467 | { |
---|
| 468 | push_lh(n); |
---|
| 469 | } |
---|
| 470 | |
---|
| 471 | inline int LHiterator::next() |
---|
| 472 | { |
---|
| 473 | if(wayup.empty()) |
---|
| 474 | return -1; |
---|
| 475 | else |
---|
| 476 | { |
---|
| 477 | int i = wayup.top(); |
---|
| 478 | wayup.pop(); |
---|
| 479 | push_lh(i); |
---|
| 480 | return i; |
---|
| 481 | }; |
---|
| 482 | } |
---|
| 483 | |
---|
| 484 | inline void LHiterator::push_lh(int i) |
---|
| 485 | { |
---|
| 486 | vector<Arc>& arcs = sgraph[i].heads; |
---|
| 487 | for(vector<Arc>::iterator a = arcs.begin(); a != arcs.end(); ++a) |
---|
| 488 | if(mgraph[sgraph[a->dst].mnode].pos < mgraph[sgraph[i].mnode].pos) |
---|
| 489 | wayup.push(a->dst); |
---|
| 490 | } |
---|
| 491 | |
---|
| 492 | //---------------------------------------------------------------------------------------------------- |
---|
| 493 | //---------------------------------------------------------------------------------------------------- |
---|
| 494 | |
---|
| 495 | class LDiterator |
---|
| 496 | { |
---|
| 497 | public: |
---|
| 498 | LDiterator(SGraph& sg, int n); |
---|
| 499 | |
---|
| 500 | int next(); |
---|
| 501 | |
---|
| 502 | private: |
---|
| 503 | |
---|
| 504 | SGraph& sgraph; |
---|
| 505 | MGraph& mgraph; |
---|
| 506 | int thenode; |
---|
| 507 | stack<int> waydown; |
---|
| 508 | |
---|
| 509 | void push_ld(int i); |
---|
| 510 | }; |
---|
| 511 | |
---|
| 512 | inline LDiterator::LDiterator(SGraph& sg, int n) : sgraph(sg), mgraph(sg.mgraph), thenode(n) |
---|
| 513 | { |
---|
| 514 | push_ld(n); |
---|
| 515 | } |
---|
| 516 | |
---|
| 517 | inline int LDiterator::next() |
---|
| 518 | { |
---|
| 519 | if(waydown.empty()) |
---|
| 520 | return -1; |
---|
| 521 | else |
---|
| 522 | { |
---|
| 523 | int k = waydown.top(); |
---|
| 524 | waydown.pop(); |
---|
| 525 | push_ld(k); |
---|
| 526 | return k; |
---|
| 527 | } |
---|
| 528 | } |
---|
| 529 | |
---|
| 530 | inline void LDiterator::push_ld(int i) |
---|
| 531 | { |
---|
| 532 | vector<Arc>& arcs = sgraph[i].deps; |
---|
| 533 | for(vector<Arc>::iterator a = arcs.begin(); a != arcs.end(); ++a) |
---|
| 534 | if(mgraph[sgraph[a->dst].mnode].pos < mgraph[sgraph[thenode].mnode].pos) |
---|
| 535 | waydown.push(a->dst); |
---|
| 536 | } |
---|
| 537 | |
---|
| 538 | |
---|
[e7de6cc] | 539 | |
---|
[5f4d9c3] | 540 | #endif |
---|