Bug fix in GraphCopy (ticket #117)
authorBalazs Dezso <deba@inf.elte.hu>
Thu, 10 Jul 2008 16:03:23 +0200
changeset 199e3aba2c72be4
parent 198 e80e08222fdf
child 200 c0e2c043c060
Bug fix in GraphCopy (ticket #117)
lemon/graph_utils.h
     1.1 --- a/lemon/graph_utils.h	Wed Jul 09 07:57:53 2008 +0200
     1.2 +++ b/lemon/graph_utils.h	Thu Jul 10 16:03:23 2008 +0200
     1.3 @@ -602,7 +602,7 @@
     1.4          }
     1.5          for (typename From::ArcIt it(from); it != INVALID; ++it) {
     1.6            arcRefMap[it] = to.addArc(nodeRefMap[from.source(it)], 
     1.7 -                                          nodeRefMap[from.target(it)]);
     1.8 +				    nodeRefMap[from.target(it)]);
     1.9          }
    1.10        }
    1.11      };
    1.12 @@ -628,8 +628,8 @@
    1.13            nodeRefMap[it] = to.addNode();
    1.14          }
    1.15          for (typename From::EdgeIt it(from); it != INVALID; ++it) {
    1.16 -          edgeRefMap[it] = to.addArc(nodeRefMap[from.source(it)], 
    1.17 -				       nodeRefMap[from.target(it)]);
    1.18 +          edgeRefMap[it] = to.addEdge(nodeRefMap[from.u(it)], 
    1.19 +				      nodeRefMap[from.v(it)]);
    1.20          }
    1.21        }
    1.22      };
    1.23 @@ -925,9 +925,10 @@
    1.24        typedef typename To::Arc Value;
    1.25  
    1.26        Value operator[](const Key& key) const {
    1.27 -        bool forward = 
    1.28 -          (_from.direction(key) == 
    1.29 -	   (_node_ref[_from.source(key)] == _to.source(_edge_ref[key])));
    1.30 +        bool forward = _from.u(key) != _from.v(key) ?
    1.31 +	  _node_ref[_from.source(key)] == 
    1.32 +	  _to.source(_to.direct(_edge_ref[key], true)) :
    1.33 +	  _from.direction(key);
    1.34  	return _to.direct(_edge_ref[key], forward); 
    1.35        }
    1.36