Changeset 3b02b04 for src/dgp/dgp1.cc
- Timestamp:
- 01/17/13 20:50:41 (12 years ago)
- Branches:
- master
- Children:
- d2f119e
- Parents:
- 555c7f8
- git-author:
- Tomasz Obrebski <to@…> (01/17/13 20:50:41)
- git-committer:
- Tomasz Obrebski <to@…> (01/17/13 20:50:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dgp/dgp1.cc
ra15e59b r3b02b04 10 10 list<int> nodelist; 11 11 list<int>::iterator processed; 12 13 14 void print_sets(int n); 15 12 16 13 17 //==================================================================================================== … … 44 48 ret.forbidden |= grammar.constr_exclude(link.role); 45 49 46 ret.boubbles =bs;50 ret.boubbles.merge(bs); //DOBRZE 47 51 ret.flags |= ( depflags & grammar.pass_flags(link.role) ); 48 52 … … 58 62 { 59 63 NodeProp ret=depprop; 60 ret.boubbles =bs;64 ret.boubbles.merge(bs); //DOBRZE 61 65 return ret; 62 66 } … … 67 71 { 68 72 MNode& mnode = mgraph[mnodeind]; 73 int ret=-1; 69 74 for(vector<int>::iterator ps=mnode.snodes.begin(); ps!=mnode.snodes.end(); ++ps) 70 if(sgraph[*ps].prop==p && sgraph[*ps].LH==newheadLH && sgraph[*ps].LV==newheadLV) return *ps; 71 return -1; 75 { 76 if(debug) fprintf(stderr,"#find existing node: checking %d ... \n", *ps); 77 if(sgraph[*ps].prop==p) 78 if(sgraph[*ps].LH==newheadLH && sgraph[*ps].LV==newheadLV) 79 { 80 ret = *ps; 81 // fprintf(stderr,"FIND EXISTING NODE SUCCEEDED BEACAUSE OF LH/LV equality ()\n"); 82 } 83 else 84 { 85 // fprintf(stderr,"FIND EXISTING NODE FAILED BEACAUSE OF LH/LV inequality\n"); 86 } 87 } 88 89 if(debug) fprintf(stderr,"\n"); 90 return ret; 72 91 } 73 92 … … 83 102 ret.push_back(new_boubble); 84 103 } 104 85 105 return ret; 86 106 } … … 120 140 //==================================================================================================== 121 141 122 int create_new_head_node_left(list<int>::iterator h, NodeProp& newheadprop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV) 123 { 124 int newheadind = sgraph.clone(*h,newheadprop); 125 list<int>::iterator nextit=h; ++nextit; 126 nodelist.insert(nextit,newheadind); 142 void copy_links(int i, int j) 143 { 144 sgraph[j].heads = sgraph[i].heads; 145 sgraph[j].deps = sgraph[i].deps; 146 } 147 148 149 void create_reverse_links(int n) 150 { 151 for(vector<Arc>::iterator a=sgraph[n].heads.begin(); a != sgraph[n].heads.end(); a++) 152 sgraph[a->dst].deps.push_back(Arc(n,a->role,a->headanc,a->depanc)); 153 154 for(vector<Arc>::iterator a=sgraph[n].deps.begin(); a != sgraph[n].deps.end(); a++) 155 sgraph[a->dst].heads.push_back(Arc(n,a->role,a->headanc,a->depanc)); 156 } 157 158 //==================================================================================================== 159 160 int create_new_head_node_left(int h, NodeProp& newheadprop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV) 161 { 162 int newheadind = sgraph.clone(h,newheadprop); 163 // list<int>::iterator nextit=h; ++nextit; 164 // nodelist.insert(nextit,newheadind); 165 nodelist.push_back(newheadind); 127 166 sgraph[newheadind].LH=newheadLH; 128 167 sgraph[newheadind].LD = newheadLD; 129 168 sgraph[newheadind].in_LH=true; 130 169 sgraph[newheadind].LV.reset(); 131 132 if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,*h); 133 170 171 copy_links(h,newheadind); 172 create_reverse_links(newheadind); 173 174 if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,h); 175 if(debug) print_sets(newheadind); 134 176 return newheadind; 135 177 } 136 178 137 int create_new_dep_node_left(list<int>::iterator d, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV) 138 { 139 int newind = sgraph.clone(*d,prop); 140 list<int>::iterator nextit=d; ++nextit; 141 nodelist.insert(nextit,newind); 179 int create_new_dep_node_left(int d, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV) 180 { 181 int newind = sgraph.clone(d,prop); 182 // list<int>::iterator nextit=d; ++nextit; 183 // nodelist.insert(nextit,newind); 184 nodelist.push_back(newind); 142 185 sgraph[newind].LH.reset(); 143 186 sgraph[newind].LD=LD; 144 187 sgraph[newind].in_LH=false; //??????? 145 188 sgraph[newind].LV.reset(); 146 147 if(debug) sgraph.print_node_debug(stderr,"C ",newind,*d); 189 190 copy_links(d,newind); 191 create_reverse_links(newind); 192 193 if(debug) sgraph.print_node_debug(stderr,"C ",newind,d); 194 if(debug) print_sets(newind); 148 195 149 196 return newind; 150 197 } 151 198 152 int create_new_head_node_right(list<int>::iterator h, NodeProp& newheadprop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV) 153 { 154 int newheadind = sgraph.clone(*h,newheadprop); 155 list<int>::iterator nextit=h; ++nextit; 156 nodelist.insert(nextit,newheadind); 199 int create_new_head_node_right(int h, NodeProp& newheadprop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV) 200 { 201 int newheadind = sgraph.clone(h,newheadprop); 202 // list<int>::iterator nextit=h; ++nextit; 203 // nodelist.insert(nextit,newheadind); 204 nodelist.push_back(newheadind); 157 205 sgraph[newheadind].LH=newheadLH; 158 206 sgraph[newheadind].LD=newheadLD; … … 160 208 sgraph[newheadind].LV=newheadLV; 161 209 162 if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,*h); 210 copy_links(h,newheadind); 211 create_reverse_links(newheadind); 212 213 if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,h); 214 if(debug) print_sets(newheadind); 163 215 164 216 return newheadind; 165 217 } 166 218 167 int create_new_dep_node_right(list<int>::iterator d, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV) 168 { 169 int newind = sgraph.clone(*d,prop); 170 list<int>::iterator nextit=d; ++nextit; 171 nodelist.insert(nextit,newind); 219 int create_new_dep_node_right(int d, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV) 220 { 221 int newind = sgraph.clone(d,prop); 222 nodelist.push_back(newind); 172 223 sgraph[newind].LH=LH; 173 224 sgraph[newind].LD=LD; … … 175 226 sgraph[newind].LV.reset(); 176 227 177 if(debug) sgraph.print_node_debug(stderr,"C ",newind,*d); 228 copy_links(d,newind); 229 create_reverse_links(newind); 230 231 if(debug) sgraph.print_node_debug(stderr,"C ",newind,d); 232 if(debug) print_sets(newind); 178 233 179 234 return newind; … … 182 237 //==================================================================================================== 183 238 184 void connect_left( list<int>::iterator h, list<int>::iteratord, const Link& l, list<Boubble*>& new_head_boubbles, list<Boubble*>& new_dep_boubbles)185 { 186 187 NodeProp &oldheadprop = sgraph[ *h].prop;188 NodeProp &olddepprop = sgraph[ *d].prop;239 void connect_left(int h, int d, const Link& l, list<Boubble*>& new_head_boubbles, list<Boubble*>& new_dep_boubbles) 240 { 241 242 NodeProp &oldheadprop = sgraph[h].prop; 243 NodeProp &olddepprop = sgraph[d].prop; 189 244 190 245 NodeProp newheadprop = compute_head_prop(oldheadprop,l,new_head_boubbles,olddepprop.flags); … … 192 247 int newheadind; 193 248 if(oldheadprop==newheadprop) 194 newheadind = *h;249 newheadind = h; 195 250 else 196 251 { 197 bitset<MAXNODES> newheadLH = sgraph[*h].LH; 198 bitset<MAXNODES> newheadLV = sgraph[*d].LV; 199 bitset<MAXNODES> newheadLD = sgraph[*h].LD; 200 201 newheadind = find_existing_node(sgraph[*h].mnode, newheadprop, newheadLH, newheadLV); 202 if( newheadind >= 0 ) 252 bitset<MAXNODES> newheadLH = sgraph[h].LH; 253 bitset<MAXNODES> newheadLV = sgraph[d].LV; 254 bitset<MAXNODES> newheadLD = sgraph[h].LD; 255 256 // vector<int> newedge; 257 258 newheadind = find_existing_node(sgraph[h].mnode, newheadprop, newheadLH, newheadLV); 259 if( newheadind >= 0) // W£¡CZONE 203 260 sgraph[newheadind].LD |= newheadLD; 204 261 else 205 newheadind = create_new_head_node_left(h,newheadprop,newheadLH,newheadLD,newheadLV); 262 { 263 newheadind = create_new_head_node_left(h,newheadprop,newheadLH,newheadLD,newheadLV); 264 sgraph[newheadind].edge.clear(); 265 sgraph[newheadind].edge_contains_self = false; 266 } 267 206 268 } 207 269 208 209 210 270 NodeProp newdepprop = compute_dep_prop(olddepprop,l,new_dep_boubbles); 211 271 … … 213 273 214 274 if(olddepprop==newdepprop) 215 newdepind = *d;275 newdepind = d; 216 276 else 217 277 { 218 bitset<MAXNODES> newdepLH = sgraph[ *d].LH;219 bitset<MAXNODES> newdepLV = sgraph[ *d].LV;220 bitset<MAXNODES> newdepLD = sgraph[ *d].LD;221 222 newdepind = find_existing_node(sgraph[ *d].mnode, newdepprop, newdepLH, newdepLV);223 if( newdepind >= 0 )278 bitset<MAXNODES> newdepLH = sgraph[d].LH; 279 bitset<MAXNODES> newdepLV = sgraph[d].LV; 280 bitset<MAXNODES> newdepLD = sgraph[d].LD; 281 282 newdepind = find_existing_node(sgraph[d].mnode, newdepprop, newdepLH, newdepLV); 283 if( newdepind >= 0) // W£¡CZONE 224 284 sgraph[newdepind].LD |= newdepLD; // TYLKO DLA LD 225 285 else 226 newdepind = create_new_dep_node_left(d,newdepprop,newdepLH,newdepLD,newdepLV); 286 { 287 newdepind = create_new_dep_node_left(d,newdepprop,newdepLH,newdepLD,newdepLV); 288 sgraph[newdepind].edge.clear(); 289 //sgraph[newdepind].edge.push_back(newdepind); // TO 290 sgraph[newdepind].edge_contains_self = true; // LUB TO 291 } 227 292 } 228 229 sgraph[newheadind].deps.push_back(Arc(newdepind,l.role,*h,*d)); 230 231 if(sgraph[*d].saturated()) sgraph[newheadind].LV |= sgraph[*d].LV; 232 233 sgraph[newheadind].LD.set(*d); 234 if(sgraph[*d].saturated()) sgraph[newheadind].LD |= sgraph[*d].LD; 235 236 if(debug) sgraph.print_arc(stderr,newheadind,*d,l.role,0); 237 if(debug) sgraph.print_node_debug(stderr,"U ",newheadind,*h); 238 if(debug) sgraph.print_node_debug(stderr,"U ",*d,*d); 293 294 295 sgraph[newheadind].deps.push_back(Arc(newdepind,l.role,h,d)); 296 sgraph[newdepind].heads.push_back(Arc(newheadind,l.role,h,d)); 297 sgraph[newheadind].edge.push_back(newdepind); 298 299 if(sgraph[d].saturated()) sgraph[newheadind].LV |= sgraph[d].LV; 300 301 sgraph[newheadind].LD.set(d); 302 if(sgraph[d].saturated()) sgraph[newheadind].LD |= sgraph[d].LD; 303 304 if(debug) sgraph.print_arc(stderr,newheadind,d,l.role,0); 305 if(debug) sgraph.print_node_debug(stderr,"U ",newheadind,h); 306 if(debug) print_sets(newheadind); 307 if(debug) sgraph.print_node_debug(stderr,"U ",newdepind,d); 308 if(debug) print_sets(newdepind); 239 309 } 240 310 241 311 //---------------------------------------------------------------------------------------------------- 242 312 243 void connect_right( list<int>::iterator h, list<int>::iteratord, const Link& l, list<Boubble*>& new_head_boubbles, list<Boubble*>& new_dep_boubbles)244 { 245 NodeProp &oldheadprop = sgraph[ *h].prop;246 247 NodeProp newheadprop = compute_head_prop(oldheadprop,l,new_head_boubbles, sgraph[ *d].prop.flags);313 void connect_right(int h, int d, const Link& l, list<Boubble*>& new_head_boubbles, list<Boubble*>& new_dep_boubbles) 314 { 315 NodeProp &oldheadprop = sgraph[h].prop; 316 317 NodeProp newheadprop = compute_head_prop(oldheadprop,l,new_head_boubbles, sgraph[d].prop.flags); 248 318 249 319 int newheadind; 250 320 251 321 if(oldheadprop==newheadprop) 252 newheadind = *h;322 newheadind = h; 253 323 else 254 324 { 255 bitset<MAXNODES> newheadLH = sgraph[*h].LH; 256 bitset<MAXNODES> newheadLV = sgraph[*h].LV; 257 bitset<MAXNODES> newheadLD = sgraph[*h].LD; 258 259 newheadind = find_existing_node(sgraph[*h].mnode, newheadprop, newheadLH, newheadLV); 260 if( newheadind >= 0 ) 325 bitset<MAXNODES> newheadLH = sgraph[h].LH; 326 bitset<MAXNODES> newheadLV = sgraph[h].LV; 327 bitset<MAXNODES> newheadLD = sgraph[h].LD; 328 329 newheadind = find_existing_node(sgraph[h].mnode, newheadprop, newheadLH, newheadLV); 330 331 if(debug) fprintf(stderr,"#HEAD EXISTS %d\n",newheadind); 332 333 if( newheadind >= 0) // W£¡CZONE 261 334 sgraph[newheadind].LD |= newheadLD; // TYLKO DLA LD 262 335 else 263 newheadind = create_new_head_node_right(h,newheadprop,newheadLH,newheadLD,newheadLV); 336 { 337 newheadind = create_new_head_node_right(h,newheadprop,newheadLH,newheadLD,newheadLV); 338 //if(!sgraph[h].edge.empty()) sgraph[newheadind].edge.push_back(newheadind); // TO 339 sgraph[newheadind].edge_contains_self = sgraph[h].edge_contains_self; // LUB TO 340 sgraph[newheadind].visible_as_neighbour = false; 341 } 264 342 } 265 343 266 NodeProp &olddepprop = sgraph[ *d].prop;344 NodeProp &olddepprop = sgraph[d].prop; 267 345 NodeProp newdepprop = compute_dep_prop(olddepprop,l,new_dep_boubbles); 268 346 … … 270 348 271 349 if(olddepprop==newdepprop) 272 newdepind = *d;350 newdepind = d; 273 351 else 274 352 { 275 bitset<MAXNODES> newdepLH = sgraph[*d].LH; 276 bitset<MAXNODES> newdepLV = sgraph[*d].LV; 277 bitset<MAXNODES> newdepLD = sgraph[*d].LD; 278 279 newdepind = find_existing_node(sgraph[*d].mnode, newdepprop, newdepLH, newdepLV); 280 if( newdepind >= 0 ) 353 bitset<MAXNODES> newdepLH = sgraph[d].LH; 354 bitset<MAXNODES> newdepLV = sgraph[d].LV; 355 bitset<MAXNODES> newdepLD = sgraph[d].LD; 356 357 newdepind = find_existing_node(sgraph[d].mnode, newdepprop, newdepLH, newdepLV); 358 359 if(debug) fprintf(stderr,"#DEP EXISTS %d\n",newdepind); 360 361 if( newdepind >= 0) // W£¡CZONE 281 362 sgraph[newdepind].LD |= newdepLD; // TYLKO DLA LD 282 363 else 283 newdepind = create_new_dep_node_right(d,newdepprop,newdepLH,newdepLD,newdepLV); 364 { 365 newdepind = create_new_dep_node_right(d,newdepprop,newdepLH,newdepLD,newdepLV); 366 sgraph[newdepind].edge.clear(); 367 sgraph[newdepind].edge_contains_self = false; 368 } 284 369 } 285 370 286 371 287 288 289 sgraph[newdepind].heads.push_back(Arc(newheadind,l.role,*h,*d));372 sgraph[newdepind].heads.push_back(Arc(newheadind,l.role,h,d)); 373 sgraph[newheadind].deps.push_back(Arc(newdepind,l.role,h,d)); 374 //sgraph[newdepind].edge.push_back(newheadind); 290 375 291 376 sgraph[newdepind].LH.set(newheadind); … … 296 381 297 382 if(debug) sgraph.print_arc(stderr,newheadind,newdepind,l.role,1); 298 if(debug) sgraph.print_node_debug(stderr,"U ",newheadind, *h);299 if(debug) sgraph.print_node_debug(stderr,"U ",newdepind, *d);383 if(debug) sgraph.print_node_debug(stderr,"U ",newheadind,h); 384 if(debug) sgraph.print_node_debug(stderr,"U ",newdepind,d); 300 385 301 386 } … … 323 408 } 324 409 325 // bool check_boubbles_at_target(list<Boubble*> boubbles, int node) 326 // { 327 // for(list<Boubble*>::iterator b = boubbles.begin(); b != boubbles.end(); ++b ) 328 // if( (*b)->is_at_target() && !grammar.check_longrel(sgraph.cat((*b)->src()), sgraph.cat(node), (*b)->rel()) ) 329 // return false; 330 // return true; 331 // } 332 333 //==================================================================================================== 334 335 void try_connect_dependents(list<int>::iterator j) 336 { 337 for(list<int>::iterator i(j); i!=nodelist.begin(); --i) 338 if(sgraph.visible(*i,*j) && sgraph.saturated(*i)) 339 { 340 if(debug) {fprintf(stderr,"## %d <-- %d ... ",*i,*j); } 341 342 list<const Link*> ji_links = grammar.connectable2( sgraph.cat(*j), sgraph.cat(*i), sgraph[*j].prop.flags, sgraph[*i].prop.flags); // ref do Roles!!! 410 //==================================================================================================== 411 412 void try_connect_dependents(int j) 413 { 414 // for(list<int>::iterator i(j); i!=nodelist.begin(); --i) 415 // if(sgraph.visible(*i,*j) && sgraph.saturated(*i)) 416 LViterator lvi(sgraph,j); 417 int i; 418 while((i=lvi.next()) >= 0) 419 if(sgraph.saturated(i)) 420 { 421 if(debug) {fprintf(stderr,"## %d <-- %d ... ",i,j); } 422 423 list<const Link*> ji_links = grammar.connectable2( sgraph.cat(j), sgraph.cat(i), sgraph[j].prop.flags, sgraph[i].prop.flags); // ref do Roles!!! 343 424 list<const Link*>::iterator ri = ji_links.begin(); 344 425 if(ri == ji_links.end()) { if(debug) fprintf(stderr,"no roles\n"); } … … 346 427 { 347 428 for(; ri != ji_links.end(); ++ri ) 348 if(!grammar.check_constr2(sgraph[ *j].prop,sgraph[*i].prop,0,**ri ))429 if(!grammar.check_constr2(sgraph[j].prop,sgraph[i].prop,0,**ri )) 349 430 { if(debug) fprintf(stderr,"constraints failed\n"); } 350 431 else 351 432 { 352 list<Boubble*> new_head_boubbles = collect_head_boubbles( *j,*i,(*ri)->role);353 list<Boubble*> new_dep_boubbles = collect_dep_boubbles( *j,*i,(*ri)->role);433 list<Boubble*> new_head_boubbles = collect_head_boubbles(j,i,(*ri)->role); 434 list<Boubble*> new_dep_boubbles = collect_dep_boubbles(j,i,(*ri)->role); 354 435 355 if( !(check_boubbles_at_target(new_head_boubbles, *j) && check_boubbles_at_target(new_dep_boubbles,*i)) )436 if( !(check_boubbles_at_target(new_head_boubbles,j) && check_boubbles_at_target(new_dep_boubbles,i)) ) 356 437 { if(debug) fprintf(stderr,"boubbles failed\n"); } 357 438 else … … 368 449 //---------------------------------------------------------------------------------------------------- 369 450 370 void try_connect_heads(list<int>::iterator j) 371 { 372 for(list<int>::iterator i(j); i!=nodelist.begin(); --i) 373 if(sgraph.visible(*i,*j)) 374 { 375 if(debug) fprintf(stderr, "## %d --> %d ... ",*i,*j); 376 377 list<const Link*> ij_links = grammar.connectable2( sgraph.cat(*i), sgraph.cat(*j), sgraph[*i].prop.flags, sgraph[*j].prop.flags ); 451 void try_connect_heads(int j) 452 { 453 // for(list<int>::iterator i(j); i!=nodelist.begin(); --i) 454 // if(sgraph.visible(*i,*j) && sgraph.saturated(*j)) 455 456 LViterator lvi(sgraph,j); 457 int i; 458 while((i=lvi.next()) >= 0) 459 if(sgraph.saturated(j)) 460 { 461 if(debug) fprintf(stderr, "## %d --> %d ... ",i,j); 462 463 list<const Link*> ij_links = grammar.connectable2( sgraph.cat(i), sgraph.cat(j), sgraph[i].prop.flags, sgraph[j].prop.flags ); 378 464 list<const Link*>::iterator ri = ij_links.begin(); 379 465 if(ri == ij_links.end()) { if(debug) fprintf(stderr,"no roles\n"); } … … 381 467 { 382 468 for(; ri != ij_links.end(); ++ri ) 383 if( !grammar.check_constr2( sgraph[ *i].prop, sgraph[*j].prop, 1, **ri ) )469 if( !grammar.check_constr2( sgraph[i].prop, sgraph[j].prop, 1, **ri ) ) 384 470 { if(debug) fprintf(stderr,"constraints failed\n"); } 385 471 else 386 472 { 387 list<Boubble*> new_head_boubbles = collect_head_boubbles( *i,*j,(*ri)->role);388 list<Boubble*> new_dep_boubbles = collect_dep_boubbles( *i,*j,(*ri)->role);473 list<Boubble*> new_head_boubbles = collect_head_boubbles(i,j,(*ri)->role); 474 list<Boubble*> new_dep_boubbles = collect_dep_boubbles(i,j,(*ri)->role); 389 475 390 if( !(check_boubbles_at_target(new_head_boubbles, *i) && check_boubbles_at_target(new_dep_boubbles,*j)) )476 if( !(check_boubbles_at_target(new_head_boubbles,i) && check_boubbles_at_target(new_dep_boubbles,j)) ) 391 477 { if(debug) fprintf(stderr,"boubbles failed\n"); } 392 478 else … … 399 485 } 400 486 } 401 487 488 //==================================================================================================== 489 490 void update_sets() 491 { 492 for(int n=0; n<sgraph.size(); ++n) 493 { 494 LViterator lvi(sgraph,n,false); 495 LHiterator lhi(sgraph,n); 496 LDiterator ldi(sgraph,n); 497 int i; 498 499 // printf("UPDATING LV[%d]:",n); 500 while((i=lvi.next())>=0) 501 { 502 // printf(" %d",i); 503 sgraph[n].LV.set(i); 504 } 505 // printf("\n"); 506 507 while((i=lhi.next())>=0) sgraph[n].LH.set(i); 508 while((i=ldi.next())>=0) sgraph[n].LD.set(i); 509 } 510 } 511 512 //==================================================================================================== 513 514 void print_sets(int n) 515 { 516 LViterator lvi(sgraph,n); 517 LHiterator lhi(sgraph,n); 518 LDiterator ldi(sgraph,n); 519 520 int i; 521 printf("LV[%d]: ",n); 522 while((i=lvi.next())>=0) 523 { 524 printf("%d ",i); 525 sgraph[n].LV.set(i); 526 } 527 528 printf("LH[%d]: ",n); 529 while((i=lhi.next())>=0) 530 { 531 printf("%d ",i); 532 sgraph[n].LH.set(i); 533 } 534 printf("LD[%d]: ",n); 535 while((i=ldi.next())>=0) 536 { 537 printf("%d ",i); 538 sgraph[n].LD.set(i); 539 } 540 printf("\n"); 541 } 542 402 543 //==================================================================================================== 403 544 … … 430 571 nodelist.push_back(basenode); 431 572 432 if(debug) {sgraph.print_node_debug(stderr,"B ",basenode,-1);} // STDOUT!!! 573 if(debug) sgraph.print_node_debug(stderr,"B ",basenode,-1); // STDOUT!!! 574 if(debug) print_sets(basenode); 433 575 434 576 list<int>::iterator cursor=processed; 435 577 while(++cursor != nodelist.end()) 436 578 { 437 try_connect_dependents(cursor); 438 try_connect_heads(cursor); 579 if(debug) sgraph.print_node_debug(stderr,"> ",*cursor,-1); 580 try_connect_dependents(*cursor); 581 try_connect_heads(*cursor); 439 582 processed=cursor; 440 583 } 441 584 442 585 } 443 reverse_links(); 444 } 586 // reverse_links(); 587 update_sets(); 588 }
Note: See TracChangeset
for help on using the changeset viewer.