src/lemon/graph_wrapper.h
changeset 991 e619a466ca5d
parent 986 e997802b855c
child 992 10d378f2821c
equal deleted inserted replaced
6:bb81a2045aa7 7:f8b8f538b9e4
  1119     /// one for the backward edges.
  1119     /// one for the backward edges.
  1120     class EdgeMap {
  1120     class EdgeMap {
  1121       template <typename TT> friend class EdgeMap;
  1121       template <typename TT> friend class EdgeMap;
  1122       typename Graph::template EdgeMap<T> forward_map, backward_map; 
  1122       typename Graph::template EdgeMap<T> forward_map, backward_map; 
  1123     public:
  1123     public:
  1124       typedef T ValueType;
  1124       typedef T Value;
  1125       typedef Edge KeyType;
  1125       typedef Edge Key;
  1126 
  1126 
  1127       EdgeMap(const SubBidirGraphWrapper<Graph, 
  1127       EdgeMap(const SubBidirGraphWrapper<Graph, 
  1128 	      ForwardFilterMap, BackwardFilterMap>& g) : 
  1128 	      ForwardFilterMap, BackwardFilterMap>& g) : 
  1129 	forward_map(*(g.graph)), backward_map(*(g.graph)) { }
  1129 	forward_map(*(g.graph)), backward_map(*(g.graph)) { }
  1130 
  1130 
  1148 	  forward_map.set(e, a); 
  1148 	  forward_map.set(e, a); 
  1149 	else 
  1149 	else 
  1150 	  backward_map.set(e, a); 
  1150 	  backward_map.set(e, a); 
  1151       }
  1151       }
  1152 
  1152 
  1153       typename Graph::template EdgeMap<T>::ConstReferenceType 
  1153       typename Graph::template EdgeMap<T>::ConstReference 
  1154       operator[](Edge e) const { 
  1154       operator[](Edge e) const { 
  1155 	if (!e.backward) 
  1155 	if (!e.backward) 
  1156 	  return forward_map[e]; 
  1156 	  return forward_map[e]; 
  1157 	else 
  1157 	else 
  1158 	  return backward_map[e]; 
  1158 	  return backward_map[e]; 
  1159       }
  1159       }
  1160 
  1160 
  1161       typename Graph::template EdgeMap<T>::ReferenceType 
  1161       typename Graph::template EdgeMap<T>::Reference 
  1162       operator[](Edge e) { 
  1162       operator[](Edge e) { 
  1163 	if (!e.backward) 
  1163 	if (!e.backward) 
  1164 	  return forward_map[e]; 
  1164 	  return forward_map[e]; 
  1165 	else 
  1165 	else 
  1166 	  return backward_map[e]; 
  1166 	  return backward_map[e]; 
  1343     /// as a map. 
  1343     /// as a map. 
  1344     class ResCap {
  1344     class ResCap {
  1345     protected:
  1345     protected:
  1346       const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>* res_graph;
  1346       const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>* res_graph;
  1347     public:
  1347     public:
  1348       typedef Number ValueType;
  1348       typedef Number Value;
  1349       typedef Edge KeyType;
  1349       typedef Edge Key;
  1350       ResCap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& 
  1350       ResCap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& 
  1351 	     _res_graph) : res_graph(&_res_graph) { }
  1351 	     _res_graph) : res_graph(&_res_graph) { }
  1352       Number operator[](const Edge& e) const { 
  1352       Number operator[](const Edge& e) const { 
  1353 	if (res_graph->forward(e)) 
  1353 	if (res_graph->forward(e)) 
  1354 	  return (*(res_graph->capacity))[e]-(*(res_graph->flow))[e]; 
  1354 	  return (*(res_graph->capacity))[e]-(*(res_graph->flow))[e];