lemon/graph_utils.h
changeset 208 4317d277ba21
parent 169 5b507a86ad72
child 209 765619b7cbb2
equal deleted inserted replaced
6:dd5959d7af48 7:60f17be70719
   600         for (typename From::NodeIt it(from); it != INVALID; ++it) {
   600         for (typename From::NodeIt it(from); it != INVALID; ++it) {
   601           nodeRefMap[it] = to.addNode();
   601           nodeRefMap[it] = to.addNode();
   602         }
   602         }
   603         for (typename From::ArcIt it(from); it != INVALID; ++it) {
   603         for (typename From::ArcIt it(from); it != INVALID; ++it) {
   604           arcRefMap[it] = to.addArc(nodeRefMap[from.source(it)], 
   604           arcRefMap[it] = to.addArc(nodeRefMap[from.source(it)], 
   605                                           nodeRefMap[from.target(it)]);
   605 				    nodeRefMap[from.target(it)]);
   606         }
   606         }
   607       }
   607       }
   608     };
   608     };
   609 
   609 
   610     template <typename Digraph>
   610     template <typename Digraph>
   626                        NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
   626                        NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
   627         for (typename From::NodeIt it(from); it != INVALID; ++it) {
   627         for (typename From::NodeIt it(from); it != INVALID; ++it) {
   628           nodeRefMap[it] = to.addNode();
   628           nodeRefMap[it] = to.addNode();
   629         }
   629         }
   630         for (typename From::EdgeIt it(from); it != INVALID; ++it) {
   630         for (typename From::EdgeIt it(from); it != INVALID; ++it) {
   631           edgeRefMap[it] = to.addArc(nodeRefMap[from.source(it)], 
   631           edgeRefMap[it] = to.addEdge(nodeRefMap[from.u(it)], 
   632 				       nodeRefMap[from.target(it)]);
   632 				      nodeRefMap[from.v(it)]);
   633         }
   633         }
   634       }
   634       }
   635     };
   635     };
   636 
   636 
   637     template <typename Graph>
   637     template <typename Graph>
   923 
   923 
   924       typedef typename From::Arc Key;
   924       typedef typename From::Arc Key;
   925       typedef typename To::Arc Value;
   925       typedef typename To::Arc Value;
   926 
   926 
   927       Value operator[](const Key& key) const {
   927       Value operator[](const Key& key) const {
   928         bool forward = 
   928         bool forward = _from.u(key) != _from.v(key) ?
   929           (_from.direction(key) == 
   929 	  _node_ref[_from.source(key)] == 
   930 	   (_node_ref[_from.source(key)] == _to.source(_edge_ref[key])));
   930 	  _to.source(_to.direct(_edge_ref[key], true)) :
       
   931 	  _from.direction(key);
   931 	return _to.direct(_edge_ref[key], forward); 
   932 	return _to.direct(_edge_ref[key], forward); 
   932       }
   933       }
   933       
   934       
   934       const To& _to;
   935       const To& _to;
   935       const From& _from;
   936       const From& _from;