COIN-OR::LEMON - Graph Library

Ticket #136: 79643f6e8c52.patch

File 79643f6e8c52.patch, 1.1 KB (added by Balazs Dezso, 12 years ago)
  • lemon/list_graph.h

    # HG changeset patch
    # User Balazs Dezso <deba@inf.elte.hu>
    # Date 1217332683 -7200
    # Node ID 79643f6e8c520e9c963c84f39eb091a460daa4fe
    # Parent  9c8efad5f587ab80bc4dc76918e4fdbc2adfc905
    Converting INVALID arc to INVALID edge
    
    diff -r 9c8efad5f587 -r 79643f6e8c52 lemon/list_graph.h
    a b  
    842842      explicit Arc(int pid) { id = pid;}
    843843
    844844    public:
    845       operator Edge() const { return edgeFromId(id / 2); }
     845      operator Edge() const {
     846        return id != -1 ? edgeFromId(id / 2) : INVALID;
     847      }
    846848
    847849      Arc() {}
    848850      Arc (Invalid) { id = -1; }
  • lemon/smart_graph.h

    diff -r 9c8efad5f587 -r 79643f6e8c52 lemon/smart_graph.h
    a b  
    465465      explicit Arc(int id) { _id = id;}
    466466
    467467    public:
    468       operator Edge() const { return edgeFromId(_id / 2); }
     468      operator Edge() const {
     469        return _id != -1 ? edgeFromId(_id / 2) : INVALID;
     470      }
    469471
    470472      Arc() {}
    471473      Arc (Invalid) { _id = -1; }