Changeset 389:770cc1f4861f in lemon-0.x for src/work/marci/edmonds_karp.h
- Timestamp:
- 04/24/04 14:44:41 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@520
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/edmonds_karp.h
r360 r389 276 276 bool _augment=false; 277 277 278 BfsIterator< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph); 278 BfsIterator< ResGW, typename ResGW::template NodeMap<bool> > 279 bfs(res_graph); 279 280 bfs.pushAndSetReached(s); 280 281 281 typename ResGW:: NodeMap<ResGWEdge> pred(res_graph);282 typename ResGW::template NodeMap<ResGWEdge> pred(res_graph); 282 283 pred.set(s, INVALID); 283 284 284 typename ResGW:: NodeMap<Number> free(res_graph);285 typename ResGW::template NodeMap<Number> free(res_graph); 285 286 286 287 //searching for augmenting path … … 319 320 protected: 320 321 const MapGraphWrapper* g; 321 typename MapGraphWrapper:: NodeMap<int> dist;322 typename MapGraphWrapper::template NodeMap<int> dist; 322 323 public: 323 324 DistanceMap(MapGraphWrapper& _g) : g(&_g), dist(*g, g->nodeNum()) { } … … 340 341 ResGW res_graph(*g, *capacity, *flow); 341 342 342 BfsIterator< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph); 343 BfsIterator< ResGW, typename ResGW::template NodeMap<bool> > 344 bfs(res_graph); 343 345 344 346 bfs.pushAndSetReached(s); … … 358 360 DistanceMap<ResGW> > FilterResGW; 359 361 FilterResGW filter_res_graph(res_graph, true_map, dist); 360 typename ResGW::NodeMap<typename MG::Node> res_graph_to_F(res_graph); 362 typename ResGW::template NodeMap<typename MG::Node> 363 res_graph_to_F(res_graph); 361 364 { 362 365 typename ResGW::NodeIt n; … … 368 371 typename MG::Node sF=res_graph_to_F[s]; 369 372 typename MG::Node tF=res_graph_to_F[t]; 370 typename MG:: EdgeMap<ResGWEdge> original_edge(F);371 typename MG:: EdgeMap<Number> residual_capacity(F);373 typename MG::template EdgeMap<ResGWEdge> original_edge(F); 374 typename MG::template EdgeMap<Number> residual_capacity(F); 372 375 373 376 //Making F to the graph containing the edges of the residual graph … … 392 395 //computing blocking flow with dfs 393 396 394 DfsIterator< MG, typename MG:: NodeMap<bool> > dfs(F);395 typename MG:: NodeMap<typename MG::Edge> pred(F);397 DfsIterator< MG, typename MG::template NodeMap<bool> > dfs(F); 398 typename MG::template NodeMap<typename MG::Edge> pred(F); 396 399 pred.set(sF, INVALID); 397 400 //invalid iterators for sources 398 401 399 typename MG:: NodeMap<Number> free(F);402 typename MG::template NodeMap<Number> free(F); 400 403 401 404 dfs.pushAndSetReached(sF); … … 450 453 451 454 //bfs for distances on the residual graph 452 BfsIterator< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph); 455 BfsIterator< ResGW, typename ResGW::template NodeMap<bool> > 456 bfs(res_graph); 453 457 bfs.pushAndSetReached(s); 454 typename ResGW::NodeMap<int> dist(res_graph); //filled up with 0's 458 typename ResGW::template NodeMap<int> 459 dist(res_graph); //filled up with 0's 455 460 456 461 //F will contain the physical copy of the residual graph 457 462 //with the set of edges which are on shortest paths 458 463 MG F; 459 typename ResGW::NodeMap<typename MG::Node> res_graph_to_F(res_graph); 464 typename ResGW::template NodeMap<typename MG::Node> 465 res_graph_to_F(res_graph); 460 466 { 461 467 typename ResGW::NodeIt n; … … 467 473 typename MG::Node sF=res_graph_to_F[s]; 468 474 typename MG::Node tF=res_graph_to_F[t]; 469 typename MG:: EdgeMap<ResGWEdge> original_edge(F);470 typename MG:: EdgeMap<Number> residual_capacity(F);475 typename MG::template EdgeMap<ResGWEdge> original_edge(F); 476 typename MG::template EdgeMap<Number> residual_capacity(F); 471 477 472 478 while ( !bfs.finished() ) { … … 498 504 __augment=false; 499 505 //computing blocking flow with dfs 500 DfsIterator< MG, typename MG:: NodeMap<bool> > dfs(F);501 typename MG:: NodeMap<typename MG::Edge> pred(F);506 DfsIterator< MG, typename MG::template NodeMap<bool> > dfs(F); 507 typename MG::template NodeMap<typename MG::Edge> pred(F); 502 508 pred.set(sF, INVALID); 503 509 //invalid iterators for sources 504 510 505 typename MG:: NodeMap<Number> free(F);511 typename MG::template NodeMap<Number> free(F); 506 512 507 513 dfs.pushAndSetReached(sF); … … 554 560 ResGW res_graph(*g, *capacity, *flow); 555 561 556 BfsIterator< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph); 562 BfsIterator< ResGW, typename ResGW::template NodeMap<bool> > 563 bfs(res_graph); 557 564 558 565 bfs.pushAndSetReached(s); … … 574 581 //Subgraph, which is able to delete edges which are already 575 582 //met by the dfs 576 typename FilterResGW:: NodeMap<typename FilterResGW::OutEdgeIt>583 typename FilterResGW::template NodeMap<typename FilterResGW::OutEdgeIt> 577 584 first_out_edges(filter_res_graph); 578 585 typename FilterResGW::NodeIt v; … … 585 592 } 586 593 typedef ErasingFirstGraphWrapper<FilterResGW, typename FilterResGW:: 587 NodeMap<typename FilterResGW::OutEdgeIt> > ErasingResGW;594 template NodeMap<typename FilterResGW::OutEdgeIt> > ErasingResGW; 588 595 ErasingResGW erasing_res_graph(filter_res_graph, first_out_edges); 589 596 … … 594 601 __augment=false; 595 602 //computing blocking flow with dfs 596 DfsIterator< ErasingResGW, typename ErasingResGW::NodeMap<bool> > 603 DfsIterator< ErasingResGW, 604 typename ErasingResGW::template NodeMap<bool> > 597 605 dfs(erasing_res_graph); 598 typename ErasingResGW::NodeMap<typename ErasingResGW::OutEdgeIt> 599 pred(erasing_res_graph); 606 typename ErasingResGW:: 607 template NodeMap<typename ErasingResGW::OutEdgeIt> 608 pred(erasing_res_graph); 600 609 pred.set(s, INVALID); 601 610 //invalid iterators for sources 602 611 603 typename ErasingResGW::NodeMap<Number> free1(erasing_res_graph); 612 typename ErasingResGW::template NodeMap<Number> 613 free1(erasing_res_graph); 604 614 605 615 dfs.pushAndSetReached(
Note: See TracChangeset
for help on using the changeset viewer.