# HG changeset patch # User Balazs Dezso # Date 2008-07-29 13:58:03 # Node ID 79643f6e8c520e9c963c84f39eb091a460daa4fe # Parent 9c8efad5f587ab80bc4dc76918e4fdbc2adfc905 Converting INVALID arc to INVALID edge diff --git a/lemon/list_graph.h b/lemon/list_graph.h --- a/lemon/list_graph.h +++ b/lemon/list_graph.h @@ -842,7 +842,9 @@ explicit Arc(int pid) { id = pid;} public: - operator Edge() const { return edgeFromId(id / 2); } + operator Edge() const { + return id != -1 ? edgeFromId(id / 2) : INVALID; + } Arc() {} Arc (Invalid) { id = -1; } diff --git a/lemon/smart_graph.h b/lemon/smart_graph.h --- a/lemon/smart_graph.h +++ b/lemon/smart_graph.h @@ -465,7 +465,9 @@ explicit Arc(int id) { _id = id;} public: - operator Edge() const { return edgeFromId(_id / 2); } + operator Edge() const { + return _id != -1 ? edgeFromId(_id / 2) : INVALID; + } Arc() {} Arc (Invalid) { _id = -1; }