COIN-OR::LEMON - Graph Library

Changeset 512:9b9ffe7d9b75 in lemon-1.2 for lemon/edge_set.h


Ignore:
Timestamp:
02/13/09 13:29:28 (11 years ago)
Author:
Balazs Dezso <deba@…>
Branch:
default
Phase:
public
Message:

Fixes for MSVC 2008 in grap_adaptors.h and edge_set.h (#194)

Several renamings and changes in adaptors and edge sets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/edge_set.h

    r468 r512  
    3030namespace lemon {
    3131
    32   template <typename _Graph>
     32  template <typename GR>
    3333  class ListArcSetBase {
    3434  public:
    3535
    36     typedef _Graph Graph;
    37     typedef typename Graph::Node Node;
    38     typedef typename Graph::NodeIt NodeIt;
     36    typedef GR Graph;
     37    typedef typename GR::Node Node;
     38    typedef typename GR::NodeIt NodeIt;
    3939
    4040  protected:
     
    4545    };
    4646
    47     typedef typename ItemSetTraits<Graph, Node>::
     47    typedef typename ItemSetTraits<GR, Node>::
    4848    template Map<NodeT>::Type NodesImplBase;
    4949
    50     NodesImplBase* nodes;
     50    NodesImplBase* _nodes;
    5151
    5252    struct ArcT {
     
    6262    int first_free_arc;
    6363
    64     const Graph* graph;
    65 
    66     void initalize(const Graph& _graph, NodesImplBase& _nodes) {
    67       graph = &_graph;
    68       nodes = &_nodes;
     64    const GR* _graph;
     65
     66    void initalize(const GR& graph, NodesImplBase& nodes) {
     67      _graph = &graph;
     68      _nodes = &nodes;
    6969    }
    7070
     
    7272
    7373    class Arc {
    74       friend class ListArcSetBase<Graph>;
     74      friend class ListArcSetBase<GR>;
    7575    protected:
    7676      Arc(int _id) : id(_id) {}
     
    9595        first_free_arc = arcs[first_free_arc].next_in;
    9696      }
    97       arcs[n].next_in = (*nodes)[v].first_in;
    98       if ((*nodes)[v].first_in != -1) {
    99         arcs[(*nodes)[v].first_in].prev_in = n;
    100       }
    101       (*nodes)[v].first_in = n;
    102       arcs[n].next_out = (*nodes)[u].first_out;
    103       if ((*nodes)[u].first_out != -1) {
    104         arcs[(*nodes)[u].first_out].prev_out = n;
    105       }
    106       (*nodes)[u].first_out = n;
     97      arcs[n].next_in = (*_nodes)[v].first_in;
     98      if ((*_nodes)[v].first_in != -1) {
     99        arcs[(*_nodes)[v].first_in].prev_in = n;
     100      }
     101      (*_nodes)[v].first_in = n;
     102      arcs[n].next_out = (*_nodes)[u].first_out;
     103      if ((*_nodes)[u].first_out != -1) {
     104        arcs[(*_nodes)[u].first_out].prev_out = n;
     105      }
     106      (*_nodes)[u].first_out = n;
    107107      arcs[n].source = u;
    108108      arcs[n].target = v;
     
    115115        arcs[arcs[n].prev_in].next_in = arcs[n].next_in;
    116116      } else {
    117         (*nodes)[arcs[n].target].first_in = arcs[n].next_in;
     117        (*_nodes)[arcs[n].target].first_in = arcs[n].next_in;
    118118      }
    119119      if (arcs[n].next_in != -1) {
     
    124124        arcs[arcs[n].prev_out].next_out = arcs[n].next_out;
    125125      } else {
    126         (*nodes)[arcs[n].source].first_out = arcs[n].next_out;
     126        (*_nodes)[arcs[n].source].first_out = arcs[n].next_out;
    127127      }
    128128      if (arcs[n].next_out != -1) {
     
    135135      Node node;
    136136      for (first(node); node != INVALID; next(node)) {
    137         (*nodes)[node].first_in = -1;
    138         (*nodes)[node].first_out = -1;
     137        (*_nodes)[node].first_in = -1;
     138        (*_nodes)[node].first_out = -1;
    139139      }
    140140      arcs.clear();
     
    144144
    145145    void first(Node& node) const {
    146       graph->first(node);
     146      _graph->first(node);
    147147    }
    148148
    149149    void next(Node& node) const {
    150       graph->next(node);
     150      _graph->next(node);
    151151    }
    152152
     
    154154      Node node;
    155155      first(node);
    156       while (node != INVALID && (*nodes)[node].first_in == -1) {
     156      while (node != INVALID && (*_nodes)[node].first_in == -1) {
    157157        next(node);
    158158      }
    159       arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_in;
     159      arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_in;
    160160    }
    161161
     
    166166        Node node = arcs[arc.id].target;
    167167        next(node);
    168         while (node != INVALID && (*nodes)[node].first_in == -1) {
     168        while (node != INVALID && (*_nodes)[node].first_in == -1) {
    169169          next(node);
    170170        }
    171         arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_in;
     171        arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_in;
    172172      }
    173173    }
    174174
    175175    void firstOut(Arc& arc, const Node& node) const {
    176       arc.id = (*nodes)[node].first_out;
     176      arc.id = (*_nodes)[node].first_out;
    177177    }
    178178
     
    182182
    183183    void firstIn(Arc& arc, const Node& node) const {
    184       arc.id = (*nodes)[node].first_in;
     184      arc.id = (*_nodes)[node].first_in;
    185185    }
    186186
     
    189189    }
    190190
    191     int id(const Node& node) const { return graph->id(node); }
     191    int id(const Node& node) const { return _graph->id(node); }
    192192    int id(const Arc& arc) const { return arc.id; }
    193193
    194     Node nodeFromId(int ix) const { return graph->nodeFromId(ix); }
     194    Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
    195195    Arc arcFromId(int ix) const { return Arc(ix); }
    196196
    197     int maxNodeId() const { return graph->maxNodeId(); };
     197    int maxNodeId() const { return _graph->maxNodeId(); };
    198198    int maxArcId() const { return arcs.size() - 1; }
    199199
     
    201201    Node target(const Arc& arc) const { return arcs[arc.id].target;}
    202202
    203     typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
     203    typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
    204204
    205205    NodeNotifier& notifier(Node) const {
    206       return graph->notifier(Node());
    207     }
    208 
    209     template <typename _Value>
    210     class NodeMap : public Graph::template NodeMap<_Value> {
     206      return _graph->notifier(Node());
     207    }
     208
     209    template <typename V>
     210    class NodeMap : public GR::template NodeMap<V> {
    211211    public:
    212212
    213       typedef typename _Graph::template NodeMap<_Value> Parent;
    214 
    215       explicit NodeMap(const ListArcSetBase<Graph>& arcset)
    216         : Parent(*arcset.graph) {}
    217 
    218       NodeMap(const ListArcSetBase<Graph>& arcset, const _Value& value)
    219         : Parent(*arcset.graph, value) {}
     213      typedef typename GR::template NodeMap<V> Parent;
     214
     215      explicit NodeMap(const ListArcSetBase<GR>& arcset)
     216        : Parent(*arcset._graph) {}
     217
     218      NodeMap(const ListArcSetBase<GR>& arcset, const V& value)
     219        : Parent(*arcset._graph, value) {}
    220220
    221221      NodeMap& operator=(const NodeMap& cmap) {
     
    251251  /// all arcs incident to the given node is erased from the arc set.
    252252  ///
    253   /// \param _Graph The type of the graph which shares its node set with
     253  /// \param GR The type of the graph which shares its node set with
    254254  /// this class. Its interface must conform to the
    255255  /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
     
    258258  /// This class is fully conform to the \ref concepts::Digraph
    259259  /// "Digraph" concept.
    260   template <typename _Graph>
    261   class ListArcSet : public ArcSetExtender<ListArcSetBase<_Graph> > {
    262 
    263   public:
    264 
    265     typedef ArcSetExtender<ListArcSetBase<_Graph> > Parent;
     260  template <typename GR>
     261  class ListArcSet : public ArcSetExtender<ListArcSetBase<GR> > {
     262
     263  public:
     264
     265    typedef ArcSetExtender<ListArcSetBase<GR> > Parent;
    266266
    267267    typedef typename Parent::Node Node;
    268268    typedef typename Parent::Arc Arc;
    269269
    270     typedef _Graph Graph;
     270    typedef GR Graph;
    271271
    272272
     
    296296      typedef NodesImplBase Parent;
    297297
    298       NodesImpl(const Graph& graph, ListArcSet& arcset)
     298      NodesImpl(const GR& graph, ListArcSet& arcset)
    299299        : Parent(graph), _arcset(arcset) {}
    300300
     
    322322    };
    323323
    324     NodesImpl nodes;
     324    NodesImpl _nodes;
    325325
    326326  public:
     
    329329    ///
    330330    /// Constructor of the ArcSet.
    331     ListArcSet(const Graph& graph) : nodes(graph, *this) {
    332       Parent::initalize(graph, nodes);
     331    ListArcSet(const GR& graph) : _nodes(graph, *this) {
     332      Parent::initalize(graph, _nodes);
    333333    }
    334334
     
    351351  };
    352352
    353   template <typename _Graph>
     353  template <typename GR>
    354354  class ListEdgeSetBase {
    355355  public:
    356356
    357     typedef _Graph Graph;
    358     typedef typename Graph::Node Node;
    359     typedef typename Graph::NodeIt NodeIt;
     357    typedef GR Graph;
     358    typedef typename GR::Node Node;
     359    typedef typename GR::NodeIt NodeIt;
    360360
    361361  protected:
     
    366366    };
    367367
    368     typedef typename ItemSetTraits<Graph, Node>::
     368    typedef typename ItemSetTraits<GR, Node>::
    369369    template Map<NodeT>::Type NodesImplBase;
    370370
    371     NodesImplBase* nodes;
     371    NodesImplBase* _nodes;
    372372
    373373    struct ArcT {
     
    382382    int first_free_arc;
    383383
    384     const Graph* graph;
    385 
    386     void initalize(const Graph& _graph, NodesImplBase& _nodes) {
    387       graph = &_graph;
    388       nodes = &_nodes;
     384    const GR* _graph;
     385
     386    void initalize(const GR& graph, NodesImplBase& nodes) {
     387      _graph = &graph;
     388      _nodes = &nodes;
    389389    }
    390390
     
    438438      arcs[n | 1].target = v;
    439439
    440       arcs[n].next_out = (*nodes)[v].first_out;
    441       if ((*nodes)[v].first_out != -1) {
    442         arcs[(*nodes)[v].first_out].prev_out = n;
    443       }
    444       (*nodes)[v].first_out = n;
     440      arcs[n].next_out = (*_nodes)[v].first_out;
     441      if ((*_nodes)[v].first_out != -1) {
     442        arcs[(*_nodes)[v].first_out].prev_out = n;
     443      }
     444      (*_nodes)[v].first_out = n;
    445445      arcs[n].prev_out = -1;
    446446
    447       if ((*nodes)[u].first_out != -1) {
    448         arcs[(*nodes)[u].first_out].prev_out = (n | 1);
    449       }
    450       arcs[n | 1].next_out = (*nodes)[u].first_out;
    451       (*nodes)[u].first_out = (n | 1);
     447      if ((*_nodes)[u].first_out != -1) {
     448        arcs[(*_nodes)[u].first_out].prev_out = (n | 1);
     449      }
     450      arcs[n | 1].next_out = (*_nodes)[u].first_out;
     451      (*_nodes)[u].first_out = (n | 1);
    452452      arcs[n | 1].prev_out = -1;
    453453
     
    465465        arcs[arcs[n].prev_out].next_out = arcs[n].next_out;
    466466      } else {
    467         (*nodes)[arcs[n | 1].target].first_out = arcs[n].next_out;
     467        (*_nodes)[arcs[n | 1].target].first_out = arcs[n].next_out;
    468468      }
    469469
     
    475475        arcs[arcs[n | 1].prev_out].next_out = arcs[n | 1].next_out;
    476476      } else {
    477         (*nodes)[arcs[n].target].first_out = arcs[n | 1].next_out;
     477        (*_nodes)[arcs[n].target].first_out = arcs[n | 1].next_out;
    478478      }
    479479
     
    486486      Node node;
    487487      for (first(node); node != INVALID; next(node)) {
    488         (*nodes)[node].first_out = -1;
     488        (*_nodes)[node].first_out = -1;
    489489      }
    490490      arcs.clear();
     
    494494
    495495    void first(Node& node) const {
    496       graph->first(node);
     496      _graph->first(node);
    497497    }
    498498
    499499    void next(Node& node) const {
    500       graph->next(node);
     500      _graph->next(node);
    501501    }
    502502
     
    504504      Node node;
    505505      first(node);
    506       while (node != INVALID && (*nodes)[node].first_out == -1) {
     506      while (node != INVALID && (*_nodes)[node].first_out == -1) {
    507507        next(node);
    508508      }
    509       arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_out;
     509      arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_out;
    510510    }
    511511
     
    516516        Node node = arcs[arc.id ^ 1].target;
    517517        next(node);
    518         while(node != INVALID && (*nodes)[node].first_out == -1) {
     518        while(node != INVALID && (*_nodes)[node].first_out == -1) {
    519519          next(node);
    520520        }
    521         arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_out;
     521        arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_out;
    522522      }
    523523    }
     
    527527      first(node);
    528528      while (node != INVALID) {
    529         edge.id = (*nodes)[node].first_out;
     529        edge.id = (*_nodes)[node].first_out;
    530530        while ((edge.id & 1) != 1) {
    531531          edge.id = arcs[edge.id].next_out;
     
    552552      next(node);
    553553      while (node != INVALID) {
    554         edge.id = (*nodes)[node].first_out;
     554        edge.id = (*_nodes)[node].first_out;
    555555        while ((edge.id & 1) != 1) {
    556556          edge.id = arcs[edge.id].next_out;
     
    566566
    567567    void firstOut(Arc& arc, const Node& node) const {
    568       arc.id = (*nodes)[node].first_out;
     568      arc.id = (*_nodes)[node].first_out;
    569569    }
    570570
     
    574574
    575575    void firstIn(Arc& arc, const Node& node) const {
    576       arc.id = (((*nodes)[node].first_out) ^ 1);
     576      arc.id = (((*_nodes)[node].first_out) ^ 1);
    577577      if (arc.id == -2) arc.id = -1;
    578578    }
     
    584584
    585585    void firstInc(Edge &arc, bool& dir, const Node& node) const {
    586       int de = (*nodes)[node].first_out;
     586      int de = (*_nodes)[node].first_out;
    587587      if (de != -1 ) {
    588588        arc.id = de / 2;
     
    612612    }
    613613
    614     int id(const Node& node) const { return graph->id(node); }
     614    int id(const Node& node) const { return _graph->id(node); }
    615615    static int id(Arc e) { return e.id; }
    616616    static int id(Edge e) { return e.id; }
    617617
    618     Node nodeFromId(int id) const { return graph->nodeFromId(id); }
     618    Node nodeFromId(int id) const { return _graph->nodeFromId(id); }
    619619    static Arc arcFromId(int id) { return Arc(id);}
    620620    static Edge edgeFromId(int id) { return Edge(id);}
    621621
    622     int maxNodeId() const { return graph->maxNodeId(); };
     622    int maxNodeId() const { return _graph->maxNodeId(); };
    623623    int maxEdgeId() const { return arcs.size() / 2 - 1; }
    624624    int maxArcId() const { return arcs.size()-1; }
     
    630630    Node v(Edge e) const { return arcs[2 * e.id + 1].target; }
    631631
    632     typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
     632    typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
    633633
    634634    NodeNotifier& notifier(Node) const {
    635       return graph->notifier(Node());
    636     }
    637 
    638     template <typename _Value>
    639     class NodeMap : public Graph::template NodeMap<_Value> {
     635      return _graph->notifier(Node());
     636    }
     637
     638    template <typename V>
     639    class NodeMap : public GR::template NodeMap<V> {
    640640    public:
    641641
    642       typedef typename _Graph::template NodeMap<_Value> Parent;
    643 
    644       explicit NodeMap(const ListEdgeSetBase<Graph>& arcset)
    645         : Parent(*arcset.graph) {}
    646 
    647       NodeMap(const ListEdgeSetBase<Graph>& arcset, const _Value& value)
    648         : Parent(*arcset.graph, value) {}
     642      typedef typename GR::template NodeMap<V> Parent;
     643
     644      explicit NodeMap(const ListEdgeSetBase<GR>& arcset)
     645        : Parent(*arcset._graph) {}
     646
     647      NodeMap(const ListEdgeSetBase<GR>& arcset, const V& value)
     648        : Parent(*arcset._graph, value) {}
    649649
    650650      NodeMap& operator=(const NodeMap& cmap) {
     
    680680  /// incident to the given node is erased from the arc set.
    681681  ///
    682   /// \param _Graph The type of the graph which shares its node set
     682  /// \param GR The type of the graph which shares its node set
    683683  /// with this class. Its interface must conform to the
    684684  /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
     
    687687  /// This class is fully conform to the \ref concepts::Graph "Graph"
    688688  /// concept.
    689   template <typename _Graph>
    690   class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<_Graph> > {
    691 
    692   public:
    693 
    694     typedef EdgeSetExtender<ListEdgeSetBase<_Graph> > Parent;
     689  template <typename GR>
     690  class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<GR> > {
     691
     692  public:
     693
     694    typedef EdgeSetExtender<ListEdgeSetBase<GR> > Parent;
    695695
    696696    typedef typename Parent::Node Node;
     
    698698    typedef typename Parent::Edge Edge;
    699699
    700     typedef _Graph Graph;
     700    typedef GR Graph;
    701701
    702702
     
    721721      typedef NodesImplBase Parent;
    722722
    723       NodesImpl(const Graph& graph, ListEdgeSet& arcset)
     723      NodesImpl(const GR& graph, ListEdgeSet& arcset)
    724724        : Parent(graph), _arcset(arcset) {}
    725725
     
    747747    };
    748748
    749     NodesImpl nodes;
     749    NodesImpl _nodes;
    750750
    751751  public:
     
    754754    ///
    755755    /// Constructor of the EdgeSet.
    756     ListEdgeSet(const Graph& graph) : nodes(graph, *this) {
    757       Parent::initalize(graph, nodes);
     756    ListEdgeSet(const GR& graph) : _nodes(graph, *this) {
     757      Parent::initalize(graph, _nodes);
    758758    }
    759759
     
    776776  };
    777777
    778   template <typename _Graph>
     778  template <typename GR>
    779779  class SmartArcSetBase {
    780780  public:
    781781
    782     typedef _Graph Graph;
     782    typedef GR Graph;
    783783    typedef typename Graph::Node Node;
    784784    typedef typename Graph::NodeIt NodeIt;
     
    791791    };
    792792
    793     typedef typename ItemSetTraits<Graph, Node>::
     793    typedef typename ItemSetTraits<GR, Node>::
    794794    template Map<NodeT>::Type NodesImplBase;
    795795
    796     NodesImplBase* nodes;
     796    NodesImplBase* _nodes;
    797797
    798798    struct ArcT {
     
    804804    std::vector<ArcT> arcs;
    805805
    806     const Graph* graph;
    807 
    808     void initalize(const Graph& _graph, NodesImplBase& _nodes) {
    809       graph = &_graph;
    810       nodes = &_nodes;
     806    const GR* _graph;
     807
     808    void initalize(const GR& graph, NodesImplBase& nodes) {
     809      _graph = &graph;
     810      _nodes = &nodes;
    811811    }
    812812
     
    814814
    815815    class Arc {
    816       friend class SmartArcSetBase<Graph>;
     816      friend class SmartArcSetBase<GR>;
    817817    protected:
    818818      Arc(int _id) : id(_id) {}
     
    831831      int n = arcs.size();
    832832      arcs.push_back(ArcT());
    833       arcs[n].next_in = (*nodes)[v].first_in;
    834       (*nodes)[v].first_in = n;
    835       arcs[n].next_out = (*nodes)[u].first_out;
    836       (*nodes)[u].first_out = n;
     833      arcs[n].next_in = (*_nodes)[v].first_in;
     834      (*_nodes)[v].first_in = n;
     835      arcs[n].next_out = (*_nodes)[u].first_out;
     836      (*_nodes)[u].first_out = n;
    837837      arcs[n].source = u;
    838838      arcs[n].target = v;
     
    843843      Node node;
    844844      for (first(node); node != INVALID; next(node)) {
    845         (*nodes)[node].first_in = -1;
    846         (*nodes)[node].first_out = -1;
     845        (*_nodes)[node].first_in = -1;
     846        (*_nodes)[node].first_out = -1;
    847847      }
    848848      arcs.clear();
     
    850850
    851851    void first(Node& node) const {
    852       graph->first(node);
     852      _graph->first(node);
    853853    }
    854854
    855855    void next(Node& node) const {
    856       graph->next(node);
     856      _graph->next(node);
    857857    }
    858858
     
    866866
    867867    void firstOut(Arc& arc, const Node& node) const {
    868       arc.id = (*nodes)[node].first_out;
     868      arc.id = (*_nodes)[node].first_out;
    869869    }
    870870
     
    874874
    875875    void firstIn(Arc& arc, const Node& node) const {
    876       arc.id = (*nodes)[node].first_in;
     876      arc.id = (*_nodes)[node].first_in;
    877877    }
    878878
     
    881881    }
    882882
    883     int id(const Node& node) const { return graph->id(node); }
     883    int id(const Node& node) const { return _graph->id(node); }
    884884    int id(const Arc& arc) const { return arc.id; }
    885885
    886     Node nodeFromId(int ix) const { return graph->nodeFromId(ix); }
     886    Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
    887887    Arc arcFromId(int ix) const { return Arc(ix); }
    888888
    889     int maxNodeId() const { return graph->maxNodeId(); };
     889    int maxNodeId() const { return _graph->maxNodeId(); };
    890890    int maxArcId() const { return arcs.size() - 1; }
    891891
     
    893893    Node target(const Arc& arc) const { return arcs[arc.id].target;}
    894894
    895     typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
     895    typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
    896896
    897897    NodeNotifier& notifier(Node) const {
    898       return graph->notifier(Node());
    899     }
    900 
    901     template <typename _Value>
    902     class NodeMap : public Graph::template NodeMap<_Value> {
     898      return _graph->notifier(Node());
     899    }
     900
     901    template <typename V>
     902    class NodeMap : public GR::template NodeMap<V> {
    903903    public:
    904904
    905       typedef typename _Graph::template NodeMap<_Value> Parent;
    906 
    907       explicit NodeMap(const SmartArcSetBase<Graph>& arcset)
    908         : Parent(*arcset.graph) { }
    909 
    910       NodeMap(const SmartArcSetBase<Graph>& arcset, const _Value& value)
    911         : Parent(*arcset.graph, value) { }
     905      typedef typename GR::template NodeMap<V> Parent;
     906
     907      explicit NodeMap(const SmartArcSetBase<GR>& arcset)
     908        : Parent(*arcset._graph) { }
     909
     910      NodeMap(const SmartArcSetBase<GR>& arcset, const V& value)
     911        : Parent(*arcset._graph, value) { }
    912912
    913913      NodeMap& operator=(const NodeMap& cmap) {
     
    938938  /// iterators) works equivalently as in the original graph.
    939939  ///
    940   /// \param _Graph The type of the graph which shares its node set with
     940  /// \param GR The type of the graph which shares its node set with
    941941  /// this class. Its interface must conform to the
    942942  /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
     
    955955  /// This class is fully conform to the \ref concepts::Digraph
    956956  /// "Digraph" concept.
    957   template <typename _Graph>
    958   class SmartArcSet : public ArcSetExtender<SmartArcSetBase<_Graph> > {
    959 
    960   public:
    961 
    962     typedef ArcSetExtender<SmartArcSetBase<_Graph> > Parent;
     957  template <typename GR>
     958  class SmartArcSet : public ArcSetExtender<SmartArcSetBase<GR> > {
     959
     960  public:
     961
     962    typedef ArcSetExtender<SmartArcSetBase<GR> > Parent;
    963963
    964964    typedef typename Parent::Node Node;
    965965    typedef typename Parent::Arc Arc;
    966966
    967     typedef _Graph Graph;
     967    typedef GR Graph;
    968968
    969969  protected:
     
    987987      typedef NodesImplBase Parent;
    988988
    989       NodesImpl(const Graph& graph, SmartArcSet& arcset)
     989      NodesImpl(const GR& graph, SmartArcSet& arcset)
    990990        : Parent(graph), _arcset(arcset) {}
    991991
     
    10271027    };
    10281028
    1029     NodesImpl nodes;
     1029    NodesImpl _nodes;
    10301030
    10311031  public:
     
    10341034    ///
    10351035    /// Constructor of the ArcSet.
    1036     SmartArcSet(const Graph& graph) : nodes(graph, *this) {
    1037       Parent::initalize(graph, nodes);
     1036    SmartArcSet(const GR& graph) : _nodes(graph, *this) {
     1037      Parent::initalize(graph, _nodes);
    10381038    }
    10391039
     
    10531053    /// erased and it is not isolated in the ArcSet.
    10541054    bool valid() const {
    1055       return nodes.attached();
     1055      return _nodes.attached();
    10561056    }
    10571057
     
    10591059
    10601060
    1061   template <typename _Graph>
     1061  template <typename GR>
    10621062  class SmartEdgeSetBase {
    10631063  public:
    10641064
    1065     typedef _Graph Graph;
    1066     typedef typename Graph::Node Node;
    1067     typedef typename Graph::NodeIt NodeIt;
     1065    typedef GR Graph;
     1066    typedef typename GR::Node Node;
     1067    typedef typename GR::NodeIt NodeIt;
    10681068
    10691069  protected:
     
    10741074    };
    10751075
    1076     typedef typename ItemSetTraits<Graph, Node>::
     1076    typedef typename ItemSetTraits<GR, Node>::
    10771077    template Map<NodeT>::Type NodesImplBase;
    10781078
    1079     NodesImplBase* nodes;
     1079    NodesImplBase* _nodes;
    10801080
    10811081    struct ArcT {
     
    10871087    std::vector<ArcT> arcs;
    10881088
    1089     const Graph* graph;
    1090 
    1091     void initalize(const Graph& _graph, NodesImplBase& _nodes) {
    1092       graph = &_graph;
    1093       nodes = &_nodes;
     1089    const GR* _graph;
     1090
     1091    void initalize(const GR& graph, NodesImplBase& nodes) {
     1092      _graph = &graph;
     1093      _nodes = &nodes;
    10941094    }
    10951095
     
    11361136      arcs[n | 1].target = v;
    11371137
    1138       arcs[n].next_out = (*nodes)[v].first_out;
    1139       (*nodes)[v].first_out = n;
    1140 
    1141       arcs[n | 1].next_out = (*nodes)[u].first_out;
    1142       (*nodes)[u].first_out = (n | 1);
     1138      arcs[n].next_out = (*_nodes)[v].first_out;
     1139      (*_nodes)[v].first_out = n;
     1140
     1141      arcs[n | 1].next_out = (*_nodes)[u].first_out;
     1142      (*_nodes)[u].first_out = (n | 1);
    11431143
    11441144      return Edge(n / 2);
     
    11481148      Node node;
    11491149      for (first(node); node != INVALID; next(node)) {
    1150         (*nodes)[node].first_out = -1;
     1150        (*_nodes)[node].first_out = -1;
    11511151      }
    11521152      arcs.clear();
     
    11541154
    11551155    void first(Node& node) const {
    1156       graph->first(node);
     1156      _graph->first(node);
    11571157    }
    11581158
    11591159    void next(Node& node) const {
    1160       graph->next(node);
     1160      _graph->next(node);
    11611161    }
    11621162
     
    11781178
    11791179    void firstOut(Arc& arc, const Node& node) const {
    1180       arc.id = (*nodes)[node].first_out;
     1180      arc.id = (*_nodes)[node].first_out;
    11811181    }
    11821182
     
    11861186
    11871187    void firstIn(Arc& arc, const Node& node) const {
    1188       arc.id = (((*nodes)[node].first_out) ^ 1);
     1188      arc.id = (((*_nodes)[node].first_out) ^ 1);
    11891189      if (arc.id == -2) arc.id = -1;
    11901190    }
     
    11961196
    11971197    void firstInc(Edge &arc, bool& dir, const Node& node) const {
    1198       int de = (*nodes)[node].first_out;
     1198      int de = (*_nodes)[node].first_out;
    11991199      if (de != -1 ) {
    12001200        arc.id = de / 2;
     
    12241224    }
    12251225
    1226     int id(Node node) const { return graph->id(node); }
     1226    int id(Node node) const { return _graph->id(node); }
    12271227    static int id(Arc arc) { return arc.id; }
    12281228    static int id(Edge arc) { return arc.id; }
    12291229
    1230     Node nodeFromId(int id) const { return graph->nodeFromId(id); }
     1230    Node nodeFromId(int id) const { return _graph->nodeFromId(id); }
    12311231    static Arc arcFromId(int id) { return Arc(id); }
    12321232    static Edge edgeFromId(int id) { return Edge(id);}
    12331233
    1234     int maxNodeId() const { return graph->maxNodeId(); };
     1234    int maxNodeId() const { return _graph->maxNodeId(); };
    12351235    int maxArcId() const { return arcs.size() - 1; }
    12361236    int maxEdgeId() const { return arcs.size() / 2 - 1; }
     
    12421242    Node v(Edge e) const { return arcs[2 * e.id + 1].target; }
    12431243
    1244     typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
     1244    typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
    12451245
    12461246    NodeNotifier& notifier(Node) const {
    1247       return graph->notifier(Node());
    1248     }
    1249 
    1250     template <typename _Value>
    1251     class NodeMap : public Graph::template NodeMap<_Value> {
     1247      return _graph->notifier(Node());
     1248    }
     1249
     1250    template <typename V>
     1251    class NodeMap : public GR::template NodeMap<V> {
    12521252    public:
    12531253
    1254       typedef typename _Graph::template NodeMap<_Value> Parent;
    1255 
    1256       explicit NodeMap(const SmartEdgeSetBase<Graph>& arcset)
    1257         : Parent(*arcset.graph) { }
    1258 
    1259       NodeMap(const SmartEdgeSetBase<Graph>& arcset, const _Value& value)
    1260         : Parent(*arcset.graph, value) { }
     1254      typedef typename GR::template NodeMap<V> Parent;
     1255
     1256      explicit NodeMap(const SmartEdgeSetBase<GR>& arcset)
     1257        : Parent(*arcset._graph) { }
     1258
     1259      NodeMap(const SmartEdgeSetBase<GR>& arcset, const V& value)
     1260        : Parent(*arcset._graph, value) { }
    12611261
    12621262      NodeMap& operator=(const NodeMap& cmap) {
     
    12861286  /// works equivalently as in the original graph.
    12871287  ///
    1288   /// \param _Graph The type of the graph which shares its node set
     1288  /// \param GR The type of the graph which shares its node set
    12891289  /// with this class. Its interface must conform to the
    12901290  /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
     
    13031303  /// This class is fully conform to the \ref concepts::Graph
    13041304  /// "Graph" concept.
    1305   template <typename _Graph>
    1306   class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<_Graph> > {
    1307 
    1308   public:
    1309 
    1310     typedef EdgeSetExtender<SmartEdgeSetBase<_Graph> > Parent;
     1305  template <typename GR>
     1306  class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<GR> > {
     1307
     1308  public:
     1309
     1310    typedef EdgeSetExtender<SmartEdgeSetBase<GR> > Parent;
    13111311
    13121312    typedef typename Parent::Node Node;
     
    13141314    typedef typename Parent::Edge Edge;
    13151315
    1316     typedef _Graph Graph;
     1316    typedef GR Graph;
    13171317
    13181318  protected:
     
    13351335      typedef NodesImplBase Parent;
    13361336
    1337       NodesImpl(const Graph& graph, SmartEdgeSet& arcset)
     1337      NodesImpl(const GR& graph, SmartEdgeSet& arcset)
    13381338        : Parent(graph), _arcset(arcset) {}
    13391339
     
    13751375    };
    13761376
    1377     NodesImpl nodes;
     1377    NodesImpl _nodes;
    13781378
    13791379  public:
     
    13821382    ///
    13831383    /// Constructor of the EdgeSet.
    1384     SmartEdgeSet(const Graph& graph) : nodes(graph, *this) {
    1385       Parent::initalize(graph, nodes);
     1384    SmartEdgeSet(const GR& graph) : _nodes(graph, *this) {
     1385      Parent::initalize(graph, _nodes);
    13861386    }
    13871387
     
    14011401    /// erased and it is not isolated in the EdgeSet.
    14021402    bool valid() const {
    1403       return nodes.attached();
     1403      return _nodes.attached();
    14041404    }
    14051405
Note: See TracChangeset for help on using the changeset viewer.