Converting INVALID arc to INVALID edge
authorBalazs Dezso <deba@inf.elte.hu>
Tue, 29 Jul 2008 13:58:03 +0200
changeset 23879643f6e8c52
parent 237 9c8efad5f587
child 239 7b7e3f20bcec
Converting INVALID arc to INVALID edge
lemon/list_graph.h
lemon/smart_graph.h
     1.1 --- a/lemon/list_graph.h	Tue Jul 29 10:27:36 2008 +0200
     1.2 +++ b/lemon/list_graph.h	Tue Jul 29 13:58:03 2008 +0200
     1.3 @@ -842,7 +842,9 @@
     1.4        explicit Arc(int pid) { id = pid;}
     1.5  
     1.6      public:
     1.7 -      operator Edge() const { return edgeFromId(id / 2); }
     1.8 +      operator Edge() const { 
     1.9 +        return id != -1 ? edgeFromId(id / 2) : INVALID; 
    1.10 +      }
    1.11  
    1.12        Arc() {}
    1.13        Arc (Invalid) { id = -1; }
     2.1 --- a/lemon/smart_graph.h	Tue Jul 29 10:27:36 2008 +0200
     2.2 +++ b/lemon/smart_graph.h	Tue Jul 29 13:58:03 2008 +0200
     2.3 @@ -465,7 +465,9 @@
     2.4        explicit Arc(int id) { _id = id;}
     2.5  
     2.6      public:
     2.7 -      operator Edge() const { return edgeFromId(_id / 2); }
     2.8 +      operator Edge() const { 
     2.9 +        return _id != -1 ? edgeFromId(_id / 2) : INVALID; 
    2.10 +      }
    2.11  
    2.12        Arc() {}
    2.13        Arc (Invalid) { _id = -1; }