lemon/bits/path_dump.h
changeset 2373 134639e6ea45
parent 2335 27aa03cd3121
child 2391 14a343be7a5a
equal deleted inserted replaced
0:559e2e6116e8 1:152948c1bcf4
       
     1 
     1 /* -*- C++ -*-
     2 /* -*- C++ -*-
     2  *
     3  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     4  * This file is a part of LEMON, a generic C++ optimization library
     4  *
     5  *
     5  * Copyright (C) 2003-2006
     6  * Copyright (C) 2003-2006
    47 
    48 
    48     bool empty() const {
    49     bool empty() const {
    49       return predMap[target] != INVALID;
    50       return predMap[target] != INVALID;
    50     }
    51     }
    51 
    52 
    52     class RevIt {
    53     class RevEdgeIt {
    53     public:
    54     public:
    54       RevIt() {}
    55       RevEdgeIt() {}
    55       RevIt(Invalid) : path(0), current(INVALID) {}
    56       RevEdgeIt(Invalid) : path(0), current(INVALID) {}
    56       RevIt(const PredMapPath& _path) 
    57       RevEdgeIt(const PredMapPath& _path) 
    57         : path(&_path), current(_path.target) {}
    58         : path(&_path), current(_path.target) {}
    58 
    59 
    59       operator const typename Graph::Edge() const {
    60       operator const typename Graph::Edge() const {
    60         return path->predMap[current];
    61         return path->predMap[current];
    61       }
    62       }
    62 
    63 
    63       RevIt& operator++() {
    64       RevEdgeIt& operator++() {
    64         current = path->graph.source(path->predMap[current]);
    65         current = path->graph.source(path->predMap[current]);
    65         if (path->predMap[current] == INVALID) current = INVALID;
    66         if (path->predMap[current] == INVALID) current = INVALID;
    66         return *this;
    67         return *this;
    67       }
    68       }
    68 
    69 
    69       bool operator==(const RevIt& e) const { 
    70       bool operator==(const RevEdgeIt& e) const { 
    70         return current == e.current; 
    71         return current == e.current; 
    71       }
    72       }
    72 
    73 
    73       bool operator!=(const RevIt& e) const {
    74       bool operator!=(const RevEdgeIt& e) const {
    74         return current != e.current; 
    75         return current != e.current; 
    75       }
    76       }
    76 
    77 
    77       bool operator<(const RevIt& e) const { 
    78       bool operator<(const RevEdgeIt& e) const { 
    78         return current < e.current; 
    79         return current < e.current; 
    79       }
    80       }
    80       
    81       
    81     private:
    82     private:
    82       const PredMapPath* path;
    83       const PredMapPath* path;
   119 
   120 
   120     bool empty() const {
   121     bool empty() const {
   121       return source != target;
   122       return source != target;
   122     }
   123     }
   123 
   124 
   124     class RevIt {
   125     class RevEdgeIt {
   125     public:
   126     public:
   126       RevIt() {}
   127       RevEdgeIt() {}
   127       RevIt(Invalid) : path(0), current(INVALID) {}
   128       RevEdgeIt(Invalid) : path(0), current(INVALID) {}
   128       RevIt(const PredMatrixMapPath& _path) 
   129       RevEdgeIt(const PredMatrixMapPath& _path) 
   129         : path(&_path), current(_path.target) {}
   130         : path(&_path), current(_path.target) {}
   130 
   131 
   131       operator const typename Graph::Edge() const {
   132       operator const typename Graph::Edge() const {
   132         return path->predMatrixMap(path->source, current);
   133         return path->predMatrixMap(path->source, current);
   133       }
   134       }
   134 
   135 
   135       RevIt& operator++() {
   136       RevEdgeIt& operator++() {
   136         current = 
   137         current = 
   137           path->graph.source(path->predMatrixMap(path->source, current));
   138           path->graph.source(path->predMatrixMap(path->source, current));
   138         if (path->predMatrixMap(path->source, current) == INVALID) 
   139         if (path->predMatrixMap(path->source, current) == INVALID) 
   139           current = INVALID;
   140           current = INVALID;
   140         return *this;
   141         return *this;
   141       }
   142       }
   142 
   143 
   143       bool operator==(const RevIt& e) const { 
   144       bool operator==(const RevEdgeIt& e) const { 
   144         return current == e.current; 
   145         return current == e.current; 
   145       }
   146       }
   146 
   147 
   147       bool operator!=(const RevIt& e) const {
   148       bool operator!=(const RevEdgeIt& e) const {
   148         return current != e.current; 
   149         return current != e.current; 
   149       }
   150       }
   150 
   151 
   151       bool operator<(const RevIt& e) const { 
   152       bool operator<(const RevEdgeIt& e) const { 
   152         return current < e.current; 
   153         return current < e.current; 
   153       }
   154       }
   154       
   155       
   155     private:
   156     private:
   156       const PredMatrixMapPath* path;
   157       const PredMatrixMapPath* path;