Changeset 658:b3564d0e9c60 in lemon-0.x for src/hugo
- Timestamp:
- 05/24/04 16:13:03 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@861
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/graph_wrapper.h
r656 r658 1376 1376 template<typename Graph, typename Number, 1377 1377 typename CapacityMap, typename FlowMap> 1378 class ForwardFilter {1379 const Graph* graph;1378 class ResForwardFilter { 1379 // const Graph* graph; 1380 1380 const CapacityMap* capacity; 1381 1381 const FlowMap* flow; 1382 1382 public: 1383 void setGraph(const Graph& _graph) { graph=&_graph; } 1383 ResForwardFilter(/*const Graph& _graph, */ 1384 const CapacityMap& _capacity, const FlowMap& _flow) : 1385 /*graph(&_graph),*/ capacity(&_capacity), flow(&_flow) { } 1386 ResForwardFilter() : /*graph(0),*/ capacity(0), flow(0) { } 1387 //void setGraph(const Graph& _graph) { graph=&_graph; } 1384 1388 void setCapacity(const CapacityMap& _capacity) { capacity=&_capacity; } 1385 1389 void setFlow(const FlowMap& _flow) { flow=&_flow; } 1386 ForwardFilter(const Graph& _graph,1387 const CapacityMap& _capacity, const FlowMap& _flow) :1388 graph(&_graph), capacity(&_capacity), flow(&_flow) { }1389 1390 bool operator[](const typename Graph::Edge& e) const { 1390 1391 return ((*flow)[e] < (*capacity)[e]); … … 1394 1395 template<typename Graph, typename Number, 1395 1396 typename CapacityMap, typename FlowMap> 1396 class BackwardFilter {1397 const Graph* graph;1397 class ResBackwardFilter { 1398 //const Graph* graph; 1398 1399 const CapacityMap* capacity; 1399 1400 const FlowMap* flow; 1400 1401 public: 1401 void setGraph(const Graph& _graph) { graph=&_graph; } 1402 ResBackwardFilter(/*const Graph& _graph,*/ 1403 const CapacityMap& _capacity, const FlowMap& _flow) : 1404 /*graph(&_graph),*/ capacity(&_capacity), flow(&_flow) { } 1405 ResBackwardFilter() : /*graph(0),*/ capacity(0), flow(0) { } 1406 //void setGraph(const Graph& _graph) { graph=&_graph; } 1402 1407 void setCapacity(const CapacityMap& _capacity) { capacity=&_capacity; } 1403 1408 void setFlow(const FlowMap& _flow) { flow=&_flow; } 1404 BackwardFilter(const Graph& _graph,1405 const CapacityMap& _capacity, const FlowMap& _flow) :1406 graph(&_graph), capacity(&_capacity), flow(&_flow) { }1407 1409 bool operator[](const typename Graph::Edge& e) const { 1408 1410 return (0 < (*flow)[e]); … … 1419 1421 public SubBidirGraphWrapper< 1420 1422 Graph, 1421 ForwardFilter<Graph, Number, CapacityMap, FlowMap>,1422 BackwardFilter<Graph, Number, CapacityMap, FlowMap> > {1423 ResForwardFilter<Graph, Number, CapacityMap, FlowMap>, 1424 ResBackwardFilter<Graph, Number, CapacityMap, FlowMap> > { 1423 1425 public: 1424 1426 typedef SubBidirGraphWrapper< 1425 1427 Graph, 1426 ForwardFilter<Graph, Number, CapacityMap, FlowMap>,1427 BackwardFilter<Graph, Number, CapacityMap, FlowMap> > Parent;1428 ResForwardFilter<Graph, Number, CapacityMap, FlowMap>, 1429 ResBackwardFilter<Graph, Number, CapacityMap, FlowMap> > Parent; 1428 1430 protected: 1429 1431 const CapacityMap* capacity; 1430 1432 FlowMap* flow; 1431 ForwardFilter<Graph, Number, CapacityMap, FlowMap> forward_filter; 1432 BackwardFilter<Graph, Number, CapacityMap, FlowMap> backward_filter; 1433 // ResGraphWrapper() : Parent(), 1434 // capacity(0), flow(0) { } 1435 // void setCapacityMap(const CapacityMap& _capacity) { 1436 // capacity=&_capacity; 1437 // } 1438 // void setFlowMap(FlowMap& _flow) { 1439 // flow=&_flow; 1433 ResForwardFilter<Graph, Number, CapacityMap, FlowMap> forward_filter; 1434 ResBackwardFilter<Graph, Number, CapacityMap, FlowMap> backward_filter; 1435 ResGraphWrapper() : Parent(), 1436 capacity(0), flow(0) { } 1437 void setCapacityMap(const CapacityMap& _capacity) { 1438 capacity=&_capacity; 1439 forward_filter.setCapacity(_capacity); 1440 backward_filter.setCapacity(_capacity); 1441 } 1442 void setFlowMap(FlowMap& _flow) { 1443 flow=&_flow; 1444 forward_filter.setFlow(_flow); 1445 backward_filter.setFlow(_flow); 1446 } 1447 // /// \bug does graph reference needed in filtermaps?? 1448 // void setGraph(const Graph& _graph) { 1449 // Parent::setGraph(_graph); 1450 // forward_filter.setGraph(_graph); 1451 // backward_filter.setGraph(_graph); 1440 1452 // } 1441 1453 public: … … 1443 1455 FlowMap& _flow) : 1444 1456 Parent(), capacity(&_capacity), flow(&_flow), 1445 forward_filter( _graph,_capacity, _flow),1446 backward_filter( _graph,_capacity, _flow) {1457 forward_filter(/*_graph,*/ _capacity, _flow), 1458 backward_filter(/*_graph,*/ _capacity, _flow) { 1447 1459 Parent::setGraph(_graph); 1448 1460 Parent::setForwardFilterMap(forward_filter);
Note: See TracChangeset
for help on using the changeset viewer.