Changeset 330:7ac0d4e8a31c in lemon-0.x for src/work/marci/graph_wrapper.h
- Timestamp:
- 04/15/04 16:41:20 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@448
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/graph_wrapper.h
r323 r330 897 897 898 898 899 template<typename Graph, typename Number, typename FlowMap, typename CapacityMap> 899 template<typename Graph, typename Number, 900 typename CapacityMap, typename FlowMap> 900 901 class ResGraphWrapper : public GraphWrapper<Graph> { 901 902 protected: … … 903 904 // typedef typename Graph::InEdgeIt GraphInEdgeIt; 904 905 // typedef typename Graph::Edge GraphEdge; 906 const CapacityMap* capacity; 905 907 FlowMap* flow; 906 const CapacityMap* capacity;907 908 public: 908 909 909 ResGraphWrapper(Graph& _graph, FlowMap& _flow,910 const CapacityMap& _capacity) :911 GraphWrapper<Graph>(_graph), flow(&_flow), capacity(&_capacity) { }910 ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity, 911 FlowMap& _flow) : 912 GraphWrapper<Graph>(_graph), capacity(&_capacity), flow(&_flow) { } 912 913 913 914 class Edge; … … 919 920 typedef typename GraphWrapper<Graph>::NodeIt NodeIt; 920 921 class Edge : public Graph::Edge { 921 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;922 friend class ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>; 922 923 protected: 923 924 bool forward; //true, iff forward … … 941 942 }; 942 943 // class Edge { 943 // friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;944 // friend class ResGraphWrapper<Graph, Number,lksd FlowMap, CapacityMap>; 944 945 // protected: 945 946 // bool out_or_in; //true, iff out … … 968 969 // }; 969 970 class OutEdgeIt { 970 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;971 friend class ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>; 971 972 protected: 972 973 typename Graph::OutEdgeIt out; … … 979 980 OutEdgeIt(const Invalid& i) : out(i), in(i), forward(false) { } 980 981 //the unique invalid iterator 981 OutEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, Node v) {982 OutEdgeIt(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& resG, Node v) { 982 983 forward=true; 983 984 resG.graph->first(out, v); … … 1001 1002 }; 1002 1003 // class OutEdgeIt : public Edge { 1003 // friend class ResGraphWrapper<Graph, Number, F lowMap, CapacityMap>;1004 // friend class ResGraphWrapper<Graph, Number, FkklowMap, CapacityMap>; 1004 1005 // public: 1005 1006 // OutEdgeIt() { } … … 1007 1008 // OutEdgeIt(const Edge& e) : Edge(e) { } 1008 1009 // OutEdgeIt(const Invalid& i) : Edge(i) { } 1009 // OutEdgeIt(const ResGraphWrapper<Graph, Number, F lowMap, CapacityMap>& resG, Node v) : Edge() {1010 // OutEdgeIt(const ResGraphWrapper<Graph, Number, FdfvlowMap, CapacityMap>& resG, Node v) : Edge() { 1010 1011 // resG.graph->first(out, v); 1011 1012 // while( resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); } … … 1039 1040 1040 1041 class InEdgeIt { 1041 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;1042 friend class ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>; 1042 1043 protected: 1043 1044 typename Graph::OutEdgeIt out; … … 1050 1051 InEdgeIt(const Invalid& i) : out(i), in(i), forward(false) { } 1051 1052 //the unique invalid iterator 1052 InEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, Node v) {1053 InEdgeIt(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& resG, Node v) { 1053 1054 forward=true; 1054 1055 resG.graph->first(in, v); … … 1073 1074 1074 1075 class EdgeIt { 1075 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;1076 friend class ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>; 1076 1077 protected: 1077 1078 typename Graph::EdgeIt e; … … 1080 1081 EdgeIt() { } 1081 1082 EdgeIt(const Invalid& i) : e(i), forward(false) { } 1082 EdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG) {1083 EdgeIt(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& resG) { 1083 1084 forward=true; 1084 1085 resG.graph->first(e); … … 1095 1096 }; 1096 1097 // class EdgeIt : public Edge { 1097 // friend class ResGraphWrapper<Graph, Number, F lowMap, CapacityMap>;1098 // friend class ResGraphWrapper<Graph, Number, FflowMap, CapacityMap>; 1098 1099 // NodeIt v; 1099 1100 // public: … … 1101 1102 // //EdgeIt(const EdgeIt& e) : Edge(e), v(e.v) { } 1102 1103 // EdgeIt(const Invalid& i) : Edge(i) { } 1103 // EdgeIt(const ResGraphWrapper<Graph, Number, Fl owMap, CapacityMap>& resG) : Edge() {1104 // EdgeIt(const ResGraphWrapper<Graph, Number, FlfowMap, CapacityMap>& resG) : Edge() { 1104 1105 // resG.graph->first(v); 1105 1106 // if (resG.graph->valid(v)) resG.graph->first(out, v); else out=INVALID; … … 1318 1319 // template<typename T> class NodeMap : public Graph::NodeMap<T> { 1319 1320 // public: 1320 // NodeMap(const ResGraphWrapper<Graph, Number, Flo wMap, CapacityMap>& _G)1321 // NodeMap(const ResGraphWrapper<Graph, Number, FlovwMap, CapacityMap>& _G) 1321 1322 // : Graph::NodeMap<T>(_G.gw) { } 1322 // NodeMap(const ResGraphWrapper<Graph, Number, Flow Map, CapacityMap>& _G,1323 // NodeMap(const ResGraphWrapper<Graph, Number, FlowvMap, CapacityMap>& _G, 1323 1324 // T a) : Graph::NodeMap<T>(_G.gw, a) { } 1324 1325 // }; … … 1338 1339 typename Graph::EdgeMap<T> forward_map, backward_map; 1339 1340 public: 1340 EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { }1341 EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { }1341 EdgeMap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { } 1342 EdgeMap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { } 1342 1343 void set(Edge e, T a) { 1343 1344 if (e.forward)
Note: See TracChangeset
for help on using the changeset viewer.