Changeset 303:1b377a730d02 in lemon-0.x for src/work
- Timestamp:
- 04/05/04 18:52:46 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@421
- Location:
- src/work/marci
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/bfs_iterator.h
r301 r303 6 6 #include <stack> 7 7 #include <utility> 8 #include <graph_wrapper.h>9 8 10 9 namespace hugo { … … 631 630 632 631 633 template <typename Graph Wrapper, /*typename OutEdgeIt,*/634 typename ReachedMap/*=typename Graph Wrapper::NodeMap<bool>*/ >632 template <typename Graph, /*typename OutEdgeIt,*/ 633 typename ReachedMap/*=typename Graph::NodeMap<bool>*/ > 635 634 class BfsIterator5 { 636 typedef typename GraphWrapper::Node Node; 637 typedef typename GraphWrapper::OutEdgeIt OutEdgeIt; 638 GraphWrapper G; 635 protected: 636 typedef typename Graph::Node Node; 637 typedef typename Graph::OutEdgeIt OutEdgeIt; 638 const Graph* graph; 639 639 std::queue<Node> bfs_queue; 640 640 ReachedMap& reached; … … 643 643 bool own_reached_map; 644 644 public: 645 BfsIterator5(const Graph Wrapper& _G, ReachedMap& _reached) :646 G(_G), reached(_reached),645 BfsIterator5(const Graph& _graph, ReachedMap& _reached) : 646 graph(&_graph), reached(_reached), 647 647 own_reached_map(false) { } 648 BfsIterator5(const Graph Wrapper& _G) :649 G(_G), reached(*(new ReachedMap(G/*, false*/))),648 BfsIterator5(const Graph& _graph) : 649 graph(&_graph), reached(*(new ReachedMap(*graph /*, false*/))), 650 650 own_reached_map(true) { } 651 // BfsIterator5(const typename GraphWrapper::BaseGraph& _G,652 // ReachedMap& _reached) :653 // G(_G), reached(_reached),654 // own_reached_map(false) { }655 // BfsIterator5(const typename GraphWrapper::BaseGraph& _G) :656 // G(_G), reached(*(new ReachedMap(G /*, false*/))),657 // own_reached_map(true) { }658 651 ~BfsIterator5() { if (own_reached_map) delete &reached; } 659 652 void pushAndSetReached(Node s) { … … 661 654 if (bfs_queue.empty()) { 662 655 bfs_queue.push(s); 663 G./*getF*/first(actual_edge, s);664 if ( G.valid(actual_edge)/*.valid()*/) {665 Node w= G.bNode(actual_edge);666 if (!reached .get(w)) {656 graph->first(actual_edge, s); 657 if (graph->valid(actual_edge)) { 658 Node w=graph->bNode(actual_edge); 659 if (!reached[w]) { 667 660 bfs_queue.push(w); 668 661 reached.set(w, true); … … 676 669 } 677 670 } 678 BfsIterator5<Graph Wrapper, /*OutEdgeIt,*/ ReachedMap>&671 BfsIterator5<Graph, /*OutEdgeIt,*/ ReachedMap>& 679 672 operator++() { 680 if ( G.valid(actual_edge)/*.valid()*/) {681 /*++*/G.next(actual_edge);682 if ( G.valid(actual_edge)/*.valid()*/) {683 Node w= G.bNode(actual_edge);684 if (!reached .get(w)) {673 if (graph->valid(actual_edge)) { 674 graph->next(actual_edge); 675 if (graph->valid(actual_edge)) { 676 Node w=graph->bNode(actual_edge); 677 if (!reached[w]) { 685 678 bfs_queue.push(w); 686 679 reached.set(w, true); … … 693 686 bfs_queue.pop(); 694 687 if (!bfs_queue.empty()) { 695 G./*getF*/first(actual_edge, bfs_queue.front());696 if ( G.valid(actual_edge)/*.valid()*/) {697 Node w= G.bNode(actual_edge);698 if (!reached .get(w)) {688 graph->first(actual_edge, bfs_queue.front()); 689 if (graph->valid(actual_edge)) { 690 Node w=graph->bNode(actual_edge); 691 if (!reached[w]) { 699 692 bfs_queue.push(w); 700 693 reached.set(w, true); … … 711 704 operator OutEdgeIt () const { return actual_edge; } 712 705 bool isBNodeNewlyReached() const { return b_node_newly_reached; } 713 bool isANodeExamined() const { return !( G.valid(actual_edge)/*.valid()*/); }706 bool isANodeExamined() const { return !(graph->valid(actual_edge)); } 714 707 Node aNode() const { return bfs_queue.front(); } 715 Node bNode() const { return G.bNode(actual_edge); }708 Node bNode() const { return graph->bNode(actual_edge); } 716 709 const ReachedMap& getReachedMap() const { return reached; } 717 710 const std::queue<Node>& getBfsQueue() const { return bfs_queue; } … … 774 767 // }; 775 768 776 template <typename Graph Wrapper, /*typename OutEdgeIt,*/777 typename ReachedMap/*=typename Graph Wrapper::NodeMap<bool>*/ >769 template <typename Graph, /*typename OutEdgeIt,*/ 770 typename ReachedMap/*=typename Graph::NodeMap<bool>*/ > 778 771 class DfsIterator5 { 779 typedef typename GraphWrapper::Node Node; 780 typedef typename GraphWrapper::OutEdgeIt OutEdgeIt; 781 GraphWrapper G; 772 protected: 773 typedef typename Graph::Node Node; 774 typedef typename Graph::OutEdgeIt OutEdgeIt; 775 const Graph* graph; 782 776 std::stack<OutEdgeIt> dfs_stack; 783 777 bool b_node_newly_reached; … … 787 781 bool own_reached_map; 788 782 public: 789 DfsIterator5(const Graph Wrapper& _G, ReachedMap& _reached) :790 G(_G), reached(_reached),783 DfsIterator5(const Graph& _graph, ReachedMap& _reached) : 784 graph(&_graph), reached(_reached), 791 785 own_reached_map(false) { } 792 DfsIterator5(const Graph Wrapper& _G) :793 G(_G), reached(*(new ReachedMap(G/*, false*/))),786 DfsIterator5(const Graph& _graph) : 787 graph(&_graph), reached(*(new ReachedMap(*graph /*, false*/))), 794 788 own_reached_map(true) { } 795 789 ~DfsIterator5() { if (own_reached_map) delete &reached; } … … 798 792 reached.set(s, true); 799 793 OutEdgeIt e; 800 G.first(e, s);794 graph->first(e, s); 801 795 dfs_stack.push(e); 802 796 } 803 DfsIterator5<Graph Wrapper, /*OutEdgeIt,*/ ReachedMap>&797 DfsIterator5<Graph, /*OutEdgeIt,*/ ReachedMap>& 804 798 operator++() { 805 799 actual_edge=dfs_stack.top(); 806 800 //actual_node=G.aNode(actual_edge); 807 if ( G.valid(actual_edge)/*.valid()*/) {808 Node w= G.bNode(actual_edge);801 if (graph->valid(actual_edge)/*.valid()*/) { 802 Node w=graph->bNode(actual_edge); 809 803 actual_node=w; 810 if (!reached .get(w)) {804 if (!reached[w]) { 811 805 OutEdgeIt e; 812 G.first(e, w);806 graph->first(e, w); 813 807 dfs_stack.push(e); 814 808 reached.set(w, true); 815 809 b_node_newly_reached=true; 816 810 } else { 817 actual_node= G.aNode(actual_edge);818 /*++*/G.next(dfs_stack.top());811 actual_node=graph->aNode(actual_edge); 812 graph->next(dfs_stack.top()); 819 813 b_node_newly_reached=false; 820 814 } … … 828 822 operator OutEdgeIt () const { return actual_edge; } 829 823 bool isBNodeNewlyReached() const { return b_node_newly_reached; } 830 bool isANodeExamined() const { return !( G.valid(actual_edge)/*.valid()*/); }824 bool isANodeExamined() const { return !(graph->valid(actual_edge)); } 831 825 Node aNode() const { return actual_node; /*FIXME*/} 832 826 Node bNode() const { return G.bNode(actual_edge); } -
src/work/marci/edmonds_karp.h
r301 r303 9 9 #include <bfs_iterator.h> 10 10 #include <invalid.h> 11 #include <graph_wrapper.h> 11 12 12 13 namespace hugo { … … 248 249 249 250 250 template <typename Graph Wrapper, typename Number, typename FlowMap, typename CapacityMap>251 template <typename Graph, typename Number, typename FlowMap, typename CapacityMap> 251 252 class MaxFlow { 252 253 protected: 253 typedef GraphWrapper GW; 254 typedef typename GW::Node Node; 255 typedef typename GW::Edge Edge; 256 typedef typename GW::EdgeIt EdgeIt; 257 typedef typename GW::OutEdgeIt OutEdgeIt; 258 typedef typename GW::InEdgeIt InEdgeIt; 259 //const Graph* G; 260 GW gw; 254 typedef typename Graph::Node Node; 255 typedef typename Graph::Edge Edge; 256 typedef typename Graph::EdgeIt EdgeIt; 257 typedef typename Graph::OutEdgeIt OutEdgeIt; 258 typedef typename Graph::InEdgeIt InEdgeIt; 259 const Graph* g; 261 260 Node s; 262 261 Node t; 263 262 FlowMap* flow; 264 263 const CapacityMap* capacity; 265 typedef ResGraphWrapper< GW, Number, FlowMap, CapacityMap > ResGW;264 typedef ResGraphWrapper<const Graph, Number, FlowMap, CapacityMap > ResGW; 266 265 typedef typename ResGW::OutEdgeIt ResGWOutEdgeIt; 267 266 typedef typename ResGW::Edge ResGWEdge; 268 267 public: 269 268 270 MaxFlow(const G W& _gw, Node _s, Node _t, FlowMap& _flow, const CapacityMap& _capacity) :271 g w(_gw), s(_s), t(_t), flow(&_flow), capacity(&_capacity) { }269 MaxFlow(const Graph& _g, Node _s, Node _t, FlowMap& _flow, const CapacityMap& _capacity) : 270 g(&_g), s(_s), t(_t), flow(&_flow), capacity(&_capacity) { } 272 271 273 272 bool augmentOnShortestPath() { 274 ResGW res_graph( gw, *flow, *capacity);273 ResGW res_graph(*g, *flow, *capacity); 275 274 bool _augment=false; 276 275 … … 291 290 Node w=res_graph.head(e); 292 291 pred.set(w, e); 293 if (res_graph.valid(pred .get(v))) {294 free.set(w, std::min(free .get(v), res_graph.resCap(e)));292 if (res_graph.valid(pred[v])) { 293 free.set(w, std::min(free[v], res_graph.resCap(e))); 295 294 } else { 296 295 free.set(w, res_graph.resCap(e)); … … 304 303 if (_augment) { 305 304 Node n=t; 306 Number augment_value=free .get(t);307 while (res_graph.valid(pred .get(n))) {308 ResGWEdge e=pred .get(n);305 Number augment_value=free[t]; 306 while (res_graph.valid(pred[n])) { 307 ResGWEdge e=pred[n]; 309 308 res_graph.augment(e, augment_value); 310 309 n=res_graph.tail(e); … … 318 317 class DistanceMap { 319 318 protected: 320 MapGraphWrapper gw;319 const MapGraphWrapper* g; 321 320 typename MapGraphWrapper::NodeMap<int> dist; 322 321 public: 323 DistanceMap(MapGraphWrapper& _g w) : gw(_gw), dist(_gw, _gw.nodeNum()) { }322 DistanceMap(MapGraphWrapper& _g) : g(&_g), dist(*g, g->nodeNum()) { } 324 323 void set(const typename MapGraphWrapper::Node& n, int a) { dist[n]=a; } 325 int get(const typename MapGraphWrapper::Node& n) const { return dist[n]; } 326 bool get(const typename MapGraphWrapper::Edge& e) const { 327 return (dist.get(gw.tail(e))<dist.get(gw.head(e))); 324 int operator[](const typename MapGraphWrapper::Node& n) 325 { return dist[n]; } 326 // int get(const typename MapGraphWrapper::Node& n) const { 327 // return dist[n]; } 328 // bool get(const typename MapGraphWrapper::Edge& e) const { 329 // return (dist.get(g->tail(e))<dist.get(g->head(e))); } 330 bool operator[](const typename MapGraphWrapper::Edge& e) const { 331 return (dist[g->tail(e)]<dist[g->head(e)]); 328 332 } 329 333 }; … … 333 337 bool _augment=false; 334 338 335 ResGW res_graph( gw, *flow, *capacity);339 ResGW res_graph(*g, *flow, *capacity); 336 340 337 341 typedef typename ResGW::NodeMap<bool> ReachedMap; … … 344 348 ResGWOutEdgeIt e=bfs; 345 349 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) { 346 dist.set(res_graph.head(e), dist .get(res_graph.tail(e))+1);350 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1); 347 351 } 348 352 ++bfs; … … 360 364 } 361 365 362 typename MG::Node sF=res_graph_to_F .get(s);363 typename MG::Node tF=res_graph_to_F .get(t);366 typename MG::Node sF=res_graph_to_F[s]; 367 typename MG::Node tF=res_graph_to_F[t]; 364 368 typename MG::EdgeMap<ResGWEdge> original_edge(F); 365 369 typename MG::EdgeMap<Number> residual_capacity(F); … … 371 375 for(filter_res_graph.first(e); filter_res_graph.valid(e); filter_res_graph.next(e)) { 372 376 //if (dist.get(res_graph.head(e))==dist.get(res_graph.tail(e))+1) { 373 typename MG::Edge f=F.addEdge(res_graph_to_F .get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e)));377 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]); 374 378 original_edge.update(); 375 379 original_edge.set(f, e); … … 401 405 typename MG::Node w=F.bNode(dfs); 402 406 pred.set(w, dfs); 403 if (F.valid(pred .get(v))) {404 free.set(w, std::min(free .get(v), residual_capacity.get(dfs)));407 if (F.valid(pred[v])) { 408 free.set(w, std::min(free[v], residual_capacity[dfs])); 405 409 } else { 406 free.set(w, residual_capacity .get(dfs));410 free.set(w, residual_capacity[dfs]); 407 411 } 408 412 if (w==tF) { … … 420 424 if (__augment) { 421 425 typename MG::Node n=tF; 422 Number augment_value=free .get(tF);423 while (F.valid(pred .get(n))) {424 typename MG::Edge e=pred .get(n);425 res_graph.augment(original_edge .get(e), augment_value);426 Number augment_value=free[tF]; 427 while (F.valid(pred[n])) { 428 typename MG::Edge e=pred[n]; 429 res_graph.augment(original_edge[e], augment_value); 426 430 n=F.tail(e); 427 if (residual_capacity .get(e)==augment_value)431 if (residual_capacity[e]==augment_value) 428 432 F.erase(e); 429 433 else 430 residual_capacity.set(e, residual_capacity .get(e)-augment_value);434 residual_capacity.set(e, residual_capacity[e]-augment_value); 431 435 } 432 436 } … … 441 445 bool _augment=false; 442 446 443 ResGW res_graph( gw, *flow, *capacity);447 ResGW res_graph(*g, *flow, *capacity); 444 448 445 449 //bfs for distances on the residual graph … … 460 464 } 461 465 462 typename MG::Node sF=res_graph_to_F .get(s);463 typename MG::Node tF=res_graph_to_F .get(t);466 typename MG::Node sF=res_graph_to_F[s]; 467 typename MG::Node tF=res_graph_to_F[t]; 464 468 typename MG::EdgeMap<ResGWEdge> original_edge(F); 465 469 typename MG::EdgeMap<Number> residual_capacity(F); … … 469 473 if (res_graph.valid(e)) { 470 474 if (bfs.isBNodeNewlyReached()) { 471 dist.set(res_graph.head(e), dist .get(res_graph.tail(e))+1);472 typename MG::Edge f=F.addEdge(res_graph_to_F .get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e)));475 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1); 476 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]); 473 477 original_edge.update(); 474 478 original_edge.set(f, e); … … 476 480 residual_capacity.set(f, res_graph.resCap(e)); 477 481 } else { 478 if (dist .get(res_graph.head(e))==(dist.get(res_graph.tail(e))+1)) {479 typename MG::Edge f=F.addEdge(res_graph_to_F .get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e)));482 if (dist[res_graph.head(e)]==(dist[res_graph.tail(e)]+1)) { 483 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]); 480 484 original_edge.update(); 481 485 original_edge.set(f, e); … … 509 513 typename MG::Node w=F.bNode(dfs); 510 514 pred.set(w, dfs); 511 if (F.valid(pred .get(v))) {512 free.set(w, std::min(free .get(v), residual_capacity.get(dfs)));515 if (F.valid(pred[v])) { 516 free.set(w, std::min(free[v], residual_capacity[dfs])); 513 517 } else { 514 free.set(w, residual_capacity .get(dfs));518 free.set(w, residual_capacity[dfs]); 515 519 } 516 520 if (w==tF) { … … 528 532 if (__augment) { 529 533 typename MG::Node n=tF; 530 Number augment_value=free .get(tF);531 while (F.valid(pred .get(n))) {532 typename MG::Edge e=pred .get(n);533 res_graph.augment(original_edge .get(e), augment_value);534 Number augment_value=free[tF]; 535 while (F.valid(pred[n])) { 536 typename MG::Edge e=pred[n]; 537 res_graph.augment(original_edge[e], augment_value); 534 538 n=F.tail(e); 535 if (residual_capacity .get(e)==augment_value)539 if (residual_capacity[e]==augment_value) 536 540 F.erase(e); 537 541 else 538 residual_capacity.set(e, residual_capacity .get(e)-augment_value);542 residual_capacity.set(e, residual_capacity[e]-augment_value); 539 543 } 540 544 } … … 548 552 bool _augment=false; 549 553 550 ResGW res_graph( gw, *flow, *capacity);554 ResGW res_graph(*g, *flow, *capacity); 551 555 552 556 typedef typename ResGW::NodeMap<bool> ReachedMap; … … 558 562 ResGWOutEdgeIt e=bfs; 559 563 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) { 560 dist.set(res_graph.head(e), dist .get(res_graph.tail(e))+1);564 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1); 561 565 } 562 566 ++bfs; … … 611 615 612 616 pred.set(w, /*typename ErasingResGW::OutEdgeIt*/(dfs)); 613 if (erasing_res_graph.valid(pred .get(v))) {614 free.set(w, std::min(free .get(v), res_graph.resCap(dfs)));617 if (erasing_res_graph.valid(pred[v])) { 618 free.set(w, std::min(free[v], res_graph.resCap(dfs))); 615 619 } else { 616 620 free.set(w, res_graph.resCap(dfs)); … … 630 634 if (__augment) { 631 635 typename ErasingResGW::Node n=t; 632 Number augment_value=free .get(n);633 while (erasing_res_graph.valid(pred .get(n))) {634 typename ErasingResGW::OutEdgeIt e=pred .get(n);636 Number augment_value=free[n]; 637 while (erasing_res_graph.valid(pred[n])) { 638 typename ErasingResGW::OutEdgeIt e=pred[n]; 635 639 res_graph.augment(e, augment_value); 636 640 n=erasing_res_graph.tail(e); … … 645 649 } 646 650 647 // bool augmentOnBlockingFlow2() {648 // bool _augment=false;649 650 // //typedef ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> EAugGraph;651 // typedef FilterGraphWrapper< ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> > EAugGraph;652 // typedef typename EAugGraph::OutEdgeIt EAugOutEdgeIt;653 // typedef typename EAugGraph::Edge EAugEdge;654 655 // EAugGraph res_graph(*G, *flow, *capacity);656 657 // //typedef typename EAugGraph::NodeMap<bool> ReachedMap;658 // BfsIterator5<659 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>,660 // /*typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt,*/661 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<bool> > bfs(res_graph);662 663 // bfs.pushAndSetReached(s);664 665 // typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::666 // NodeMap<int>& dist=res_graph.dist;667 668 // while ( !bfs.finished() ) {669 // typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt e=bfs;670 // if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {671 // dist.set(res_graph.head(e), dist.get(res_graph.tail(e))+1);672 // }673 // ++bfs;674 // } //computing distances from s in the residual graph675 676 // bool __augment=true;677 678 // while (__augment) {679 680 // __augment=false;681 // //computing blocking flow with dfs682 // typedef typename EAugGraph::NodeMap<bool> BlockingReachedMap;683 // DfsIterator5< EAugGraph/*, EAugOutEdgeIt*/, BlockingReachedMap >684 // dfs(res_graph);685 // typename EAugGraph::NodeMap<EAugEdge> pred(res_graph);686 // pred.set(s, EAugEdge(INVALID));687 // //invalid iterators for sources688 689 // typename EAugGraph::NodeMap<Number> free(res_graph);690 691 // dfs.pushAndSetReached(s);692 // while (!dfs.finished()) {693 // ++dfs;694 // if (res_graph.valid(EAugOutEdgeIt(dfs))) {695 // if (dfs.isBNodeNewlyReached()) {696 697 // typename EAugGraph::Node v=res_graph.aNode(dfs);698 // typename EAugGraph::Node w=res_graph.bNode(dfs);699 700 // pred.set(w, EAugOutEdgeIt(dfs));701 // if (res_graph.valid(pred.get(v))) {702 // free.set(w, std::min(free.get(v), res_graph.free(dfs)));703 // } else {704 // free.set(w, res_graph.free(dfs));705 // }706 707 // if (w==t) {708 // __augment=true;709 // _augment=true;710 // break;711 // }712 // } else {713 // res_graph.erase(dfs);714 // }715 // }716 717 // }718 719 // if (__augment) {720 // typename EAugGraph::Node n=t;721 // Number augment_value=free.get(t);722 // while (res_graph.valid(pred.get(n))) {723 // EAugEdge e=pred.get(n);724 // res_graph.augment(e, augment_value);725 // n=res_graph.tail(e);726 // if (res_graph.free(e)==0)727 // res_graph.erase(e);728 // }729 // }730 731 // }732 733 // return _augment;734 // }735 736 651 void run() { 737 652 //int num_of_augmentations=0; … … 755 670 Number a=0; 756 671 OutEdgeIt e; 757 for(g w.first(e, s); gw.valid(e); gw.next(e)) {758 a+= flow->get(e);672 for(g->first(e, s); g->valid(e); g->next(e)) { 673 a+=(*flow)[e]; 759 674 } 760 675 return a; -
src/work/marci/edmonds_karp_demo.cc
r271 r303 4 4 5 5 #include <list_graph.h> 6 #include <smart_graph.h>6 //#include <smart_graph.h> 7 7 #include <dimacs.h> 8 8 #include <edmonds_karp.h> 9 9 #include <time_measure.h> 10 #include <graph_wrapper.h>10 //#include <graph_wrapper.h> 11 11 12 12 class CM { … … 91 91 92 92 { 93 typedef TrivGraphWrapper<const Graph> GW;94 GW gw(G);95 93 std::cout << "edmonds karp demo (physical blocking flow augmentation)..." << std::endl; 96 GW::EdgeMap<int> flow(gw); //0 flow 97 98 Timer ts; 99 ts.reset(); 100 101 typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW; 102 EMW cw(cap); 103 MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw); 94 Graph::EdgeMap<int> flow(G); //0 flow 95 96 Timer ts; 97 ts.reset(); 98 99 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 100 max_flow_test(G, s, t, flow, cap); 104 101 int i=0; 105 102 while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { … … 122 119 123 120 { 124 typedef TrivGraphWrapper<const Graph> GW;125 GW gw(G);126 121 std::cout << "edmonds karp demo (physical blocking flow 1 augmentation)..." << std::endl; 127 GW::EdgeMap<int> flow(gw); //0 flow 128 129 Timer ts; 130 ts.reset(); 131 132 typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW; 133 EMW cw(cap); 134 MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw); 122 Graph::EdgeMap<int> flow(G); //0 flow 123 124 Timer ts; 125 ts.reset(); 126 127 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 128 max_flow_test(G, s, t, flow, cap); 135 129 int i=0; 136 130 while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) { … … 153 147 154 148 { 155 typedef TrivGraphWrapper<const Graph> GW;156 GW gw(G);157 149 std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl; 158 GW::EdgeMap<int> flow(gw); //0 flow 159 160 Timer ts; 161 ts.reset(); 162 163 typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW; 164 EMW cw(cap); 165 MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw); 150 Graph::EdgeMap<int> flow(G); //0 flow 151 152 Timer ts; 153 ts.reset(); 154 155 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 156 max_flow_test(G, s, t, flow, cap); 166 157 int i=0; 167 158 while (max_flow_test.augmentOnBlockingFlow2()) { … … 184 175 185 176 { 186 typedef TrivGraphWrapper<const Graph> GW;187 GW gw(G);188 177 std::cout << "edmonds karp demo (on-the-fly shortest path augmentation)..." << std::endl; 189 GW::EdgeMap<int> flow(gw); //0 flow 190 191 Timer ts; 192 ts.reset(); 193 194 typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW; 195 EMW cw(cap); 196 MaxFlow<GW, int, GW::EdgeMap<int>, EMW> max_flow_test(gw, s, t, flow, cw); 178 Graph::EdgeMap<int> flow(G); //0 flow 179 180 Timer ts; 181 ts.reset(); 182 183 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 184 max_flow_test(G, s, t, flow, cap); 197 185 int i=0; 198 186 while (max_flow_test.augmentOnShortestPath()) { -
src/work/marci/experiment/iterator_bfs_demo.cc
r281 r303 6 6 #include <list_graph.h> 7 7 //#include <smart_graph.h> 8 #include <bfs_iterator _1.h>9 #include <graph_wrapper _1.h>8 #include <bfs_iterator.h> 9 #include <graph_wrapper.h> 10 10 11 11 using namespace hugo; -
src/work/marci/experiment/iterator_bfs_demo_1.cc
r281 r303 6 6 #include <list_graph.h> 7 7 #include <smart_graph.h> 8 #include <bfs_iterator .h>9 #include <graph_wrapper .h>8 #include <bfs_iterator_1.h> 9 #include <graph_wrapper_1.h> 10 10 11 11 using namespace hugo; -
src/work/marci/graph_wrapper.h
r279 r303 13 13 14 14 public: 15 typedef Graph BaseGraph; 15 typedef Graph ParentGraph; 16 17 // TrivGraphWrapper() : graph(0) { } 18 TrivGraphWrapper(Graph& _graph) : graph(&_graph) { } 19 // void setGraph(Graph& _graph) { graph = &_graph; } 20 // Graph& getGraph() const { return *graph; } 16 21 17 22 typedef typename Graph::Node Node; … … 25 30 }; 26 31 typedef typename Graph::Edge Edge; 27 //typedef typename Graph::OutEdgeIt OutEdgeIt;28 32 class OutEdgeIt : public Graph::OutEdgeIt { 29 33 public: … … 34 38 Graph::OutEdgeIt(*(_G.graph), n) { } 35 39 }; 36 //typedef typename Graph::InEdgeIt InEdgeIt;37 40 class InEdgeIt : public Graph::InEdgeIt { 38 41 public: … … 44 47 }; 45 48 //typedef typename Graph::SymEdgeIt SymEdgeIt; 46 //typedef typename Graph::EdgeIt EdgeIt;47 49 class EdgeIt : public Graph::EdgeIt { 48 50 public: … … 54 56 }; 55 57 56 //TrivGraphWrapper() : graph(0) { }57 TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }58 59 // void setGraph(Graph& _graph) { graph = &_graph; }60 // Graph& getGraph() const { return (*graph); }61 62 58 NodeIt& first(NodeIt& i) const { 63 59 i=NodeIt(*this); … … 69 65 } 70 66 // template<typename I> I& first(I& i) const { 71 // //return graph->first(i);72 67 // i=I(*this); 73 68 // return i; … … 82 77 } 83 78 // template<typename I, typename P> I& first(I& i, const P& p) const { 84 // //return graph->first(i, p);85 79 // i=I(*this, p); 86 80 // return i; … … 92 86 93 87 template< typename It > It first() const { 94 It e; first(e); return e; }88 It e; this->first(e); return e; } 95 89 96 90 template< typename It > It first(const Node& v) const { 97 It e; first(e, v); return e; }91 It e; this->first(e, v); return e; } 98 92 99 93 Node head(const Edge& e) const { return graph->head(e); } 100 94 Node tail(const Edge& e) const { return graph->tail(e); } 101 95 102 template<typename I> bool valid(const I& i) const 103 {return graph->valid(i); }96 template<typename I> bool valid(const I& i) const { 97 return graph->valid(i); } 104 98 105 99 //template<typename I> void setInvalid(const I &i); … … 138 132 }; 139 133 140 template<typename Map, typename T> class NodeMapWrapper { 141 protected: 142 Map* map; 143 public: 144 NodeMapWrapper(Map& _map) : map(&_map) { } 145 //template<typename T> 146 void set(Node n, T a) { map->set(n, a); } 147 //template<typename T> 148 T get(Node n) const { return map->get(n); } 149 }; 150 151 template<typename Map, typename T> class EdgeMapWrapper { 152 protected: 153 Map* map; 154 public: 155 EdgeMapWrapper(Map& _map) : map(&_map) { } 156 //template<typename T> 157 void set(Edge n, T a) { map->set(n, a); } 158 //template<typename T> 159 T get(Edge n) const { return map->get(n); } 160 }; 134 // template<typename Map, typename T> class NodeMapWrapper { 135 // protected: 136 // Map* map; 137 // public: 138 // NodeMapWrapper(Map& _map) : map(&_map) { } 139 // void set(Node n, T a) { map->set(n, a); } 140 // T get(Node n) const { return map->get(n); } 141 // }; 142 143 // template<typename Map, typename T> class EdgeMapWrapper { 144 // protected: 145 // Map* map; 146 // public: 147 // EdgeMapWrapper(Map& _map) : map(&_map) { } 148 // void set(Edge n, T a) { map->set(n, a); } 149 // T get(Edge n) const { return map->get(n); } 150 // }; 161 151 }; 162 152 163 template<typename GraphWrapper> 164 class GraphWrapperSkeleton { 153 154 template<typename Graph> 155 class GraphWrapper { 165 156 protected: 166 Graph Wrapper gw;157 Graph* graph; 167 158 168 159 public: 169 //typedef typename GraphWrapper::BaseGraph BaseGraph; 170 171 // typedef typename GraphWrapper::Node Node; 172 // typedef typename GraphWrapper::NodeIt NodeIt; 173 174 // typedef typename GraphWrapper::Edge Edge; 175 // typedef typename GraphWrapper::OutEdgeIt OutEdgeIt; 176 // typedef typename GraphWrapper::InEdgeIt InEdgeIt; 177 // //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt; 178 // typedef typename GraphWrapper::EdgeIt EdgeIt; 179 180 typedef typename GraphWrapper::Node Node; 181 class NodeIt : public GraphWrapper::NodeIt { 160 typedef Graph ParentGraph; 161 162 // GraphWrapper() : graph(0) { } 163 GraphWrapper(Graph& _graph) : graph(&_graph) { } 164 // void setGraph(Graph& _graph) { graph=&_graph; } 165 // Graph& getGraph() const { return *graph; } 166 167 typedef typename Graph::Node Node; 168 class NodeIt : public Graph::NodeIt { 182 169 public: 183 170 NodeIt() { } 184 NodeIt(const typename GraphWrapper::NodeIt& n) : 185 GraphWrapper::NodeIt(n) { } 186 NodeIt(const Invalid& i) : GraphWrapper::NodeIt(i) { } 187 NodeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) : 188 GraphWrapper::NodeIt(_G.gw) { } 189 }; 190 typedef typename GraphWrapper::Edge Edge; 191 //typedef typename GraphWrapper::OutEdgeIt OutEdgeIt; 192 class OutEdgeIt : public GraphWrapper::OutEdgeIt { 171 NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { } 172 NodeIt(const Invalid& i) : Graph::NodeIt(i) { } 173 NodeIt(const GraphWrapper<Graph>& _G) : 174 Graph::NodeIt(*(_G.graph)) { } 175 }; 176 typedef typename Graph::Edge Edge; 177 class OutEdgeIt : public Graph::OutEdgeIt { 193 178 public: 194 179 OutEdgeIt() { } 195 OutEdgeIt(const typename GraphWrapper::OutEdgeIt& e) : 196 GraphWrapper::OutEdgeIt(e) { } 197 OutEdgeIt(const Invalid& i) : GraphWrapper::OutEdgeIt(i) { } 198 OutEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) : 199 GraphWrapper::OutEdgeIt(_G.gw, n) { } 200 }; 201 //typedef typename GraphWrapper::InEdgeIt InEdgeIt; 202 class InEdgeIt : public GraphWrapper::InEdgeIt { 180 OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { } 181 OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { } 182 OutEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) : 183 Graph::OutEdgeIt(*(_G.graph), n) { } 184 }; 185 class InEdgeIt : public Graph::InEdgeIt { 203 186 public: 204 187 InEdgeIt() { } 205 InEdgeIt(const typename GraphWrapper::InEdgeIt& e) : 206 GraphWrapper::InEdgeIt(e) { } 207 InEdgeIt(const Invalid& i) : GraphWrapper::InEdgeIt(i) { } 208 InEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) : 209 GraphWrapper::InEdgeIt(_G.gw, n) { } 210 }; 211 //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt; 212 //typedef typename GraphWrapper::EdgeIt EdgeIt; 213 class EdgeIt : public GraphWrapper::EdgeIt { 188 InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { } 189 InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { } 190 InEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) : 191 Graph::InEdgeIt(*(_G.graph), n) { } 192 }; 193 //typedef typename Graph::SymEdgeIt SymEdgeIt; 194 class EdgeIt : public Graph::EdgeIt { 214 195 public: 215 196 EdgeIt() { } 216 EdgeIt(const typename GraphWrapper::EdgeIt& e) : 217 GraphWrapper::EdgeIt(e) { } 218 EdgeIt(const Invalid& i) : GraphWrapper::EdgeIt(i) { } 219 EdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) : 220 GraphWrapper::EdgeIt(_G.gw) { } 221 }; 222 223 224 //GraphWrapperSkeleton() : gw() { } 225 GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { } 226 227 //void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); } 228 //BaseGraph& getGraph() const { return gw.getGraph(); } 229 230 template<typename I> I& first(I& i) const { 231 i=I(*this); 197 EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { } 198 EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { } 199 EdgeIt(const GraphWrapper<Graph>& _G) : 200 Graph::EdgeIt(*(_G.graph)) { } 201 }; 202 203 NodeIt& first(NodeIt& i) const { 204 i=NodeIt(*this); 232 205 return i; 233 206 } 234 template<typename I, typename P> I& first(I& i, const P& p) const { 235 i=I(*this, p); 236 return i; 237 } 238 239 // template<typename I> I getNext(const I& i) const { return gw.getNext(i); } 240 template<typename I> I& next(I &i) const { gw.next(i); return i; } 207 EdgeIt& first(EdgeIt& i) const { 208 i=EdgeIt(*this); 209 return i; 210 } 211 // template<typename I> I& first(I& i) const { 212 // i=I(*this); 213 // return i; 214 // } 215 OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 216 i=OutEdgeIt(*this, p); 217 return i; 218 } 219 InEdgeIt& first(InEdgeIt& i, const Node& p) const { 220 i=InEdgeIt(*this, p); 221 return i; 222 } 223 // template<typename I, typename P> I& first(I& i, const P& p) const { 224 // i=I(*this, p); 225 // return i; 226 // } 227 228 // template<typename I> I getNext(const I& i) const { 229 // return gw.getNext(i); } 230 template<typename I> I& next(I &i) const { graph->next(i); return i; } 241 231 242 232 template< typename It > It first() const { … … 246 236 It e; this->first(e, v); return e; } 247 237 248 Node head(const Edge& e) const { return gw.head(e); } 249 Node tail(const Edge& e) const { return gw.tail(e); } 250 251 template<typename I> bool valid(const I& i) const { return gw.valid(i); } 238 Node head(const Edge& e) const { return graph->head(e); } 239 Node tail(const Edge& e) const { return graph->tail(e); } 240 241 template<typename I> bool valid(const I& i) const { 242 return graph->valid(i); } 252 243 253 244 //template<typename I> void setInvalid(const I &i); 254 245 //{ return graph->setInvalid(i); } 255 246 256 int nodeNum() const { return gw.nodeNum(); } 257 int edgeNum() const { return gw.edgeNum(); } 258 259 template<typename I> Node aNode(const I& e) const { return gw.aNode(e); } 260 template<typename I> Node bNode(const I& e) const { return gw.bNode(e); } 261 262 Node addNode() const { return gw.addNode(); } 247 int nodeNum() const { return graph->nodeNum(); } 248 int edgeNum() const { return graph->edgeNum(); } 249 250 template<typename I> Node aNode(const I& e) const { 251 return graph->aNode(e); } 252 template<typename I> Node bNode(const I& e) const { 253 return graph->bNode(e); } 254 255 Node addNode() const { return graph->addNode(); } 263 256 Edge addEdge(const Node& tail, const Node& head) const { 264 return g w.addEdge(tail, head); }265 266 template<typename I> void erase(const I& i) const { g w.erase(i); }267 268 void clear() const { g w.clear(); }269 270 template<typename T> class NodeMap : public Graph Wrapper::NodeMap<T> {271 public: 272 NodeMap(const GraphWrapper Skeleton<GraphWrapper>& _G) :273 Graph Wrapper::NodeMap<T>(_G.gw) { }274 NodeMap(const GraphWrapper Skeleton<GraphWrapper>& _G, T a) :275 Graph Wrapper::NodeMap<T>(_G.gw, a) { }276 }; 277 278 template<typename T> class EdgeMap : public Graph Wrapper::EdgeMap<T> {279 public: 280 EdgeMap(const GraphWrapper Skeleton<GraphWrapper>& _G) :281 Graph Wrapper::EdgeMap<T>(_G.gw) { }282 EdgeMap(const GraphWrapper Skeleton<GraphWrapper>& _G, T a) :283 Graph Wrapper::EdgeMap<T>(_G.gw, a) { }257 return graph->addEdge(tail, head); } 258 259 template<typename I> void erase(const I& i) const { graph->erase(i); } 260 261 void clear() const { graph->clear(); } 262 263 template<typename T> class NodeMap : public Graph::NodeMap<T> { 264 public: 265 NodeMap(const GraphWrapper<Graph>& _G) : 266 Graph::NodeMap<T>(*(_G.graph)) { } 267 NodeMap(const GraphWrapper<Graph>& _G, T a) : 268 Graph::NodeMap<T>(*(_G.graph), a) { } 269 }; 270 271 template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 272 public: 273 EdgeMap(const GraphWrapper<Graph>& _G) : 274 Graph::EdgeMap<T>(*(_G.graph)) { } 275 EdgeMap(const GraphWrapper<Graph>& _G, T a) : 276 Graph::EdgeMap<T>(*(_G.graph), a) { } 284 277 }; 285 278 }; 279 286 280 287 281 // template<typename Graph> … … 292 286 293 287 // public: 294 // typedef Graph BaseGraph;288 // typedef Graph ParentGraph; 295 289 296 290 // typedef typename Graph::Node Node; … … 365 359 // }; 366 360 367 // template<typename /*Graph*/GraphWrapper 368 // /*=typename GraphWrapperSkeleton< TrivGraphWrapper<Graph>*/ > 369 // class RevGraphWrapper : 370 // public GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/ { 371 // protected: 372 // //Graph* graph; 373 374 // public: 375 // //typedef Graph BaseGraph; 376 377 // //typedef typename Graph::Node Node; 378 // //typedef typename Graph::NodeIt NodeIt; 379 380 // //typedef typename Graph::Edge Edge; 381 // typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::OutEdgeIt InEdgeIt; 382 // typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::InEdgeIt OutEdgeIt; 383 // //typedef typename Graph::SymEdgeIt SymEdgeIt; 384 // //typedef typename Graph::EdgeIt EdgeIt; 385 386 // //RevGraphWrapper() : graph(0) { } 387 // RevGraphWrapper(GraphWrapper _gw/*BaseGraph& _graph*/) : GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/(_gw/*TrivGraphWrapper<Graph>(_graph)*/) { } 388 389 // //void setGraph(Graph& _graph) { graph = &_graph; } 390 // //Graph& getGraph() const { return (*graph); } 391 392 // //template<typename I> I& first(I& i) const { return graph->first(i); } 393 // //template<typename I, typename P> I& first(I& i, const P& p) const { 394 // // return graph->first(i, p); } 395 396 // //template<typename I> I getNext(const I& i) const { 397 // // return graph->getNext(i); } 398 // //template<typename I> I& next(I &i) const { return graph->next(i); } 399 400 // //template< typename It > It first() const { 401 // // It e; first(e); return e; } 402 403 // //template< typename It > It first(const Node& v) const { 404 // // It e; first(e, v); return e; } 405 406 // //Node head(const Edge& e) const { return graph->tail(e); } 407 // //Node tail(const Edge& e) const { return graph->head(e); } 408 409 // //template<typename I> bool valid(const I& i) const 410 // // { return graph->valid(i); } 411 412 // //template<typename I> void setInvalid(const I &i); 413 // //{ return graph->setInvalid(i); } 414 415 // //template<typename I> Node aNode(const I& e) const { 416 // // return graph->aNode(e); } 417 // //template<typename I> Node bNode(const I& e) const { 418 // // return graph->bNode(e); } 419 420 // //Node addNode() const { return graph->addNode(); } 421 // //Edge addEdge(const Node& tail, const Node& head) const { 422 // // return graph->addEdge(tail, head); } 423 424 // //int nodeNum() const { return graph->nodeNum(); } 425 // //int edgeNum() const { return graph->edgeNum(); } 426 427 // //template<typename I> void erase(const I& i) const { graph->erase(i); } 428 429 // //void clear() const { graph->clear(); } 430 431 // template<typename T> class NodeMap : 432 // public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T> 433 // { 434 // public: 435 // NodeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 436 // GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw) { } 437 // NodeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 438 // GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw, a) { } 439 // }; 440 441 // template<typename T> class EdgeMap : 442 // public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T> { 443 // public: 444 // EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 445 // GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw) { } 446 // EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 447 // GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { } 448 // }; 449 // }; 450 451 template<typename GraphWrapper> 452 class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> { 361 362 template<typename Graph> 363 class RevGraphWrapper : public GraphWrapper<Graph> { 453 364 public: 454 typedef typename GraphWrapper Skeleton<GraphWrapper>::Node Node;455 typedef typename GraphWrapper Skeleton<GraphWrapper>::Edge Edge;365 typedef typename GraphWrapper<Graph>::Node Node; 366 typedef typename GraphWrapper<Graph>::Edge Edge; 456 367 //FIXME 457 //If Graph Wrapper::OutEdgeIt is not defined368 //If Graph::OutEdgeIt is not defined 458 369 //and we do not want to use RevGraphWrapper::InEdgeIt, 459 370 //this won't work, because of typedef … … 462 373 //Unfortunately all the typedefs are instantiated in templates, 463 374 //unlike other stuff 464 typedef typename GraphWrapper Skeleton<GraphWrapper>::OutEdgeIt InEdgeIt;465 typedef typename GraphWrapper Skeleton<GraphWrapper>::InEdgeIt OutEdgeIt;466 467 RevGraphWrapper(GraphWrapper _gw) : 468 GraphWrapperSkeleton<GraphWrapper>(_gw) { }375 typedef typename GraphWrapper<Graph>::OutEdgeIt InEdgeIt; 376 typedef typename GraphWrapper<Graph>::InEdgeIt OutEdgeIt; 377 378 // RevGraphWrapper() : GraphWrapper<Graph>() { } 379 RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } 469 380 470 381 Node head(const Edge& e) const 471 { return GraphWrapper Skeleton<GraphWrapper>::tail(e); }382 { return GraphWrapper<Graph>::tail(e); } 472 383 Node tail(const Edge& e) const 473 { return GraphWrapper Skeleton<GraphWrapper>::head(e); }384 { return GraphWrapper<Graph>::head(e); } 474 385 }; 475 386 476 387 //Subgraph on the same node-set and partial edge-set 477 template<typename Graph Wrapper, typename EdgeFilterMap>478 class SubGraphWrapper : public GraphWrapper Skeleton<GraphWrapper> {388 template<typename Graph, typename EdgeFilterMap> 389 class SubGraphWrapper : public GraphWrapper<Graph> { 479 390 protected: 480 391 EdgeFilterMap* filter_map; 481 392 public: 482 typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node; 483 typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt; 484 typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge; 485 typedef typename GraphWrapperSkeleton<GraphWrapper>::EdgeIt EdgeIt; 486 typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt InEdgeIt; 487 typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt OutEdgeIt; 488 489 SubGraphWrapper(GraphWrapper _gw, EdgeFilterMap& _filter_map) : 490 GraphWrapperSkeleton<GraphWrapper>(_gw), filter_map(&_filter_map) { } 393 typedef typename GraphWrapper<Graph>::Node Node; 394 typedef typename GraphWrapper<Graph>::NodeIt NodeIt; 395 typedef typename GraphWrapper<Graph>::Edge Edge; 396 typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt; 397 typedef typename GraphWrapper<Graph>::InEdgeIt InEdgeIt; 398 typedef typename GraphWrapper<Graph>::OutEdgeIt OutEdgeIt; 399 400 // SubGraphWrapper() : GraphWrapper<Graph>(), filter_map(0) { } 401 SubGraphWrapper(Graph& _graph, EdgeFilterMap& _filter_map) : 402 GraphWrapper<Graph>(_graph), filter_map(&_filter_map) { } 491 403 492 404 template<typename I> I& first(I& i) const { 493 gw.first(i); 494 while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } 405 graph->first(i); 406 //while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); } 407 while (graph->valid(i) && !(*filter_map)[i]) { graph->next(i); } 495 408 return i; 496 409 } 497 410 template<typename I, typename P> I& first(I& i, const P& p) const { 498 gw.first(i, p); 499 while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } 411 graph->first(i, p); 412 // while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); } 413 while (graph->valid(i) && !(*filter_map)[i]) { graph->next(i); } 500 414 return i; 501 415 } … … 505 419 //} 506 420 template<typename I> I& next(I &i) const { 507 gw.next(i); 508 while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } 421 graph->next(i); 422 // while (graph->valid(i) && !filter_map-get(i)) { graph->next(i); } 423 while (graph->valid(i) && !(*filter_map)[i]) { graph->next(i); } 509 424 return i; 510 425 } … … 524 439 525 440 // public: 526 // typedef GraphWrapper BaseGraph;441 // typedef GraphWrapper ParentGraph; 527 442 528 443 // typedef typename GraphWrapper::Node Node; … … 677 592 678 593 679 template<typename Graph Wrapper>680 class UndirGraphWrapper : public GraphWrapper Skeleton<GraphWrapper> {594 template<typename Graph> 595 class UndirGraphWrapper : public GraphWrapper<Graph> { 681 596 protected: 682 // GraphWrapper gw; 683 597 typedef typename Graph::Edge GraphEdge; 598 typedef typename Graph::OutEdgeIt GraphOutEdgeIt; 599 typedef typename Graph::InEdgeIt GraphInEdgeIt; 684 600 public: 685 //typedef GraphWrapper BaseGraph; 686 687 typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node; 688 typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt; 689 690 //private: 691 //FIXME ezeknek valojaban a GraphWrapper megfelelo dolgai kellene hogy 692 //legyenek, at kell irni 693 typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 694 GraphWrapper::Edge GraphEdge; 695 typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 696 GraphWrapper::OutEdgeIt GraphOutEdgeIt; 697 typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 698 GraphWrapper::InEdgeIt GraphInEdgeIt; 699 //public: 700 701 //UndirGraphWrapper() : graph(0) { } 702 UndirGraphWrapper(GraphWrapper _gw) : 703 GraphWrapperSkeleton<GraphWrapper>(_gw) { } 704 705 //UndirGraphWrapper(GraphWrapper _gw) : gw(_gw) { } 706 707 //void setGraph(Graph& _graph) { graph = &_graph; } 708 //Graph& getGraph() const { return (*graph); } 709 601 typedef typename GraphWrapper<Graph>::Node Node; 602 typedef typename GraphWrapper<Graph>::NodeIt NodeIt; 603 604 // UndirGraphWrapper() : GraphWrapper<Graph>() { } 605 UndirGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } 606 710 607 class Edge { 711 friend class UndirGraphWrapper<Graph Wrapper>;608 friend class UndirGraphWrapper<Graph>; 712 609 protected: 713 610 bool out_or_in; //true iff out … … 742 639 743 640 class OutEdgeIt : public Edge { 744 friend class UndirGraphWrapper<Graph Wrapper>;641 friend class UndirGraphWrapper<Graph>; 745 642 public: 746 643 OutEdgeIt() : Edge() { } 747 644 OutEdgeIt(const Invalid& i) : Edge(i) { } 748 OutEdgeIt(const UndirGraphWrapper<Graph Wrapper>& _G, const Node& n)645 OutEdgeIt(const UndirGraphWrapper<Graph>& _G, const Node& n) 749 646 : Edge() { 750 out_or_in=true; _G.g w.first(out, n);751 if (!(_G.g w.valid(out))) { out_or_in=false; _G.gw.first(in, n); }647 out_or_in=true; _G.graph->first(out, n); 648 if (!(_G.graph->valid(out))) { out_or_in=false; _G.graph->first(in, n); } 752 649 } 753 650 }; … … 756 653 757 654 class EdgeIt : public Edge { 758 friend class UndirGraphWrapper<Graph Wrapper>;655 friend class UndirGraphWrapper<Graph>; 759 656 protected: 760 657 NodeIt v; … … 762 659 EdgeIt() : Edge() { } 763 660 EdgeIt(const Invalid& i) : Edge(i) { } 764 EdgeIt(const UndirGraphWrapper<Graph Wrapper>& _G)661 EdgeIt(const UndirGraphWrapper<Graph>& _G) 765 662 : Edge() { 766 663 out_or_in=true; 767 664 //Node v; 768 665 _G.first(v); 769 if (_G.valid(v)) _G.g w.first(out); else out=INVALID;770 while (_G.valid(v) && !_G.g w.valid(out)) {771 _G.g w.next(v);772 if (_G.valid(v)) _G.g w.first(out);666 if (_G.valid(v)) _G.graph->first(out); else out=INVALID; 667 while (_G.valid(v) && !_G.graph->valid(out)) { 668 _G.graph->next(v); 669 if (_G.valid(v)) _G.graph->first(out); 773 670 } 774 671 } … … 776 673 777 674 OutEdgeIt& first(OutEdgeIt& e, const Node& n) const { 778 e.out_or_in=true; g w.first(e.out, n);779 if (!(g w.valid(e.out))) { e.out_or_in=false; gw.first(e.in, n); }675 e.out_or_in=true; graph->first(e.out, n); 676 if (!(graph->valid(e.out))) { e.out_or_in=false; graph->first(e.in, n); } 780 677 return e; 781 678 } … … 785 682 //NodeIt v; 786 683 first(e.v); 787 if (valid(e.v)) g w.first(e.out, e.v); else e.out=INVALID;788 while (valid(e.v) && !g w.valid(e.out)) {789 g w.next(e.v);790 if (valid(e.v)) g w.first(e.out, e.v);684 if (valid(e.v)) graph->first(e.out, e.v); else e.out=INVALID; 685 while (valid(e.v) && !graph->valid(e.out)) { 686 graph->next(e.v); 687 if (valid(e.v)) graph->first(e.out, e.v); 791 688 } 792 689 return e; 793 690 } 794 691 795 template<typename I> I& first(I& i) const { g w.first(i); return i; }692 template<typename I> I& first(I& i) const { graph->first(i); return i; } 796 693 template<typename I, typename P> I& first(I& i, const P& p) const { 797 g w.first(i, p); return i; }694 graph->first(i, p); return i; } 798 695 799 696 OutEdgeIt& next(OutEdgeIt& e) const { 800 697 if (e.out_or_in) { 801 Node n=g w.tail(e.out);802 g w.next(e.out);803 if (!g w.valid(e.out)) { e.out_or_in=false; gw.first(e.in, n); }698 Node n=graph->tail(e.out); 699 graph->next(e.out); 700 if (!graph->valid(e.out)) { e.out_or_in=false; graph->first(e.in, n); } 804 701 } else { 805 g w.next(e.in);702 graph->next(e.in); 806 703 } 807 704 return e; … … 810 707 EdgeIt& next(EdgeIt& e) const { 811 708 //NodeIt v=tail(e); 812 g w.next(e.out);813 while (valid(e.v) && !g w.valid(e.out)) {709 graph->next(e.out); 710 while (valid(e.v) && !graph->valid(e.out)) { 814 711 next(e.v); 815 if (valid(e.v)) g w.first(e.out, e.v);712 if (valid(e.v)) graph->first(e.out, e.v); 816 713 } 817 714 return e; 818 715 } 819 716 820 template<typename I> I& next(I &i) const { return g w.next(i); }717 template<typename I> I& next(I &i) const { return graph->next(i); } 821 718 // template<typename I> I getNext(const I& i) const { return gw.getNext(i); } 822 719 823 720 template< typename It > It first() const { 824 It e; first(e); return e; }721 It e; this->first(e); return e; } 825 722 826 723 template< typename It > It first(const Node& v) const { 827 It e; first(e, v); return e; }724 It e; this->first(e, v); return e; } 828 725 829 726 // Node head(const Edge& e) const { return gw.head(e); } … … 842 739 843 740 Node aNode(const OutEdgeIt& e) const { 844 if (e.out_or_in) return g w.tail(e); else return gw.head(e); }741 if (e.out_or_in) return graph->tail(e); else return graph->head(e); } 845 742 Node bNode(const OutEdgeIt& e) const { 846 if (e.out_or_in) return g w.head(e); else return gw.tail(e); }743 if (e.out_or_in) return graph->head(e); else return graph->tail(e); } 847 744 848 745 // Node addNode() const { return gw.addNode(); } … … 856 753 // void clear() const { gw.clear(); } 857 754 858 // template<typename T> class NodeMap : public Graph Wrapper::NodeMap<T> {859 // public: 860 // NodeMap(const UndirGraphWrapper<Graph Wrapper>& _G) :861 // Graph Wrapper::NodeMap<T>(_G.gw) { }862 // NodeMap(const UndirGraphWrapper<Graph Wrapper>& _G, T a) :863 // Graph Wrapper::NodeMap<T>(_G.gw, a) { }755 // template<typename T> class NodeMap : public Graph::NodeMap<T> { 756 // public: 757 // NodeMap(const UndirGraphWrapper<Graph>& _G) : 758 // Graph::NodeMap<T>(_G.gw) { } 759 // NodeMap(const UndirGraphWrapper<Graph>& _G, T a) : 760 // Graph::NodeMap<T>(_G.gw, a) { } 864 761 // }; 865 762 866 763 // template<typename T> class EdgeMap : 867 // public GraphWrapperSkeleton<Graph Wrapper>::EdgeMap<T> {868 // public: 869 // EdgeMap(const UndirGraphWrapper<Graph Wrapper>& _G) :870 // GraphWrapperSkeleton<Graph Wrapper>::EdgeMap<T>(_G.gw) { }871 // EdgeMap(const UndirGraphWrapper<Graph Wrapper>& _G, T a) :872 // Graph Wrapper::EdgeMap<T>(_G.gw, a) { }764 // public GraphWrapperSkeleton<Graph>::EdgeMap<T> { 765 // public: 766 // EdgeMap(const UndirGraphWrapper<Graph>& _G) : 767 // GraphWrapperSkeleton<Graph>::EdgeMap<T>(_G.gw) { } 768 // EdgeMap(const UndirGraphWrapper<Graph>& _G, T a) : 769 // Graph::EdgeMap<T>(_G.gw, a) { } 873 770 // }; 874 771 }; … … 884 781 885 782 // public: 886 // typedef Graph BaseGraph;783 // typedef Graph ParentGraph; 887 784 888 785 // typedef typename Graph::Node Node; … … 947 844 948 845 949 template<typename Graph Wrapper, typename Number, typename FlowMap, typename CapacityMap>950 class ResGraphWrapper : public GraphWrapper Skeleton<GraphWrapper>{846 template<typename Graph, typename Number, typename FlowMap, typename CapacityMap> 847 class ResGraphWrapper : public GraphWrapper<Graph>{ 951 848 public: 952 //typedef Graph BaseGraph; 953 //typedef TrivGraphWrapper<const Graph> GraphWrapper; 954 typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node; 955 typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt; 956 private: 957 typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 958 GraphWrapper::OutEdgeIt OldOutEdgeIt; 959 typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 960 GraphWrapper::InEdgeIt OldInEdgeIt; 849 typedef typename GraphWrapper<Graph>::Node Node; 850 typedef typename GraphWrapper<Graph>::NodeIt NodeIt; 961 851 protected: 962 //const Graph* graph; 963 //GraphWrapper gw; 852 typedef typename Graph::OutEdgeIt GraphOutEdgeIt; 853 typedef typename Graph::InEdgeIt GraphInEdgeIt; 854 typedef typename Graph::Edge GraphEdge; 964 855 FlowMap* flow; 965 856 const CapacityMap* capacity; 966 857 public: 967 858 968 ResGraphWrapper( const GraphWrapper& _gw, FlowMap& _flow,859 ResGraphWrapper(Graph& _graph, FlowMap& _flow, 969 860 const CapacityMap& _capacity) : 970 GraphWrapperSkeleton<GraphWrapper>(_gw), 971 flow(&_flow), capacity(&_capacity) { } 972 973 //void setGraph(const Graph& _graph) { graph = &_graph; } 974 //const Graph& getGraph() const { return (*graph); } 861 GraphWrapper<Graph>(_graph), flow(&_flow), capacity(&_capacity) { } 975 862 976 863 class Edge; … … 980 867 981 868 class Edge { 982 friend class ResGraphWrapper<Graph Wrapper, Number, FlowMap, CapacityMap>;869 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>; 983 870 protected: 984 871 bool out_or_in; //true, iff out 985 OldOutEdgeIt out;986 OldInEdgeIt in;872 GraphOutEdgeIt out; 873 GraphInEdgeIt in; 987 874 public: 988 875 Edge() : out_or_in(true) { } … … 1002 889 return (u.out_or_in || u.in!=v.in); 1003 890 } 891 operator GraphEdge() const { 892 if (out_or_in) return(out); else return(in); 893 } 1004 894 }; 1005 895 1006 896 1007 897 class OutEdgeIt : public Edge { 1008 friend class ResGraphWrapper<Graph Wrapper, Number, FlowMap, CapacityMap>;898 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>; 1009 899 public: 1010 900 OutEdgeIt() { } … … 1013 903 OutEdgeIt(const Invalid& i) : Edge(i) { } 1014 904 protected: 1015 OutEdgeIt(const ResGraphWrapper<Graph Wrapper, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() {1016 resG.g w.first(out, v);1017 while( resG.g w.valid(out) && !(resG.resCap(out)>0) ) { resG.gw.next(out); }1018 if (!resG.g w.valid(out)) {905 OutEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() { 906 resG.graph->first(out, v); 907 while( resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); } 908 if (!resG.graph->valid(out)) { 1019 909 out_or_in=0; 1020 resG.g w.first(in, v);1021 while( resG.g w.valid(in) && !(resG.resCap(in)>0) ) { resG.gw.next(in); }910 resG.graph->first(in, v); 911 while( resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); } 1022 912 } 1023 913 } … … 1045 935 1046 936 class EdgeIt : public Edge { 1047 friend class ResGraphWrapper<Graph Wrapper, Number, FlowMap, CapacityMap>;937 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>; 1048 938 NodeIt v; 1049 939 public: … … 1051 941 //EdgeIt(const EdgeIt& e) : Edge(e), v(e.v) { } 1052 942 EdgeIt(const Invalid& i) : Edge(i) { } 1053 EdgeIt(const ResGraphWrapper<Graph Wrapper, Number, FlowMap, CapacityMap>& resG) : Edge() {1054 resG.g w.first(v);1055 if (resG.g w.valid(v)) resG.gw.first(out, v); else out=INVALID;1056 while (resG.g w.valid(out) && !(resG.resCap(out)>0) ) { resG.gw.next(out); }1057 while (resG.g w.valid(v) && !resG.gw.valid(out)) {1058 resG.g w.next(v);1059 if (resG.g w.valid(v)) resG.gw.first(out, v);1060 while (resG.g w.valid(out) && !(resG.resCap(out)>0) ) { resG.gw.next(out); }943 EdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG) : Edge() { 944 resG.graph->first(v); 945 if (resG.graph->valid(v)) resG.graph->first(out, v); else out=INVALID; 946 while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); } 947 while (resG.graph->valid(v) && !resG.graph->valid(out)) { 948 resG.graph->next(v); 949 if (resG.graph->valid(v)) resG.graph->first(out, v); 950 while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); } 1061 951 } 1062 if (!resG.g w.valid(out)) {952 if (!resG.graph->valid(out)) { 1063 953 out_or_in=0; 1064 resG.g w.first(v);1065 if (resG.g w.valid(v)) resG.gw.first(in, v); else in=INVALID;1066 while (resG.g w.valid(in) && !(resG.resCap(in)>0) ) { resG.gw.next(in); }1067 while (resG.g w.valid(v) && !resG.gw.valid(in)) {1068 resG.g w.next(v);1069 if (resG.g w.valid(v)) resG.gw.first(in, v);1070 while (resG.g w.valid(in) && !(resG.resCap(in)>0) ) { resG.gw.next(in); }954 resG.graph->first(v); 955 if (resG.graph->valid(v)) resG.graph->first(in, v); else in=INVALID; 956 while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); } 957 while (resG.graph->valid(v) && !resG.graph->valid(in)) { 958 resG.graph->next(v); 959 if (resG.graph->valid(v)) resG.graph->first(in, v); 960 while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); } 1071 961 } 1072 962 } … … 1084 974 // out_or_in=0; 1085 975 // G->first(v); 1086 // if (v.valid()) G->first(in, v); else in= OldInEdgeIt();976 // if (v.valid()) G->first(in, v); else in=GraphInEdgeIt(); 1087 977 // while (in.valid() && !(Edge::resCap()>0) ) { ++in; } 1088 978 // while (v.valid() && !in.valid()) { … … 1105 995 }; 1106 996 1107 NodeIt& first(NodeIt& v) const { g w.first(v); return v; }997 NodeIt& first(NodeIt& v) const { graph->first(v); return v; } 1108 998 OutEdgeIt& first(OutEdgeIt& e, Node v) const { 1109 999 e=OutEdgeIt(*this, v); … … 1115 1005 } 1116 1006 1117 NodeIt& next(NodeIt& n) const { return g w.next(n); }1007 NodeIt& next(NodeIt& n) const { return graph->next(n); } 1118 1008 1119 1009 OutEdgeIt& next(OutEdgeIt& e) const { 1120 1010 if (e.out_or_in) { 1121 Node v=g w.aNode(e.out);1122 g w.next(e.out);1123 while( g w.valid(e.out) && !(resCap(e.out)>0) ) { gw.next(e.out); }1124 if (!g w.valid(e.out)) {1011 Node v=graph->aNode(e.out); 1012 graph->next(e.out); 1013 while( graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); } 1014 if (!graph->valid(e.out)) { 1125 1015 e.out_or_in=0; 1126 g w.first(e.in, v);1127 while( g w.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }1016 graph->first(e.in, v); 1017 while( graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); } 1128 1018 } 1129 1019 } else { 1130 g w.next(e.in);1131 while( g w.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }1020 graph->next(e.in); 1021 while( graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); } 1132 1022 } 1133 1023 return e; … … 1136 1026 EdgeIt& next(EdgeIt& e) const { 1137 1027 if (e.out_or_in) { 1138 g w.next(e.out);1139 while (g w.valid(e.out) && !(resCap(e.out)>0) ) { gw.next(e.out); }1140 while (g w.valid(e.v) && !gw.valid(e.out)) {1141 g w.next(e.v);1142 if (g w.valid(e.v)) gw.first(e.out, e.v);1143 while (g w.valid(e.out) && !(resCap(e.out)>0) ) { gw.next(e.out); }1028 graph->next(e.out); 1029 while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); } 1030 while (graph->valid(e.v) && !graph->valid(e.out)) { 1031 graph->next(e.v); 1032 if (graph->valid(e.v)) graph->first(e.out, e.v); 1033 while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); } 1144 1034 } 1145 if (!g w.valid(e.out)) {1035 if (!graph->valid(e.out)) { 1146 1036 e.out_or_in=0; 1147 g w.first(e.v);1148 if (g w.valid(e.v)) gw.first(e.in, e.v); else e.in=INVALID;1149 while (g w.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }1150 while (g w.valid(e.v) && !gw.valid(e.in)) {1151 g w.next(e.v);1152 if (g w.valid(e.v)) gw.first(e.in, e.v);1153 while (g w.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }1037 graph->first(e.v); 1038 if (graph->valid(e.v)) graph->first(e.in, e.v); else e.in=INVALID; 1039 while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); } 1040 while (graph->valid(e.v) && !graph->valid(e.in)) { 1041 graph->next(e.v); 1042 if (graph->valid(e.v)) graph->first(e.in, e.v); 1043 while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); } 1154 1044 } 1155 1045 } 1156 1046 } else { 1157 g w.next(e.in);1158 while (g w.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }1159 while (g w.valid(e.v) && !gw.valid(e.in)) {1160 g w.next(e.v);1161 if (g w.valid(e.v)) gw.first(e.in, e.v);1162 while (g w.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }1047 graph->next(e.in); 1048 while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); } 1049 while (graph->valid(e.v) && !graph->valid(e.in)) { 1050 graph->next(e.v); 1051 if (graph->valid(e.v)) graph->first(e.in, e.v); 1052 while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); } 1163 1053 } 1164 1054 } … … 1182 1072 1183 1073 Node tail(Edge e) const { 1184 return ((e.out_or_in) ? g w.aNode(e.out) : gw.aNode(e.in)); }1074 return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); } 1185 1075 Node head(Edge e) const { 1186 return ((e.out_or_in) ? g w.bNode(e.out) : gw.bNode(e.in)); }1076 return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); } 1187 1077 1188 1078 Node aNode(OutEdgeIt e) const { 1189 return ((e.out_or_in) ? g w.aNode(e.out) : gw.aNode(e.in)); }1079 return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); } 1190 1080 Node bNode(OutEdgeIt e) const { 1191 return ((e.out_or_in) ? g w.bNode(e.out) : gw.bNode(e.in)); }1192 1193 int nodeNum() const { return g w.nodeNum(); }1081 return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); } 1082 1083 int nodeNum() const { return graph->nodeNum(); } 1194 1084 //FIXME 1195 //int edgeNum() const { return g w.edgeNum(); }1196 1197 1198 int id(Node v) const { return g w.id(v); }1199 1200 bool valid(Node n) const { return g w.valid(n); }1085 //int edgeNum() const { return graph->edgeNum(); } 1086 1087 1088 int id(Node v) const { return graph->id(v); } 1089 1090 bool valid(Node n) const { return graph->valid(n); } 1201 1091 bool valid(Edge e) const { 1202 return e.out_or_in ? g w.valid(e.out) : gw.valid(e.in); }1092 return e.out_or_in ? graph->valid(e.out) : graph->valid(e.in); } 1203 1093 1204 1094 void augment(const Edge& e, Number a) const { 1205 1095 if (e.out_or_in) 1206 flow->set(e.out, flow->get(e.out)+a); 1096 // flow->set(e.out, flow->get(e.out)+a); 1097 flow->set(e.out, (*flow)[e.out]+a); 1207 1098 else 1208 flow->set(e.in, flow->get(e.in)-a); 1099 // flow->set(e.in, flow->get(e.in)-a); 1100 flow->set(e.in, (*flow)[e.in]-a); 1209 1101 } 1210 1102 1211 1103 Number resCap(const Edge& e) const { 1212 1104 if (e.out_or_in) 1213 return (capacity->get(e.out)-flow->get(e.out)); 1105 // return (capacity->get(e.out)-flow->get(e.out)); 1106 return ((*capacity)[e.out]-(*flow)[e.out]); 1214 1107 else 1215 return (flow->get(e.in)); 1216 } 1217 1218 Number resCap(OldOutEdgeIt out) const { 1219 return (capacity->get(out)-flow->get(out)); 1220 } 1221 1222 Number resCap(OldInEdgeIt in) const { 1223 return (flow->get(in)); 1224 } 1225 1226 // template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> { 1227 // public: 1228 // NodeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G) 1229 // : GraphWrapper::NodeMap<T>(_G.gw) { } 1230 // NodeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G, 1231 // T a) : GraphWrapper::NodeMap<T>(_G.gw, a) { } 1108 // return (flow->get(e.in)); 1109 return ((*flow)[e.in]); 1110 } 1111 1112 Number resCap(GraphOutEdgeIt out) const { 1113 // return (capacity->get(out)-flow->get(out)); 1114 return ((*capacity)[out]-(*flow)[out]); 1115 } 1116 1117 Number resCap(GraphInEdgeIt in) const { 1118 // return (flow->get(in)); 1119 return ((*flow)[in]); 1120 } 1121 1122 // template<typename T> class NodeMap : public Graph::NodeMap<T> { 1123 // public: 1124 // NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) 1125 // : Graph::NodeMap<T>(_G.gw) { } 1126 // NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, 1127 // T a) : Graph::NodeMap<T>(_G.gw, a) { } 1232 1128 // }; 1233 1129 … … 1244 1140 template <typename T> 1245 1141 class EdgeMap { 1246 typename Graph Wrapper::EdgeMap<T> forward_map, backward_map;1247 public: 1248 EdgeMap(const ResGraphWrapper<Graph Wrapper, Number, FlowMap, CapacityMap>& _G) : forward_map(_G.gw), backward_map(_G.gw) { }1249 EdgeMap(const ResGraphWrapper<Graph Wrapper, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(_G.gw, a), backward_map(_G.gw, a) { }1142 typename Graph::EdgeMap<T> forward_map, backward_map; 1143 public: 1144 EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { } 1145 EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { } 1250 1146 void set(Edge e, T a) { 1251 1147 if (e.out_or_in) … … 1254 1150 backward_map.set(e.in, a); 1255 1151 } 1256 T get(Edge e){1152 T operator[](Edge e) const { 1257 1153 if (e.out_or_in) 1258 return forward_map .get(e.out);1154 return forward_map[e.out]; 1259 1155 else 1260 return backward_map .get(e.in);1156 return backward_map[e.in]; 1261 1157 } 1158 // T get(Edge e) const { 1159 // if (e.out_or_in) 1160 // return forward_map.get(e.out); 1161 // else 1162 // return backward_map.get(e.in); 1163 // } 1262 1164 }; 1263 1165 }; 1264 1166 1265 // Subgraph on the same node-set and partial edge-set1266 template<typename Graph Wrapper, typename FirstOutEdgesMap>1267 class ErasingFirstGraphWrapper : public GraphWrapper Skeleton<GraphWrapper> {1167 //ErasingFirstGraphWrapper for blocking flows 1168 template<typename Graph, typename FirstOutEdgesMap> 1169 class ErasingFirstGraphWrapper : public GraphWrapper<Graph> { 1268 1170 protected: 1269 1171 FirstOutEdgesMap* first_out_edges; 1270 1172 public: 1271 typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node; 1272 typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt; 1273 typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge; 1274 typedef typename GraphWrapperSkeleton<GraphWrapper>::EdgeIt EdgeIt; 1275 typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt InEdgeIt; 1276 typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt OutEdgeIt; 1277 1278 ErasingFirstGraphWrapper(GraphWrapper _gw, FirstOutEdgesMap& _first_out_edges) : 1279 GraphWrapperSkeleton<GraphWrapper>(_gw), first_out_edges(&_first_out_edges) { } 1173 typedef typename GraphWrapper<Graph>::Node Node; 1174 typedef typename GraphWrapper<Graph>::NodeIt NodeIt; 1175 typedef typename GraphWrapper<Graph>::Edge Edge; 1176 typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt; 1177 typedef typename GraphWrapper<Graph>::InEdgeIt InEdgeIt; 1178 typedef typename GraphWrapper<Graph>::OutEdgeIt OutEdgeIt; 1179 1180 ErasingFirstGraphWrapper(Graph& _graph, 1181 FirstOutEdgesMap& _first_out_edges) : 1182 GraphWrapper<Graph>(_graph), first_out_edges(&_first_out_edges) { } 1280 1183 1281 1184 template<typename I> I& first(I& i) const { 1282 gw.first(i); 1283 //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } 1185 graph->first(i); 1284 1186 return i; 1285 1187 } 1286 1188 OutEdgeIt& first(OutEdgeIt& e, const Node& n) const { 1287 e=first_out_edges->get(n); 1189 // e=first_out_edges->get(n); 1190 e=(*first_out_edges)[n]; 1288 1191 return e; 1289 1192 } 1290 1193 template<typename I, typename P> I& first(I& i, const P& p) const { 1291 gw.first(i, p); 1292 //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } 1194 graph->first(i, p); 1293 1195 return i; 1294 1196 } … … 1298 1200 //} 1299 1201 template<typename I> I& next(I &i) const { 1300 gw.next(i); 1301 //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } 1202 graph->next(i); 1302 1203 return i; 1303 1204 } … … 1315 1216 } 1316 1217 }; 1317 1318 // template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>1319 // class ErasingResGraphWrapper : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap> {1320 // protected:1321 // ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt> first_out_edges;1322 // //ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<int> dist;1323 // public:1324 // ErasingResGraphWrapper(const Graph& _G, FlowMap& _flow,1325 // const CapacityMap& _capacity) :1326 // ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>(_G, _flow, _capacity),1327 // first_out_edges(*this) /*, dist(*this)*/ {1328 // for(NodeIt n=this->template first<NodeIt>(); this->valid(n); this->next(n)) {1329 // OutEdgeIt e;1330 // ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(e, n);1331 // first_out_edges.set(n, e);1332 // }1333 // }1334 1335 // //void setGraph(Graph& _graph) { graph = &_graph; }1336 // //Graph& getGraph() const { return (*graph); }1337 1338 // //TrivGraphWrapper() : graph(0) { }1339 // //ErasingResGraphWrapper(Graph& _graph) : graph(&_graph) { }1340 1341 // //typedef Graph BaseGraph;1342 1343 // //typedef typename Graph::Node Node;1344 // //typedef typename Graph::NodeIt NodeIt;1345 1346 // //typedef typename Graph::Edge Edge;1347 // //typedef typename Graph::OutEdgeIt OutEdgeIt;1348 // //typedef typename Graph::InEdgeIt InEdgeIt;1349 // //typedef typename Graph::SymEdgeIt SymEdgeIt;1350 // //typedef typename Graph::EdgeIt EdgeIt;1351 1352 // typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Node Node;1353 // typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeIt NodeIt;1354 1355 // typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Edge Edge;1356 // typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt OutEdgeIt;1357 // //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::InEdgeIt InEdgeIt;1358 // //typedef typename Graph::SymEdgeIt SymEdgeIt;1359 // //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;1360 1361 // NodeIt& first(NodeIt& n) const {1362 // return ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(n);1363 // }1364 1365 // OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {1366 // e=first_out_edges.get(n);1367 // return e;1368 // }1369 1370 // //ROSSZ template<typename I> I& first(I& i) const { return first(i); }1371 // //ROSSZ template<typename I, typename P> I& first(I& i, const P& p) const {1372 // // return first(i, p); }1373 1374 // //template<typename I> I getNext(const I& i) const {1375 // // return gw.getNext(i); }1376 // //template<typename I> I& next(I &i) const { return gw.next(i); }1377 1378 // template< typename It > It first() const {1379 // It e; first(e); return e; }1380 1381 // template< typename It > It first(const Node& v) const {1382 // It e; first(e, v); return e; }1383 1384 // //Node head(const Edge& e) const { return gw.head(e); }1385 // //Node tail(const Edge& e) const { return gw.tail(e); }1386 1387 // //template<typename I> bool valid(const I& i) const1388 // // { return gw.valid(i); }1389 1390 // //int nodeNum() const { return gw.nodeNum(); }1391 // //int edgeNum() const { return gw.edgeNum(); }1392 1393 // //template<typename I> Node aNode(const I& e) const {1394 // // return gw.aNode(e); }1395 // //template<typename I> Node bNode(const I& e) const {1396 // // return gw.bNode(e); }1397 1398 // //Node addNode() const { return gw.addNode(); }1399 // //Edge addEdge(const Node& tail, const Node& head) const {1400 // // return gw.addEdge(tail, head); }1401 1402 // //void erase(const OutEdgeIt& e) {1403 // // first_out_edge(this->tail(e))=e;1404 // //}1405 // void erase(const Edge& e) {1406 // OutEdgeIt f(e);1407 // next(f);1408 // first_out_edges.set(this->tail(e), f);1409 // }1410 // //template<typename I> void erase(const I& i) const { gw.erase(i); }1411 1412 // //void clear() const { gw.clear(); }1413 1414 // template<typename T> class NodeMap : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T> {1415 // public:1416 // NodeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) :1417 // ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/) { }1418 // NodeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) :1419 // ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/, a) { }1420 // };1421 1422 // template<typename T> class EdgeMap : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T> {1423 // public:1424 // EdgeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) :1425 // ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/) { }1426 // EdgeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) :1427 // ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/, a) { }1428 // };1429 // };1430 1431 // template<typename GraphWrapper>1432 // class FilterGraphWrapper {1433 // };1434 1435 // template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>1436 // class FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> > : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> {1437 1438 // //Graph* graph;1439 1440 // public:1441 // //typedef Graph BaseGraph;1442 1443 // typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Node Node;1444 // typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeIt NodeIt;1445 1446 // typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Edge Edge;1447 // typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt OutEdgeIt;1448 // //typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::InEdgeIt InEdgeIt;1449 // //typedef typename Graph::SymEdgeIt SymEdgeIt;1450 // typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;1451 1452 // //FilterGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt> first_out_edges;1453 1454 // public:1455 // FilterGraphWrapper(const Graph& _G, FlowMap& _flow,1456 // const CapacityMap& _capacity) :1457 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>(_G, _flow, _capacity), dist(*this, gw.nodeNum()) {1458 // }1459 1460 // OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {1461 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(e, n);1462 // while (valid(e) && (dist.get(tail(e))/*+1!=*/>=dist.get(head(e))))1463 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);1464 // return e;1465 // }1466 1467 // NodeIt& next(NodeIt& e) const {1468 // return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);1469 // }1470 1471 // OutEdgeIt& next(OutEdgeIt& e) const {1472 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);1473 // while (valid(e) && (dist.get(tail(e))/*+1!*/>=dist.get(head(e))))1474 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);1475 // return e;1476 // }1477 1478 // NodeIt& first(NodeIt& n) const {1479 // return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(n);1480 // }1481 1482 // void erase(const Edge& e) {1483 // OutEdgeIt f(e);1484 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(f);1485 // while (valid(f) && (dist.get(tail(f))/*+1!=*/>=dist.get(head(f))))1486 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(f);1487 // first_out_edges.set(this->tail(e), f);1488 // }1489 1490 // //TrivGraphWrapper() : graph(0) { }1491 // //TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }1492 1493 // //void setGraph(Graph& _graph) { graph = &_graph; }1494 // //Graph& getGraph() const { return (*graph); }1495 1496 // //template<typename I> I& first(I& i) const { return gw.first(i); }1497 // //template<typename I, typename P> I& first(I& i, const P& p) const {1498 // // return gw.first(i, p); }1499 1500 // //template<typename I> I getNext(const I& i) const {1501 // // return gw.getNext(i); }1502 // //template<typename I> I& next(I &i) const { return gw.next(i); }1503 1504 // template< typename It > It first() const {1505 // It e; first(e); return e; }1506 1507 // template< typename It > It first(const Node& v) const {1508 // It e; first(e, v); return e; }1509 1510 // //Node head(const Edge& e) const { return gw.head(e); }1511 // //Node tail(const Edge& e) const { return gw.tail(e); }1512 1513 // //template<typename I> bool valid(const I& i) const1514 // // { return gw.valid(i); }1515 1516 // //template<typename I> void setInvalid(const I &i);1517 // //{ return gw.setInvalid(i); }1518 1519 // //int nodeNum() const { return gw.nodeNum(); }1520 // //int edgeNum() const { return gw.edgeNum(); }1521 1522 // //template<typename I> Node aNode(const I& e) const {1523 // // return gw.aNode(e); }1524 // //template<typename I> Node bNode(const I& e) const {1525 // // return gw.bNode(e); }1526 1527 // //Node addNode() const { return gw.addNode(); }1528 // //Edge addEdge(const Node& tail, const Node& head) const {1529 // // return gw.addEdge(tail, head); }1530 1531 // //template<typename I> void erase(const I& i) const { gw.erase(i); }1532 1533 // //void clear() const { gw.clear(); }1534 1535 // template<typename T> class NodeMap : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T> {1536 // public:1537 // NodeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G) :1538 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/) { }1539 // NodeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G, T a) :1540 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/, a) { }1541 // };1542 1543 // template<typename T> class EdgeMap : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T> {1544 // public:1545 // EdgeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G) :1546 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/) { }1547 // EdgeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G, T a) :1548 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/, a) { }1549 // };1550 1551 // public:1552 // ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<int> dist;1553 1554 // };1555 1556 1557 1218 1558 1219 // // FIXME: comparison should be made better!!! … … 1563 1224 1564 1225 // public: 1565 // typedef Graph BaseGraph;1226 // typedef Graph ParentGraph; 1566 1227 1567 1228 // typedef typename Graph::Node Node; -
src/work/marci/makefile
r271 r303 3 3 #CXX3.3 = g++ 4 4 CXX3 := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++) 5 CXX=$(CXX3) 6 CC=$(CXX) 5 7 #CXXFLAGS = -W -Wall -ansi -pedantic -I. -I.. -I../alpar 6 8 #LEDAROOT ?= /ledasrc/LEDA-4.1 … … 11 13 12 14 LEDABINARIES = lg_vs_sg leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo 13 BINARIES = edmonds_karp_demo gw_vs_not14 # preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda15 BINARIES = edmonds_karp_demo iterator_bfs_demo 16 #gw_vs_not preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda 15 17 16 18 all: $(BINARIES) 17 19 18 20 .depend dep depend: 19 - g++$(INCLUDEDIRS) -M $(BINARIES:=.cc) > .depend #2>/dev/null21 -$(CXX) $(INCLUDEDIRS) -M $(BINARIES:=.cc) > .depend #2>/dev/null 20 22 # -g++ $(INCLUDEDIRS) $(LEDAINCLUDE) -M $(LEDABINARIES:=.cc) >> .depend #2>/dev/null 21 23
Note: See TracChangeset
for help on using the changeset viewer.