COIN-OR::LEMON - Graph Library

Changeset 1910:f95eea8c34b0 in lemon-0.x for lemon/bits


Ignore:
Timestamp:
01/26/06 17:24:40 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2485
Message:

Bipartite => Bp
Upper => A
Lower => B

+ some bug fix

Location:
lemon/bits
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/alteration_notifier.h

    r1909 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5 * (Egervary Research Groin on Combinatorial Optimization, EGRES).
    66 *
    77 * Permission to use, modify and distribute this software is granted
     
    2121#include <algorithm>
    2222
    23 ///\ingroup graphmapfactory
     23///\ingroin graphmapfactory
    2424///\file
    2525///\brief Observer registry for graph alteration observers.
     
    2727namespace lemon {
    2828
    29   /// \addtogroup graphmapfactory
     29  /// \addtogroin graphmapfactory
    3030  /// @{
    3131
     
    502502
    503503  template <typename _Base>
    504   class AlterableUBipartiteGraphExtender : public _Base {
     504  class AlterableBpUGraphExtender : public _Base {
    505505  public:
    506506
    507507    typedef _Base Parent;
    508     typedef AlterableUBipartiteGraphExtender Graph;
     508    typedef AlterableBpUGraphExtender Graph;
    509509 
    510510    typedef typename Parent::Node Node;
    511     typedef typename Parent::LowerNode LowerNode;
    512     typedef typename Parent::UpperNode UpperNode;
     511    typedef typename Parent::BNode BNode;
     512    typedef typename Parent::ANode ANode;
    513513    typedef typename Parent::Edge Edge;
    514514    typedef typename Parent::UEdge UEdge;
     
    516516 
    517517    typedef AlterationNotifier<Node> NodeNotifier;
    518     typedef AlterationNotifier<LowerNode> LowerNodeNotifier;
    519     typedef AlterationNotifier<UpperNode> UpperNodeNotifier;
     518    typedef AlterationNotifier<BNode> BNodeNotifier;
     519    typedef AlterationNotifier<ANode> ANodeNotifier;
    520520    typedef AlterationNotifier<Edge> EdgeNotifier;
    521521    typedef AlterationNotifier<UEdge> UEdgeNotifier;
     
    524524
    525525    mutable NodeNotifier nodeNotifier;
    526     mutable LowerNodeNotifier lowerNodeNotifier;
    527     mutable UpperNodeNotifier upperNodeNotifier;
     526    mutable BNodeNotifier bNodeNotifier;
     527    mutable ANodeNotifier aNodeNotifier;
    528528    mutable EdgeNotifier edgeNotifier;
    529529    mutable UEdgeNotifier uEdgeNotifier;
     
    535535    }
    536536
    537     LowerNodeNotifier& getNotifier(LowerNode) const {
    538       return lowerNodeNotifier;
    539     }
    540 
    541     UpperNodeNotifier& getNotifier(UpperNode) const {
    542       return upperNodeNotifier;
     537    BNodeNotifier& getNotifier(BNode) const {
     538      return bNodeNotifier;
     539    }
     540
     541    ANodeNotifier& getNotifier(ANode) const {
     542      return aNodeNotifier;
    543543    }
    544544
     
    551551    }
    552552
    553     ~AlterableUBipartiteGraphExtender() {
     553    ~AlterableBpUGraphExtender() {
    554554      nodeNotifier.clear();
    555       lowerNodeNotifier.clear();
    556       upperNodeNotifier.clear();
     555      bNodeNotifier.clear();
     556      aNodeNotifier.clear();
    557557      edgeNotifier.clear();
    558558      uEdgeNotifier.clear();
  • lemon/bits/array_map.h

    r1875 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5 * (Egervary Research Groin on Combinatorial Optimization, EGRES).
    66 *
    77 * Permission to use, modify and distribute this software is granted
     
    2424#include <lemon/concept/maps.h>
    2525
    26 /// \ingroup graphmapfactory
     26/// \ingroin graphmapfactory
    2727/// \file
    2828/// \brief Graph maps that construct and destruct
     
    3131namespace lemon {
    3232
    33   /// \ingroup graphmapfactory
     33  /// \ingroin graphmapfactory
    3434  ///
    3535  /// \brief Graph map based on the array storage.
    3636  ///
    3737  /// The ArrayMap template class is graph map structure what
    38   /// automatically updates the map when a key is added to or erased from
     38  /// automatically indates the map when a key is added to or erased from
    3939  /// the map. This map uses the allocators to implement
    4040  /// the container functionality.
  • lemon/bits/clearable_graph_extender.h

    r1909 r1910  
    8080
    8181  template <typename _Base>
    82   class ClearableUBipartiteGraphExtender : public _Base {
     82  class ClearableBpUGraphExtender : public _Base {
    8383  public:
    8484
    8585    typedef _Base Parent;
    86     typedef ClearableUBipartiteGraphExtender Graph;
     86    typedef ClearableBpUGraphExtender Graph;
    8787
    8888    typedef typename Parent::Node Node;
    89     typedef typename Parent::LowerNode LowerNode;
    90     typedef typename Parent::UpperNode UpperNode;
     89    typedef typename Parent::BNode BNode;
     90    typedef typename Parent::ANode ANode;
    9191    typedef typename Parent::Edge Edge;
    9292    typedef typename Parent::UEdge UEdge;
     
    9696      Parent::getNotifier(UEdge()).clear();
    9797      Parent::getNotifier(Node()).clear();
    98       Parent::getNotifier(LowerNode()).clear();
    99       Parent::getNotifier(UpperNode()).clear();
     98      Parent::getNotifier(BNode()).clear();
     99      Parent::getNotifier(ANode()).clear();
    100100      Parent::clear();
    101101    }
  • lemon/bits/default_map.h

    r1909 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5 * (Egervary Research Groin on Combinatorial Optimization, EGRES).
    66 *
    77 * Permission to use, modify and distribute this software is granted
     
    2222#include <lemon/bits/vector_map.h>
    2323
    24 ///\ingroup graphmapfactory
     24///\ingroin graphmapfactory
    2525///\file
    2626///\brief Graph maps that construct and destruct
     
    353353
    354354  template <typename _Base>
    355   class MappableUBipartiteGraphExtender : public _Base {
     355  class MappableBpUGraphExtender : public _Base {
    356356  public:
    357357
    358358    typedef _Base Parent;
    359     typedef MappableUBipartiteGraphExtender Graph;
     359    typedef MappableBpUGraphExtender Graph;
    360360
    361361    typedef typename Parent::Node Node;
    362     typedef typename Parent::UpperNode UpperNode;
    363     typedef typename Parent::LowerNode LowerNode;
     362    typedef typename Parent::ANode ANode;
     363    typedef typename Parent::BNode BNode;
    364364    typedef typename Parent::Edge Edge;
    365365    typedef typename Parent::UEdge UEdge;
    366366   
    367367    template <typename _Value>
    368     class UpperNodeMap
    369       : public IterableMapExtender<DefaultMap<Graph, UpperNode, _Value> > {
    370     public:
    371       typedef MappableUBipartiteGraphExtender Graph;
    372       typedef IterableMapExtender<DefaultMap<Graph, UpperNode, _Value> >
     368    class ANodeMap
     369      : public IterableMapExtender<DefaultMap<Graph, ANode, _Value> > {
     370    public:
     371      typedef MappableBpUGraphExtender Graph;
     372      typedef IterableMapExtender<DefaultMap<Graph, ANode, _Value> >
    373373      Parent;
    374374   
    375       UpperNodeMap(const Graph& _g)
    376         : Parent(_g) {}
    377       UpperNodeMap(const Graph& _g, const _Value& _v)
    378         : Parent(_g, _v) {}
    379    
    380       UpperNodeMap& operator=(const UpperNodeMap& cmap) {
    381         return operator=<UpperNodeMap>(cmap);
     375      ANodeMap(const Graph& _g)
     376        : Parent(_g) {}
     377      ANodeMap(const Graph& _g, const _Value& _v)
     378        : Parent(_g, _v) {}
     379   
     380      ANodeMap& operator=(const ANodeMap& cmap) {
     381        return operator=<ANodeMap>(cmap);
    382382      }
    383383   
     
    387387      /// The given parameter should be conform to the ReadMap
    388388      /// concept and could be indiced by the current item set of
    389       /// the UpperNodeMap. In this case the value for each item
     389      /// the ANodeMap. In this case the value for each item
    390390      /// is assigned by the value of the given ReadMap.
    391391      template <typename CMap>
    392       UpperNodeMap& operator=(const CMap& cmap) {
    393         checkConcept<concept::ReadMap<UpperNode, _Value>, CMap>();
    394         const typename Parent::Graph* graph = Parent::getGraph();
    395         UpperNode it;
    396         for (graph->first(it); it != INVALID; graph->next(it)) {
    397           Parent::set(it, cmap[it]);
    398         }
    399         return *this;
    400       }
    401    
    402     };
    403 
    404     template <typename _Value>
    405     class LowerNodeMap
    406       : public IterableMapExtender<DefaultMap<Graph, LowerNode, _Value> > {
    407     public:
    408       typedef MappableUBipartiteGraphExtender Graph;
    409       typedef IterableMapExtender<DefaultMap<Graph, LowerNode, _Value> >
     392      ANodeMap& operator=(const CMap& cmap) {
     393        checkConcept<concept::ReadMap<ANode, _Value>, CMap>();
     394        const typename Parent::Graph* graph = Parent::getGraph();
     395        ANode it;
     396        for (graph->first(it); it != INVALID; graph->next(it)) {
     397          Parent::set(it, cmap[it]);
     398        }
     399        return *this;
     400      }
     401   
     402    };
     403
     404    template <typename _Value>
     405    class BNodeMap
     406      : public IterableMapExtender<DefaultMap<Graph, BNode, _Value> > {
     407    public:
     408      typedef MappableBpUGraphExtender Graph;
     409      typedef IterableMapExtender<DefaultMap<Graph, BNode, _Value> >
    410410      Parent;
    411411   
    412       LowerNodeMap(const Graph& _g)
    413         : Parent(_g) {}
    414       LowerNodeMap(const Graph& _g, const _Value& _v)
    415         : Parent(_g, _v) {}
    416    
    417       LowerNodeMap& operator=(const LowerNodeMap& cmap) {
    418         return operator=<LowerNodeMap>(cmap);
     412      BNodeMap(const Graph& _g)
     413        : Parent(_g) {}
     414      BNodeMap(const Graph& _g, const _Value& _v)
     415        : Parent(_g, _v) {}
     416   
     417      BNodeMap& operator=(const BNodeMap& cmap) {
     418        return operator=<BNodeMap>(cmap);
    419419      }
    420420   
     
    424424      /// The given parameter should be conform to the ReadMap
    425425      /// concept and could be indiced by the current item set of
    426       /// the LowerNodeMap. In this case the value for each item
     426      /// the BNodeMap. In this case the value for each item
    427427      /// is assigned by the value of the given ReadMap.
    428428      template <typename CMap>
    429       LowerNodeMap& operator=(const CMap& cmap) {
    430         checkConcept<concept::ReadMap<LowerNode, _Value>, CMap>();
    431         const typename Parent::Graph* graph = Parent::getGraph();
    432         LowerNode it;
     429      BNodeMap& operator=(const CMap& cmap) {
     430        checkConcept<concept::ReadMap<BNode, _Value>, CMap>();
     431        const typename Parent::Graph* graph = Parent::getGraph();
     432        BNode it;
    433433        for (graph->first(it); it != INVALID; graph->next(it)) {
    434434          Parent::set(it, cmap[it]);
     
    444444    class NodeMapBase : public Parent::NodeNotifier::ObserverBase {
    445445    public:
    446       typedef MappableUBipartiteGraphExtender Graph;
     446      typedef MappableBpUGraphExtender Graph;
    447447
    448448      typedef Node Key;
     
    450450
    451451      /// The reference type of the map;
    452       typedef typename LowerNodeMap<_Value>::Reference Reference;
     452      typedef typename BNodeMap<_Value>::Reference Reference;
    453453      /// The pointer type of the map;
    454       typedef typename LowerNodeMap<_Value>::Pointer Pointer;
     454      typedef typename BNodeMap<_Value>::Pointer Pointer;
    455455     
    456456      /// The const value type of the map.
    457457      typedef const Value ConstValue;
    458458      /// The const reference type of the map;
    459       typedef typename LowerNodeMap<_Value>::ConstReference ConstReference;
     459      typedef typename BNodeMap<_Value>::ConstReference ConstReference;
    460460      /// The pointer type of the map;
    461       typedef typename LowerNodeMap<_Value>::ConstPointer ConstPointer;
     461      typedef typename BNodeMap<_Value>::ConstPointer ConstPointer;
    462462
    463463      typedef True ReferenceMapTag;
    464464
    465465      NodeMapBase(const Graph& _g)
    466         : graph(&_g), lowerMap(_g), upperMap(_g) {
     466        : graph(&_g), bNodeMap(_g), aNodeMap(_g) {
    467467        Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
    468468      }
    469469      NodeMapBase(const Graph& _g, const _Value& _v)
    470         : graph(&_g), lowerMap(_g, _v),
    471           upperMap(_g, _v) {
     470        : graph(&_g), bNodeMap(_g, _v),
     471          aNodeMap(_g, _v) {
    472472        Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
    473473      }
     
    480480   
    481481      ConstReference operator[](const Key& node) const {
    482         if (Parent::upper(node)) {
    483           return upperMap[node];
     482        if (Parent::aNode(node)) {
     483          return aNodeMap[node];
    484484        } else {
    485           return lowerMap[node];
     485          return bNodeMap[node];
    486486        }
    487487      }
    488488
    489489      Reference operator[](const Key& node) {
    490         if (Parent::upper(node)) {
    491           return upperMap[node];
     490        if (Parent::aNode(node)) {
     491          return aNodeMap[node];
    492492        } else {
    493           return lowerMap[node];
     493          return bNodeMap[node];
    494494        }
    495495      }
    496496
    497497      void set(const Key& node, const Value& value) {
    498         if (Parent::upper(node)) {
    499           upperMap.set(node, value);
     498        if (Parent::aNode(node)) {
     499          aNodeMap.set(node, value);
    500500        } else {
    501           lowerMap.set(node, value);
     501          bNodeMap.set(node, value);
    502502        }
    503503      }
     
    514514    private:
    515515      const Graph* graph;
    516       LowerNodeMap<_Value> lowerMap;
    517       UpperNodeMap<_Value> upperMap;
     516      BNodeMap<_Value> bNodeMap;
     517      ANodeMap<_Value> aNodeMap;
    518518    };
    519519   
     
    524524      : public IterableMapExtender<NodeMapBase<_Value> > {
    525525    public:
    526       typedef MappableUBipartiteGraphExtender Graph;
     526      typedef MappableBpUGraphExtender Graph;
    527527      typedef IterableMapExtender< NodeMapBase<_Value> > Parent;
    528528   
     
    562562      : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
    563563    public:
    564       typedef MappableUBipartiteGraphExtender Graph;
     564      typedef MappableBpUGraphExtender Graph;
    565565      typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
    566566   
     
    590590      : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > {
    591591    public:
    592       typedef MappableUBipartiteGraphExtender Graph;
     592      typedef MappableBpUGraphExtender Graph;
    593593      typedef IterableMapExtender<DefaultMap<Graph, UEdge, _Value> >
    594594      Parent;
  • lemon/bits/extendable_graph_extender.h

    r1909 r1910  
    106106
    107107  template <typename _Base>
    108   class ExtendableUBipartiteGraphExtender : public _Base {
     108  class ExtendableBpUGraphExtender : public _Base {
    109109  public:
    110110
    111111    typedef _Base Parent;
    112     typedef ExtendableUBipartiteGraphExtender Graph;
     112    typedef ExtendableBpUGraphExtender Graph;
    113113 
    114114    typedef typename Parent::Node Node;
    115     typedef typename Parent::LowerNode LowerNode;
    116     typedef typename Parent::UpperNode UpperNode;
     115    typedef typename Parent::BNode BNode;
     116    typedef typename Parent::ANode ANode;
    117117    typedef typename Parent::Edge Edge;
    118118    typedef typename Parent::UEdge UEdge;
    119119 
    120     Node addUpperNode() {
    121       Node node = Parent::addUpperNode();
    122       Parent::getNotifier(UpperNode()).add(node);
     120    Node addANode() {
     121      Node node = Parent::addANode();
     122      Parent::getNotifier(ANode()).add(node);
    123123      Parent::getNotifier(Node()).add(node);
    124124      return node;
    125125    }
    126126
    127     Node addLowerNode() {
    128       Node node = Parent::addLowerNode();
    129       Parent::getNotifier(LowerNode()).add(node);
     127    Node addBNode() {
     128      Node node = Parent::addBNode();
     129      Parent::getNotifier(BNode()).add(node);
    130130      Parent::getNotifier(Node()).add(node);
    131131      return node;
  • lemon/bits/graph_extender.h

    r1909 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi
    5  * Kutatocsoport (Egervary Research Group on Combinatorial Optimization,
     5 * Kutatocsoport (Egervary Research Groin on Combinatorial Optimization,
    66 * EGRES).
    77 *
     
    380380
    381381  template <typename _Base>
    382   class UBipartiteGraphExtender : public _Base {
     382  class BpUGraphExtender : public _Base {
    383383  public:
    384384    typedef _Base Parent;
    385     typedef UBipartiteGraphExtender Graph;
     385    typedef BpUGraphExtender Graph;
    386386
    387387    typedef typename Parent::Node Node;
     
    394394
    395395    Node source(const UEdge& edge) const {
    396       return upperNode(edge);
     396      return aNode(edge);
    397397    }
    398398    Node target(const UEdge& edge) const {
    399       return lowerNode(edge);
     399      return bNode(edge);
    400400    }
    401401
    402402    void firstInc(UEdge& edge, bool& direction, const Node& node) const {
    403       if (Parent::upper(node)) {
    404         Parent::firstDown(edge, node);
     403      if (Parent::aNode(node)) {
     404        Parent::firstOut(edge, node);
    405405        direction = true;
    406406      } else {
    407         Parent::firstUp(edge, node);
     407        Parent::firstIn(edge, node);
    408408        direction = static_cast<UEdge&>(edge) == INVALID;
    409409      }
     
    411411    void nextInc(UEdge& edge, bool& direction) const {
    412412      if (direction) {
    413         Parent::nextDown(edge);
    414       } else {
    415         Parent::nextUp(edge);
     413        Parent::nextOut(edge);
     414      } else {
     415        Parent::nextIn(edge);
    416416        if (edge == INVALID) direction = true;
    417417      }
     
    427427
    428428    class Edge : public UEdge {
    429       friend class UBipartiteGraphExtender;
     429      friend class BpUGraphExtender;
    430430    protected:
    431431      bool forward;
     
    462462
    463463    void firstOut(Edge& edge, const Node& node) const {
    464       if (Parent::upper(node)) {
    465         Parent::firstDown(edge, node);
     464      if (Parent::aNode(node)) {
     465        Parent::firstOut(edge, node);
    466466        edge.forward = true;
    467467      } else {
    468         Parent::firstUp(edge, node);
     468        Parent::firstIn(edge, node);
    469469        edge.forward = static_cast<UEdge&>(edge) == INVALID;
    470470      }
     
    472472    void nextOut(Edge& edge) const {
    473473      if (edge.forward) {
    474         Parent::nextDown(edge);
    475       } else {
    476         Parent::nextUp(edge);
     474        Parent::nextOut(edge);
     475      } else {
     476        Parent::nextIn(edge);
    477477        edge.forward = static_cast<UEdge&>(edge) == INVALID;
    478478      }
     
    480480
    481481    void firstIn(Edge& edge, const Node& node) const {
    482       if (Parent::lower(node)) {
    483         Parent::firstUp(edge, node);
     482      if (Parent::bNode(node)) {
     483        Parent::firstIn(edge, node);
    484484        edge.forward = true;   
    485485      } else {
    486         Parent::firstDown(edge, node);
     486        Parent::firstOut(edge, node);
    487487        edge.forward = static_cast<UEdge&>(edge) == INVALID;
    488488      }
     
    490490    void nextIn(Edge& edge) const {
    491491      if (edge.forward) {
    492         Parent::nextUp(edge);
    493       } else {
    494         Parent::nextDown(edge);
     492        Parent::nextIn(edge);
     493      } else {
     494        Parent::nextOut(edge);
    495495        edge.forward = static_cast<UEdge&>(edge) == INVALID;
    496496      }
     
    498498
    499499    Node source(const Edge& edge) const {
    500       return edge.forward ? Parent::upperNode(edge) : Parent::lowerNode(edge);
     500      return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge);
    501501    }
    502502    Node target(const Edge& edge) const {
    503       return edge.forward ? Parent::lowerNode(edge) : Parent::upperNode(edge);
     503      return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge);
    504504    }
    505505
     
    535535    }
    536536
    537     class UpperNode : public Node {
    538       friend class UBipartiteGraphExtender;
     537    class ANode : public Node {
     538      friend class BpUGraphExtender;
    539539    public:
    540       UpperNode() {}
    541       UpperNode(const Node& node) : Node(node) {
    542         LEMON_ASSERT(Parent::upper(node) || node == INVALID,
     540      ANode() {}
     541      ANode(const Node& node) : Node(node) {
     542        LEMON_ASSERT(Parent::aNode(node) || node == INVALID,
    543543                     typename Parent::NodeSetError());
    544544      }
    545       UpperNode(Invalid) : Node(INVALID) {}
     545      ANode(Invalid) : Node(INVALID) {}
    546546    };
    547547
    548     void first(UpperNode& node) const {
    549       Parent::firstUpper(static_cast<Node&>(node));
    550     }
    551     void next(UpperNode& node) const {
    552       Parent::nextUpper(static_cast<Node&>(node));
    553     }
    554 
    555     int id(const UpperNode& node) const {
    556       return Parent::upperId(node);
    557     }
    558 
    559     class LowerNode : public Node {
    560       friend class UBipartiteGraphExtender;
     548    void first(ANode& node) const {
     549      Parent::firstANode(static_cast<Node&>(node));
     550    }
     551    void next(ANode& node) const {
     552      Parent::nextANode(static_cast<Node&>(node));
     553    }
     554
     555    int id(const ANode& node) const {
     556      return Parent::aNodeId(node);
     557    }
     558
     559    class BNode : public Node {
     560      friend class BpUGraphExtender;
    561561    public:
    562       LowerNode() {}
    563       LowerNode(const Node& node) : Node(node) {
    564         LEMON_ASSERT(Parent::lower(node) || node == INVALID,
     562      BNode() {}
     563      BNode(const Node& node) : Node(node) {
     564        LEMON_ASSERT(Parent::bNode(node) || node == INVALID,
    565565                     typename Parent::NodeSetError());
    566566      }
    567       LowerNode(Invalid) : Node(INVALID) {}
     567      BNode(Invalid) : Node(INVALID) {}
    568568    };
    569569
    570     void first(LowerNode& node) const {
    571       Parent::firstLower(static_cast<Node&>(node));
    572     }
    573     void next(LowerNode& node) const {
    574       Parent::nextLower(static_cast<Node&>(node));
     570    void first(BNode& node) const {
     571      Parent::firstBNode(static_cast<Node&>(node));
     572    }
     573    void next(BNode& node) const {
     574      Parent::nextBNode(static_cast<Node&>(node));
    575575    }
    576576 
    577     int id(const LowerNode& node) const {
    578       return Parent::upperId(node);
     577    int id(const BNode& node) const {
     578      return Parent::aNodeId(node);
    579579    }
    580580
     
    584584      return Parent::maxNodeId();
    585585    }
    586     int maxId(LowerNode) const {
    587       return Parent::maxLowerId();
    588     }
    589     int maxId(UpperNode) const {
    590       return Parent::maxUpperId();
     586    int maxId(BNode) const {
     587      return Parent::maxBNodeId();
     588    }
     589    int maxId(ANode) const {
     590      return Parent::maxANodeId();
    591591    }
    592592    int maxId(Edge) const {
     
    601601      return Parent::nodeFromId(id);
    602602    }
    603     UpperNode fromId(int id, UpperNode) const {
    604       return Parent::fromUpperId(id);
    605     }
    606     LowerNode fromId(int id, LowerNode) const {
    607       return Parent::fromLowerId(id);
     603    ANode fromId(int id, ANode) const {
     604      return Parent::fromANodeId(id);
     605    }
     606    BNode fromId(int id, BNode) const {
     607      return Parent::fromBNodeId(id);
    608608    }
    609609    Edge fromId(int id, Edge) const {
  • lemon/bits/item_reader.h

    r1875 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5 * (Egervary Research Groin on Combinatorial Optimization, EGRES).
    66 *
    77 * Permission to use, modify and distribute this software is granted
     
    1515 */
    1616
    17 /// @defgroup item_io Item Readers and Writers
    18 /// @ingroup io_group
     17/// @defgroin item_io Item Readers and Writers
     18/// @ingroin io_groin
    1919/// \brief Item Readers and Writers
    2020///
     
    2323/// read some way. The module make possible to do this. 
    2424
    25 /// \ingroup item_io
     25/// \ingroin item_io
    2626/// \file
    2727/// \brief Item reader bits for lemon input.
     
    4343  class DefaultReader;
    4444
    45   /// \ingroup item_io
     45  /// \ingroin item_io
    4646  ///
    4747  /// \brief Reader class for quoted strings.
     
    158158  };
    159159
    160   /// \ingroup item_io
     160  /// \ingroin item_io
    161161  /// \brief Reader for standard containers.
    162162  ///
     
    205205  };
    206206
    207   /// \ingroup item_io
     207  /// \ingroin item_io
    208208  ///
    209209  /// \brief Reader for standard containers.
     
    253253  };
    254254
    255   /// \ingroup item_io
     255  /// \ingroin item_io
    256256  /// \brief Reader for parsed string.
    257257  ///
     
    301301  };
    302302
    303   /// \ingroup item_io
     303  /// \ingroin item_io
    304304  /// \brief Reader for read the whole line.
    305305  ///
     
    331331  };
    332332
    333   /// \ingroup item_io
     333  /// \ingroin item_io
    334334  /// \brief Reader for std::pair.
    335335  ///
     
    385385  };
    386386
    387   /// \ingroup item_io
     387  /// \ingroin item_io
    388388  ///
    389389  /// \brief The default item reader template class.
     
    472472    : public PairReader<std::pair<First, Second> > {};
    473473
    474   /// \ingroup item_io
     474  /// \ingroin item_io
    475475  ///
    476476  /// \brief The default item reader for skipping a value in the stream.
     
    481481  class DefaultSkipper : public DefaultReader<std::string> {};
    482482
    483   /// \ingroup item_io 
     483  /// \ingroin item_io 
    484484  /// \brief Standard ReaderTraits for the GraphReader class.
    485485  ///
  • lemon/bits/item_writer.h

    r1875 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5 * (Egervary Research Groin on Combinatorial Optimization, EGRES).
    66 *
    77 * Permission to use, modify and distribute this software is granted
     
    1515 */
    1616
    17 /// \ingroup item_io
     17/// \ingroin item_io
    1818/// \file
    1919/// \brief Item writer bits for lemon output.
     
    3535  class DefaultWriter;
    3636
    37   /// \ingroup item_io
     37  /// \ingroin item_io
    3838  /// \brief Writer class for quoted strings.
    3939  ///
     
    118118  };
    119119
    120   /// \ingroup item_io
     120  /// \ingroin item_io
    121121  /// \brief Writer class for quoted char array.
    122122  ///
     
    146146
    147147
    148   /// \ingroup item_io
     148  /// \ingroin item_io
    149149  ///
    150150  /// \brief Writer for standard containers.
     
    188188  };
    189189
    190   /// \ingroup item_io
     190  /// \ingroin item_io
    191191  ///
    192192  /// \brief Writer for standard pairs.
     
    235235  };
    236236
    237   /// \ingroup item_io
     237  /// \ingroin item_io
    238238  ///
    239239  /// \brief The default item writer template class.
     
    308308    : public PairWriter<std::pair<First, Second> > {};
    309309
    310   /// \ingroup item_io
     310  /// \ingroin item_io
    311311  /// \brief Standard WriterTraits for the section writers.
    312312  ///
  • lemon/bits/iterable_graph_extender.h

    r1909 r1910  
    271271
    272272  template <typename _Base>
    273   class IterableUBipartiteGraphExtender : public _Base {
     273  class IterableBpUGraphExtender : public _Base {
    274274  public:
    275275    typedef _Base Parent;
    276     typedef IterableUBipartiteGraphExtender Graph;
     276    typedef IterableBpUGraphExtender Graph;
    277277   
    278278    typedef typename Parent::Node Node;
    279     typedef typename Parent::UpperNode UpperNode;
    280     typedef typename Parent::LowerNode LowerNode;
     279    typedef typename Parent::ANode ANode;
     280    typedef typename Parent::BNode BNode;
    281281    typedef typename Parent::Edge Edge;
    282282    typedef typename Parent::UEdge UEdge;
     
    304304    };
    305305
    306     class UpperNodeIt : public Node {
    307       friend class IterableUBipartiteGraphExtender;
    308       const Graph* graph;
    309     public:
    310    
    311       UpperNodeIt() { }
    312    
    313       UpperNodeIt(Invalid i) : Node(INVALID) { }
    314    
    315       explicit UpperNodeIt(const Graph& _graph) : graph(&_graph) {
    316         graph->firstUpper(static_cast<Node&>(*this));
    317       }
    318 
    319       UpperNodeIt(const Graph& _graph, const Node& node)
     306    class ANodeIt : public Node {
     307      friend class IterableBpUGraphExtender;
     308      const Graph* graph;
     309    public:
     310   
     311      ANodeIt() { }
     312   
     313      ANodeIt(Invalid i) : Node(INVALID) { }
     314   
     315      explicit ANodeIt(const Graph& _graph) : graph(&_graph) {
     316        graph->firstANode(static_cast<Node&>(*this));
     317      }
     318
     319      ANodeIt(const Graph& _graph, const Node& node)
    320320        : Node(node), graph(&_graph) {}
    321321   
    322       UpperNodeIt& operator++() {
    323         graph->nextUpper(*this);
    324         return *this;
    325       }
    326     };
    327 
    328     class LowerNodeIt : public Node {
    329       friend class IterableUBipartiteGraphExtender;
    330       const Graph* graph;
    331     public:
    332    
    333       LowerNodeIt() { }
    334    
    335       LowerNodeIt(Invalid i) : Node(INVALID) { }
    336    
    337       explicit LowerNodeIt(const Graph& _graph) : graph(&_graph) {
    338         graph->firstLower(static_cast<Node&>(*this));
    339       }
    340 
    341       LowerNodeIt(const Graph& _graph, const Node& node)
     322      ANodeIt& operator++() {
     323        graph->nextANode(*this);
     324        return *this;
     325      }
     326    };
     327
     328    class BNodeIt : public Node {
     329      friend class IterableBpUGraphExtender;
     330      const Graph* graph;
     331    public:
     332   
     333      BNodeIt() { }
     334   
     335      BNodeIt(Invalid i) : Node(INVALID) { }
     336   
     337      explicit BNodeIt(const Graph& _graph) : graph(&_graph) {
     338        graph->firstBNode(static_cast<Node&>(*this));
     339      }
     340
     341      BNodeIt(const Graph& _graph, const Node& node)
    342342        : Node(node), graph(&_graph) {}
    343343   
    344       LowerNodeIt& operator++() {
    345         graph->nextLower(*this);
     344      BNodeIt& operator++() {
     345        graph->nextBNode(*this);
    346346        return *this;
    347347      }
     
    349349
    350350    class EdgeIt : public Edge {
    351       friend class IterableUBipartiteGraphExtender;
     351      friend class IterableBpUGraphExtender;
    352352      const Graph* graph;
    353353    public:
     
    372372
    373373    class UEdgeIt : public UEdge {
    374       friend class IterableUBipartiteGraphExtender;
     374      friend class IterableBpUGraphExtender;
    375375      const Graph* graph;
    376376    public:
     
    394394
    395395    class OutEdgeIt : public Edge {
    396       friend class IterableUBipartiteGraphExtender;
     396      friend class IterableBpUGraphExtender;
    397397      const Graph* graph;
    398398    public:
     
    419419
    420420    class InEdgeIt : public Edge {
    421       friend class IterableUBipartiteGraphExtender;
     421      friend class IterableBpUGraphExtender;
    422422      const Graph* graph;
    423423    public:
     
    471471 
    472472    class IncEdgeIt : public Parent::UEdge {
    473       friend class IterableUBipartiteGraphExtender;
     473      friend class IterableBpUGraphExtender;
    474474      const Graph* graph;
    475475      bool direction;
  • lemon/bits/map_extender.h

    r1875 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5 * (Egervary Research Groin on Combinatorial Optimization, EGRES).
    66 *
    77 * Permission to use, modify and distribute this software is granted
  • lemon/bits/static_map.h

    r1909 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5 * (Egervary Research Groin on Combinatorial Optimization, EGRES).
    66 *
    77 * Permission to use, modify and distribute this software is granted
     
    2828#include <lemon/concept/maps.h>
    2929
    30 /// \ingroup graphmaps
     30/// \ingroin graphmaps
    3131///
    3232///\file
     
    3535namespace lemon {
    3636
    37   /// \ingroup graphmaps
     37  /// \ingroin graphmaps
    3838  ///
    3939  /// \brief Graph map with static sized storage.
    4040  ///
    4141  /// The StaticMap template class is graph map structure what
    42   /// does not update automatically the map when a key is added to or
     42  /// does not indate automatically the map when a key is added to or
    4343  /// erased from the map rather it throws an exception. This map factory
    4444  /// uses the allocators to implement the container functionality.
     
    5555  public:
    5656
    57     /// \brief Exception class for unsupported exceptions.
    58     class UnsupportedOperation : public lemon::LogicError {
     57    /// \brief Exception class for unsinported exceptions.
     58    class UnsinportedOperation : public lemon::LogicError {
    5959    public:
    6060      virtual const char* exceptionName() const {
    61         return "lemon::StaticMap::UnsupportedOperation";
     61        return "lemon::StaticMap::UnsinportedOperation";
    6262      }
    6363    };
     
    186186     
    187187    void add(const Key&) {
    188       throw UnsupportedOperation();
     188      throw UnsinportedOperation();
    189189    }
    190190
     
    194194    /// and it overrides the erase() member function of the observer base.     
    195195    void erase(const Key&) {
    196       throw UnsupportedOperation();
     196      throw UnsinportedOperation();
    197197    }
    198198
     
    347347
    348348  template <typename _Base>
    349   class StaticMappableUBipartiteGraphExtender : public _Base {
     349  class StaticMappableBpUGraphExtender : public _Base {
    350350  public:
    351351
    352352    typedef _Base Parent;
    353     typedef StaticMappableUBipartiteGraphExtender Graph;
     353    typedef StaticMappableBpUGraphExtender Graph;
    354354
    355355    typedef typename Parent::Node Node;
    356     typedef typename Parent::UpperNode UpperNode;
    357     typedef typename Parent::LowerNode LowerNode;
     356    typedef typename Parent::ANode ANode;
     357    typedef typename Parent::BNode BNode;
    358358    typedef typename Parent::Edge Edge;
    359359    typedef typename Parent::UEdge UEdge;
    360360   
    361361    template <typename _Value>
    362     class UpperNodeMap
    363       : public IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > {
    364     public:
    365       typedef StaticMappableUBipartiteGraphExtender Graph;
    366       typedef IterableMapExtender<StaticMap<Graph, UpperNode, _Value> >
     362    class ANodeMap
     363      : public IterableMapExtender<StaticMap<Graph, ANode, _Value> > {
     364    public:
     365      typedef StaticMappableBpUGraphExtender Graph;
     366      typedef IterableMapExtender<StaticMap<Graph, ANode, _Value> >
    367367      Parent;
    368368   
    369       UpperNodeMap(const Graph& _g)
    370         : Parent(_g) {}
    371       UpperNodeMap(const Graph& _g, const _Value& _v)
    372         : Parent(_g, _v) {}
    373    
    374       UpperNodeMap& operator=(const UpperNodeMap& cmap) {
    375         return operator=<UpperNodeMap>(cmap);
     369      ANodeMap(const Graph& _g)
     370        : Parent(_g) {}
     371      ANodeMap(const Graph& _g, const _Value& _v)
     372        : Parent(_g, _v) {}
     373   
     374      ANodeMap& operator=(const ANodeMap& cmap) {
     375        return operator=<ANodeMap>(cmap);
    376376      }
    377377   
     
    381381      /// The given parameter should be conform to the ReadMap
    382382      /// concept and could be indiced by the current item set of
    383       /// the UpperNodeMap. In this case the value for each item
     383      /// the ANodeMap. In this case the value for each item
    384384      /// is assigned by the value of the given ReadMap.
    385385      template <typename CMap>
    386       UpperNodeMap& operator=(const CMap& cmap) {
    387         checkConcept<concept::ReadMap<UpperNode, _Value>, CMap>();
    388         const typename Parent::Graph* graph = Parent::getGraph();
    389         UpperNode it;
    390         for (graph->first(it); it != INVALID; graph->next(it)) {
    391           Parent::set(it, cmap[it]);
    392         }
    393         return *this;
    394       }
    395    
    396     };
    397 
    398     template <typename _Value>
    399     class LowerNodeMap
    400       : public IterableMapExtender<StaticMap<Graph, LowerNode, _Value> > {
    401     public:
    402       typedef StaticMappableUBipartiteGraphExtender Graph;
    403       typedef IterableMapExtender<StaticMap<Graph, LowerNode, _Value> >
     386      ANodeMap& operator=(const CMap& cmap) {
     387        checkConcept<concept::ReadMap<ANode, _Value>, CMap>();
     388        const typename Parent::Graph* graph = Parent::getGraph();
     389        ANode it;
     390        for (graph->first(it); it != INVALID; graph->next(it)) {
     391          Parent::set(it, cmap[it]);
     392        }
     393        return *this;
     394      }
     395   
     396    };
     397
     398    template <typename _Value>
     399    class BNodeMap
     400      : public IterableMapExtender<StaticMap<Graph, BNode, _Value> > {
     401    public:
     402      typedef StaticMappableBpUGraphExtender Graph;
     403      typedef IterableMapExtender<StaticMap<Graph, BNode, _Value> >
    404404      Parent;
    405405   
    406       LowerNodeMap(const Graph& _g)
    407         : Parent(_g) {}
    408       LowerNodeMap(const Graph& _g, const _Value& _v)
    409         : Parent(_g, _v) {}
    410    
    411       LowerNodeMap& operator=(const LowerNodeMap& cmap) {
    412         return operator=<LowerNodeMap>(cmap);
     406      BNodeMap(const Graph& _g)
     407        : Parent(_g) {}
     408      BNodeMap(const Graph& _g, const _Value& _v)
     409        : Parent(_g, _v) {}
     410   
     411      BNodeMap& operator=(const BNodeMap& cmap) {
     412        return operator=<BNodeMap>(cmap);
    413413      }
    414414   
     
    418418      /// The given parameter should be conform to the ReadMap
    419419      /// concept and could be indiced by the current item set of
    420       /// the LowerNodeMap. In this case the value for each item
     420      /// the BNodeMap. In this case the value for each item
    421421      /// is assigned by the value of the given ReadMap.
    422422      template <typename CMap>
    423       LowerNodeMap& operator=(const CMap& cmap) {
    424         checkConcept<concept::ReadMap<LowerNode, _Value>, CMap>();
    425         const typename Parent::Graph* graph = Parent::getGraph();
    426         LowerNode it;
     423      BNodeMap& operator=(const CMap& cmap) {
     424        checkConcept<concept::ReadMap<BNode, _Value>, CMap>();
     425        const typename Parent::Graph* graph = Parent::getGraph();
     426        BNode it;
    427427        for (graph->first(it); it != INVALID; graph->next(it)) {
    428428          Parent::set(it, cmap[it]);
     
    438438    class NodeMapBase : public Parent::NodeNotifier::ObserverBase {
    439439    public:
    440       typedef StaticMappableUBipartiteGraphExtender Graph;
     440      typedef StaticMappableBpUGraphExtender Graph;
    441441
    442442      typedef Node Key;
     
    444444
    445445      /// The reference type of the map;
    446       typedef typename LowerNodeMap<_Value>::Reference Reference;
     446      typedef typename BNodeMap<_Value>::Reference Reference;
    447447      /// The pointer type of the map;
    448       typedef typename LowerNodeMap<_Value>::Pointer Pointer;
     448      typedef typename BNodeMap<_Value>::Pointer Pointer;
    449449     
    450450      /// The const value type of the map.
    451451      typedef const Value ConstValue;
    452452      /// The const reference type of the map;
    453       typedef typename LowerNodeMap<_Value>::ConstReference ConstReference;
     453      typedef typename BNodeMap<_Value>::ConstReference ConstReference;
    454454      /// The pointer type of the map;
    455       typedef typename LowerNodeMap<_Value>::ConstPointer ConstPointer;
     455      typedef typename BNodeMap<_Value>::ConstPointer ConstPointer;
    456456
    457457      typedef True ReferenceMapTag;
    458458
    459459      NodeMapBase(const Graph& _g)
    460         : graph(&_g), lowerMap(_g), upperMap(_g) {
     460        : graph(&_g), bNodeMap(_g), aNodeMap(_g) {
    461461        Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
    462462      }
    463463      NodeMapBase(const Graph& _g, const _Value& _v)
    464         : graph(&_g), lowerMap(_g, _v),
    465           upperMap(_g, _v) {
     464        : graph(&_g), bNodeMap(_g, _v),
     465          aNodeMap(_g, _v) {
    466466        Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
    467467      }
     
    474474   
    475475      ConstReference operator[](const Key& node) const {
    476         if (Parent::upper(node)) {
    477           return upperMap[node];
     476        if (Parent::aNode(node)) {
     477          return aNodeMap[node];
    478478        } else {
    479           return lowerMap[node];
     479          return bNodeMap[node];
    480480        }
    481481      }
    482482
    483483      Reference operator[](const Key& node) {
    484         if (Parent::upper(node)) {
    485           return upperMap[node];
     484        if (Parent::aNode(node)) {
     485          return aNodeMap[node];
    486486        } else {
    487           return lowerMap[node];
     487          return bNodeMap[node];
    488488        }
    489489      }
    490490
    491491      void set(const Key& node, const Value& value) {
    492         if (Parent::upper(node)) {
    493           upperMap.set(node, value);
     492        if (Parent::aNode(node)) {
     493          aNodeMap.set(node, value);
    494494        } else {
    495           lowerMap.set(node, value);
     495          bNodeMap.set(node, value);
    496496        }
    497497      }
     
    508508    private:
    509509      const Graph* graph;
    510       LowerNodeMap<_Value> lowerMap;
    511       UpperNodeMap<_Value> upperMap;
     510      BNodeMap<_Value> bNodeMap;
     511      ANodeMap<_Value> aNodeMap;
    512512    };
    513513   
     
    518518      : public IterableMapExtender<NodeMapBase<_Value> > {
    519519    public:
    520       typedef StaticMappableUBipartiteGraphExtender Graph;
     520      typedef StaticMappableBpUGraphExtender Graph;
    521521      typedef IterableMapExtender< NodeMapBase<_Value> > Parent;
    522522   
     
    556556      : public IterableMapExtender<StaticMap<Graph, Edge, _Value> > {
    557557    public:
    558       typedef StaticMappableUBipartiteGraphExtender Graph;
     558      typedef StaticMappableBpUGraphExtender Graph;
    559559      typedef IterableMapExtender<StaticMap<Graph, Edge, _Value> > Parent;
    560560   
     
    584584      : public IterableMapExtender<StaticMap<Graph, UEdge, _Value> > {
    585585    public:
    586       typedef StaticMappableUBipartiteGraphExtender Graph;
     586      typedef StaticMappableBpUGraphExtender Graph;
    587587      typedef IterableMapExtender<StaticMap<Graph, UEdge, _Value> >
    588588      Parent;
  • lemon/bits/vector_map.h

    r1875 r1910  
    33 *
    44 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5 * (Egervary Research Groin on Combinatorial Optimization, EGRES).
    66 *
    77 * Permission to use, modify and distribute this software is granted
     
    2727#include <lemon/concept/maps.h>
    2828
    29 /// \ingroup graphmapfactory
     29/// \ingroin graphmapfactory
    3030///
    3131///\file
     
    3434namespace lemon {
    3535
    36   /// \ingroup graphmapfactory
     36  /// \ingroin graphmapfactory
    3737  ///
    3838  /// \brief Graph map based on the std::vector storage.
    3939  ///
    4040  /// The VectorMap template class is graph map structure what
    41   /// automatically updates the map when a key is added to or erased from
     41  /// automatically indates the map when a key is added to or erased from
    4242  /// the map. This map factory uses the allocators to implement
    4343  /// the container functionality. This map factory
Note: See TracChangeset for help on using the changeset viewer.