# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1277213966 -7200
# Node ID 50446fbc0602435ce6d92911272a07c3b61286cf
# Parent 1aa7eba26af5b7d5d7962840670e1d73299ce7ee
Bug fix in (di)graphCopy() (#371)
The target graph is cleared before adding nodes and arcs/edges.
diff --git a/lemon/core.h b/lemon/core.h
a
|
b
|
|
384 | 384 | template <typename From, typename NodeRefMap, typename ArcRefMap> |
385 | 385 | static void copy(const From& from, Digraph &to, |
386 | 386 | NodeRefMap& nodeRefMap, ArcRefMap& arcRefMap) { |
| 387 | to.clear(); |
387 | 388 | for (typename From::NodeIt it(from); it != INVALID; ++it) { |
388 | 389 | nodeRefMap[it] = to.addNode(); |
389 | 390 | } |
… |
… |
|
411 | 412 | template <typename From, typename NodeRefMap, typename EdgeRefMap> |
412 | 413 | static void copy(const From& from, Graph &to, |
413 | 414 | NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) { |
| 415 | to.clear(); |
414 | 416 | for (typename From::NodeIt it(from); it != INVALID; ++it) { |
415 | 417 | nodeRefMap[it] = to.addNode(); |
416 | 418 | } |