COIN-OR::LEMON - Graph Library

Changeset 2231:06faf3f06d67 in lemon-0.x


Ignore:
Timestamp:
10/03/06 13:46:39 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2973
Message:

Some rearrangement of concepts and extenders
BpUGraph concepts and concept check test

Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/base_extender.h

    r2222 r2231  
    280280  };
    281281
     282  template <typename Base>
     283  class BidirBpUGraphExtender : public Base {
     284  public:
     285    typedef Base Parent;
     286    typedef BidirBpUGraphExtender Graph;
     287
     288    typedef typename Parent::Node Node;
     289    typedef typename Parent::UEdge UEdge;
     290
     291
     292    using Parent::first;
     293    using Parent::next;
     294
     295    using Parent::id;
     296
     297    class ANode : public Node {
     298      friend class BidirBpUGraphExtender;
     299    public:
     300      ANode() {}
     301      ANode(const Node& node) : Node(node) {
     302        LEMON_ASSERT(Parent::aNode(node) || node == INVALID,
     303                     typename Parent::NodeSetError());
     304      }
     305      ANode& operator=(const Node& node) {
     306        LEMON_ASSERT(Parent::aNode(node) || node == INVALID,
     307                     typename Parent::NodeSetError());
     308        Node::operator=(node);
     309        return *this;
     310      }
     311      ANode(Invalid) : Node(INVALID) {}
     312    };
     313
     314    void first(ANode& node) const {
     315      Parent::firstANode(static_cast<Node&>(node));
     316    }
     317    void next(ANode& node) const {
     318      Parent::nextANode(static_cast<Node&>(node));
     319    }
     320
     321    int id(const ANode& node) const {
     322      return Parent::aNodeId(node);
     323    }
     324
     325    class BNode : public Node {
     326      friend class BidirBpUGraphExtender;
     327    public:
     328      BNode() {}
     329      BNode(const Node& node) : Node(node) {
     330        LEMON_ASSERT(Parent::bNode(node) || node == INVALID,
     331                     typename Parent::NodeSetError());
     332      }
     333      BNode& operator=(const Node& node) {
     334        LEMON_ASSERT(Parent::bNode(node) || node == INVALID,
     335                     typename Parent::NodeSetError());
     336        Node::operator=(node);
     337        return *this;
     338      }
     339      BNode(Invalid) : Node(INVALID) {}
     340    };
     341
     342    void first(BNode& node) const {
     343      Parent::firstBNode(static_cast<Node&>(node));
     344    }
     345    void next(BNode& node) const {
     346      Parent::nextBNode(static_cast<Node&>(node));
     347    }
     348 
     349    int id(const BNode& node) const {
     350      return Parent::aNodeId(node);
     351    }
     352
     353    Node source(const UEdge& edge) const {
     354      return aNode(edge);
     355    }
     356    Node target(const UEdge& edge) const {
     357      return bNode(edge);
     358    }
     359
     360    void firstInc(UEdge& edge, bool& direction, const Node& node) const {
     361      if (Parent::aNode(node)) {
     362        Parent::firstFromANode(edge, node);
     363        direction = true;
     364      } else {
     365        Parent::firstFromBNode(edge, node);
     366        direction = static_cast<UEdge&>(edge) == INVALID;
     367      }
     368    }
     369    void nextInc(UEdge& edge, bool& direction) const {
     370      if (direction) {
     371        Parent::nextFromANode(edge);
     372      } else {
     373        Parent::nextFromBNode(edge);
     374        if (edge == INVALID) direction = true;
     375      }
     376    }
     377
     378    class Edge : public UEdge {
     379      friend class BidirBpUGraphExtender;
     380    protected:
     381      bool forward;
     382
     383      Edge(const UEdge& edge, bool _forward)
     384        : UEdge(edge), forward(_forward) {}
     385
     386    public:
     387      Edge() {}
     388      Edge (Invalid) : UEdge(INVALID), forward(true) {}
     389      bool operator==(const Edge& i) const {
     390        return UEdge::operator==(i) && forward == i.forward;
     391      }
     392      bool operator!=(const Edge& i) const {
     393        return UEdge::operator!=(i) || forward != i.forward;
     394      }
     395      bool operator<(const Edge& i) const {
     396        return UEdge::operator<(i) ||
     397          (!(i.forward<forward) && UEdge(*this)<UEdge(i));
     398      }
     399    };
     400
     401    void first(Edge& edge) const {
     402      Parent::first(static_cast<UEdge&>(edge));
     403      edge.forward = true;
     404    }
     405
     406    void next(Edge& edge) const {
     407      if (!edge.forward) {
     408        Parent::next(static_cast<UEdge&>(edge));
     409      }
     410      edge.forward = !edge.forward;
     411    }
     412
     413    void firstOut(Edge& edge, const Node& node) const {
     414      if (Parent::aNode(node)) {
     415        Parent::firstFromANode(edge, node);
     416        edge.forward = true;
     417      } else {
     418        Parent::firstFromBNode(edge, node);
     419        edge.forward = static_cast<UEdge&>(edge) == INVALID;
     420      }
     421    }
     422    void nextOut(Edge& edge) const {
     423      if (edge.forward) {
     424        Parent::nextFromANode(edge);
     425      } else {
     426        Parent::nextFromBNode(edge);
     427        edge.forward = static_cast<UEdge&>(edge) == INVALID;
     428      }
     429    }
     430
     431    void firstIn(Edge& edge, const Node& node) const {
     432      if (Parent::bNode(node)) {
     433        Parent::firstFromBNode(edge, node);
     434        edge.forward = true;   
     435      } else {
     436        Parent::firstFromANode(edge, node);
     437        edge.forward = static_cast<UEdge&>(edge) == INVALID;
     438      }
     439    }
     440    void nextIn(Edge& edge) const {
     441      if (edge.forward) {
     442        Parent::nextFromBNode(edge);
     443      } else {
     444        Parent::nextFromANode(edge);
     445        edge.forward = static_cast<UEdge&>(edge) == INVALID;
     446      }
     447    }
     448
     449    Node source(const Edge& edge) const {
     450      return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge);
     451    }
     452    Node target(const Edge& edge) const {
     453      return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge);
     454    }
     455
     456    int id(const Edge& edge) const {
     457      return (Parent::id(static_cast<const UEdge&>(edge)) << 1) +
     458        (edge.forward ? 0 : 1);
     459    }
     460    Edge edgeFromId(int id) const {
     461      return Edge(Parent::fromUEdgeId(id >> 1), (id & 1) == 0);
     462    }
     463    int maxEdgeId() const {
     464      return (Parent::maxUEdgeId() << 1) + 1;
     465    }
     466
     467    bool direction(const Edge& edge) const {
     468      return edge.forward;
     469    }
     470
     471    Edge direct(const UEdge& edge, bool direction) const {
     472      return Edge(edge, direction);
     473    }
     474
     475    int edgeNum() const {
     476      return 2 * Parent::uEdgeNum();
     477    }
     478
     479    int uEdgeNum() const {
     480      return Parent::uEdgeNum();
     481    }
     482
     483
     484  };
    282485}
    283486
  • lemon/bits/graph_adaptor_extender.h

    r2076 r2231  
    476476    }
    477477    ANode fromId(int id, ANode) const {
    478       return Parent::fromANodeId(id);
     478      return Parent::nodeFromANodeId(id);
    479479    }
    480480    BNode fromId(int id, BNode) const {
    481       return Parent::fromBNodeId(id);
     481      return Parent::nodeFromBNodeId(id);
    482482    }
    483483    Edge fromId(int id, Edge) const {
  • lemon/bits/graph_extender.h

    r2222 r2231  
    731731  class BpUGraphExtender : public Base {
    732732  public:
     733
    733734    typedef Base Parent;
    734735    typedef BpUGraphExtender Graph;
    735736
    736737    typedef typename Parent::Node Node;
     738    typedef typename Parent::ANode ANode;
     739    typedef typename Parent::BNode BNode;
     740    typedef typename Parent::Edge Edge;
    737741    typedef typename Parent::UEdge UEdge;
    738742
    739743
    740     using Parent::first;
    741     using Parent::next;
    742 
    743     using Parent::id;
    744 
    745     class ANode : public Node {
    746       friend class BpUGraphExtender;
    747     public:
    748       ANode() {}
    749       ANode(const Node& node) : Node(node) {
    750         LEMON_ASSERT(Parent::aNode(node) || node == INVALID,
    751                      typename Parent::NodeSetError());
    752       }
    753       ANode(Invalid) : Node(INVALID) {}
    754     };
    755 
    756     void first(ANode& node) const {
    757       Parent::firstANode(static_cast<Node&>(node));
    758     }
    759     void next(ANode& node) const {
    760       Parent::nextANode(static_cast<Node&>(node));
    761     }
    762 
    763     int id(const ANode& node) const {
    764       return Parent::aNodeId(node);
    765     }
    766 
    767     class BNode : public Node {
    768       friend class BpUGraphExtender;
    769     public:
    770       BNode() {}
    771       BNode(const Node& node) : Node(node) {
    772         LEMON_ASSERT(Parent::bNode(node) || node == INVALID,
    773                      typename Parent::NodeSetError());
    774       }
    775       BNode(Invalid) : Node(INVALID) {}
    776     };
    777 
    778     void first(BNode& node) const {
    779       Parent::firstBNode(static_cast<Node&>(node));
    780     }
    781     void next(BNode& node) const {
    782       Parent::nextBNode(static_cast<Node&>(node));
    783     }
    784  
    785     int id(const BNode& node) const {
    786       return Parent::aNodeId(node);
    787     }
    788 
    789     Node source(const UEdge& edge) const {
    790       return aNode(edge);
    791     }
    792     Node target(const UEdge& edge) const {
    793       return bNode(edge);
    794     }
    795 
    796     void firstInc(UEdge& edge, bool& direction, const Node& node) const {
    797       if (Parent::aNode(node)) {
    798         Parent::firstFromANode(edge, node);
    799         direction = true;
    800       } else {
    801         Parent::firstFromBNode(edge, node);
    802         direction = static_cast<UEdge&>(edge) == INVALID;
    803       }
    804     }
    805     void nextInc(UEdge& edge, bool& direction) const {
    806       if (direction) {
    807         Parent::nextFromANode(edge);
    808       } else {
    809         Parent::nextFromBNode(edge);
    810         if (edge == INVALID) direction = true;
    811       }
    812     }
    813 
    814     class Edge : public UEdge {
    815       friend class BpUGraphExtender;
    816     protected:
    817       bool forward;
    818 
    819       Edge(const UEdge& edge, bool _forward)
    820         : UEdge(edge), forward(_forward) {}
    821 
    822     public:
    823       Edge() {}
    824       Edge (Invalid) : UEdge(INVALID), forward(true) {}
    825       bool operator==(const Edge& i) const {
    826         return UEdge::operator==(i) && forward == i.forward;
    827       }
    828       bool operator!=(const Edge& i) const {
    829         return UEdge::operator!=(i) || forward != i.forward;
    830       }
    831       bool operator<(const Edge& i) const {
    832         return UEdge::operator<(i) ||
    833           (!(i.forward<forward) && UEdge(*this)<UEdge(i));
    834       }
    835     };
    836 
    837     void first(Edge& edge) const {
    838       Parent::first(static_cast<UEdge&>(edge));
    839       edge.forward = true;
    840     }
    841 
    842     void next(Edge& edge) const {
    843       if (!edge.forward) {
    844         Parent::next(static_cast<UEdge&>(edge));
    845       }
    846       edge.forward = !edge.forward;
    847     }
    848 
    849     void firstOut(Edge& edge, const Node& node) const {
    850       if (Parent::aNode(node)) {
    851         Parent::firstFromANode(edge, node);
    852         edge.forward = true;
    853       } else {
    854         Parent::firstFromBNode(edge, node);
    855         edge.forward = static_cast<UEdge&>(edge) == INVALID;
    856       }
    857     }
    858     void nextOut(Edge& edge) const {
    859       if (edge.forward) {
    860         Parent::nextFromANode(edge);
    861       } else {
    862         Parent::nextFromBNode(edge);
    863         edge.forward = static_cast<UEdge&>(edge) == INVALID;
    864       }
    865     }
    866 
    867     void firstIn(Edge& edge, const Node& node) const {
    868       if (Parent::bNode(node)) {
    869         Parent::firstFromBNode(edge, node);
    870         edge.forward = true;   
    871       } else {
    872         Parent::firstFromANode(edge, node);
    873         edge.forward = static_cast<UEdge&>(edge) == INVALID;
    874       }
    875     }
    876     void nextIn(Edge& edge) const {
    877       if (edge.forward) {
    878         Parent::nextFromBNode(edge);
    879       } else {
    880         Parent::nextFromANode(edge);
    881         edge.forward = static_cast<UEdge&>(edge) == INVALID;
    882       }
    883     }
    884 
    885     Node source(const Edge& edge) const {
    886       return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge);
    887     }
    888     Node target(const Edge& edge) const {
    889       return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge);
    890     }
    891 
    892     int id(const Edge& edge) const {
    893       return (Parent::id(static_cast<const UEdge&>(edge)) << 1) +
    894         (edge.forward ? 0 : 1);
    895     }
    896     Edge edgeFromId(int id) const {
    897       return Edge(Parent::fromUEdgeId(id >> 1), (id & 1) == 0);
    898     }
    899     int maxEdgeId() const {
    900       return (Parent::maxUEdgeId(UEdge()) << 1) + 1;
    901     }
    902 
    903     bool direction(const Edge& edge) const {
    904       return edge.forward;
    905     }
    906 
    907     Edge direct(const UEdge& edge, bool direction) const {
    908       return Edge(edge, direction);
    909     }
    910 
    911     int edgeNum() const {
    912       return 2 * Parent::uEdgeNum();
    913     }
    914 
    915     int uEdgeNum() const {
    916       return Parent::uEdgeNum();
    917     }
    918 
    919     Node oppositeNode(const UEdge& edge, const Node& node) const {
    920       return source(edge) == node ?
    921         target(edge) : source(edge);
    922     }
    923 
     744    Node oppositeNode(const Node& node, const UEdge& edge) const {
     745      return Parent::aNode(edge) == node ?
     746        Parent::bNode(edge) : Parent::aNode(edge);
     747    }
     748
     749    using Parent::direct;
    924750    Edge direct(const UEdge& edge, const Node& node) const {
    925       return Edge(edge, node == Parent::source(edge));
     751      return Parent::direct(edge, node == Parent::source(edge));
    926752    }
    927753
    928754    Edge oppositeEdge(const Edge& edge) const {
    929       return Parent::direct(edge, !Parent::direction(edge));
    930     }
    931 
    932 
     755      return direct(edge, !Parent::direction(edge));
     756    }
     757   
    933758    int maxId(Node) const {
    934759      return Parent::maxNodeId();
     
    941766    }
    942767    int maxId(Edge) const {
    943       return maxEdgeId();
     768      return Parent::maxEdgeId();
    944769    }
    945770    int maxId(UEdge) const {
     
    952777    }
    953778    ANode fromId(int id, ANode) const {
    954       return Parent::fromANodeId(id);
     779      return Parent::nodeFromANodeId(id);
    955780    }
    956781    BNode fromId(int id, BNode) const {
    957       return Parent::fromBNodeId(id);
     782      return Parent::nodeFromBNodeId(id);
    958783    }
    959784    Edge fromId(int id, Edge) const {
     
    13051130      NodeMap& operator=(const CMap& cmap) {
    13061131        checkConcept<concept::ReadMap<Node, _Value>, CMap>();
    1307         const typename Parent::Notifier* notifier = Parent::getNotifier();
    1308         Edge it;
    1309         for (graph.first(it); it != INVALID; graph.next(it)) {
    1310           Parent::set(it, cmap[it]);
    1311         }
    1312         return *this;
     1132        aNodeMap = cmap;
     1133        bNodeMap = cmap;
     1134        return *this;
    13131135      }
    13141136
     
    14601282   
    14611283      std::vector<Edge> edges;
    1462       edges.push_back(direct(uedge, true));
    1463       edges.push_back(direct(uedge, false));
     1284      edges.push_back(Parent::direct(uedge, true));
     1285      edges.push_back(Parent::direct(uedge, false));
    14641286      getNotifier(Edge()).add(edges);
    14651287   
     
    15001322    void erase(const UEdge& uedge) {
    15011323      std::vector<Edge> edges;
    1502       edges.push_back(direct(uedge, true));
    1503       edges.push_back(direct(uedge, false));
     1324      edges.push_back(Parent::direct(uedge, true));
     1325      edges.push_back(Parent::direct(uedge, false));
    15041326      getNotifier(Edge()).erase(edges);
    15051327      getNotifier(UEdge()).erase(uedge);
     
    15271349      UEdge uedge = Parent::findUEdge(u, v, prev);
    15281350      if (uedge != INVALID) {
    1529         return direct(uedge, Parent::aNode(u));
     1351        return Parent::direct(uedge, Parent::aNode(u));
    15301352      } else {
    15311353        return INVALID;
  • lemon/bpugraph_adaptor.h

    r2084 r2231  
    8888      graph->firstInc(i, d, n);
    8989    }
     90    void firstFromANode(UEdge& i, const Node& n) const {
     91      graph->firstFromANode(i, n);
     92    }
     93    void firstFromBNode(UEdge& i, const Node& n) const {
     94      graph->firstFromBNode(i, n);
     95    }
    9096
    9197    void next(Node& i) const { graph->next(i); }
     
    97103    void nextOut(Edge& i) const { graph->nextOut(i); }
    98104    void nextInc(UEdge &i, bool &d) const { graph->nextInc(i, d); }
     105    void nextFromANode(UEdge& i) const { graph->nextFromANode(i); }
     106    void nextFromBNode(UEdge& i) const { graph->nextFromBNode(i); }
    99107
    100108    Node source(const UEdge& e) const { return graph->source(e); }
     
    150158
    151159    Node fromNodeId(int id) const { return graph->fromNodeId(id); }
    152     ANode fromANodeId(int id) const { return graph->fromANodeId(id); }
    153     BNode fromBNodeId(int id) const { return graph->fromBNodeId(id); }
     160    ANode nodeFromANodeId(int id) const { return graph->nodeFromANodeId(id); }
     161    BNode nodeFromBNodeId(int id) const { return graph->nodeFromBNodeId(id); }
    154162    Edge fromEdgeId(int id) const { return graph->fromEdgeId(id); }
    155163    UEdge fromUEdgeId(int id) const { return graph->fromUEdgeId(id); }
     
    341349    void nextBNode(Node& i) const { Parent::nextANode(i); }
    342350
     351    void firstFromANode(UEdge& i, const Node& n) const {
     352      Parent::firstFromBNode(i, n);
     353    }
     354    void firstFromBNode(UEdge& i, const Node& n) const {
     355      Parent::firstFromANode(i, n);
     356    }
     357
     358    void nextFromANode(UEdge& i) const { Parent::nextFromBNode(i); }
     359    void nextFromBNode(UEdge& i) const { Parent::nextFromANode(i); }
     360
    343361    int id(const ANode& v) const { return Parent::id(v); }
    344362    int id(const BNode& v) const { return Parent::id(v); }
    345363
    346     ANode fromANodeId(int id) const { return Parent::fromBNodeId(id); }
    347     BNode fromBNodeId(int id) const { return Parent::fromANodeId(id); }
     364    ANode nodeFromANodeId(int id) const { return Parent::nodeFromBNodeId(id); }
     365    BNode nodeFromBNodeId(int id) const { return Parent::nodeFromANodeId(id); }
    348366
    349367    int maxANodeId() const { return Parent::maxBNodeId(); }
     
    550568  /// the residual graph of the matching.
    551569  template <typename _BpUGraph,
    552             typename _ANMatchingMap, typename _BNMatchingMap>
     570            typename _ANMatchingMap =
     571            typename _BpUGraph::template ANodeMap<typename _BpUGraph::UEdge>,
     572            typename _BNMatchingMap =
     573            typename _BpUGraph::template BNodeMap<typename _BpUGraph::UEdge> >
    553574  class MatchingBpUGraphAdaptor
    554575    : public BpUGraphAdaptorExtender<
  • lemon/concept/bpugraph.h

    r2163 r2231  
    133133      /// suggested to use it directly. It can be converted easily to
    134134      /// node and vice versa. The usage of this class is limited
    135       /// two use just as template parameters for special map types.
    136       class ANode {
    137       public:
    138         /// Default constructor
    139 
    140         /// @warning The default constructor sets the iterator
    141         /// to an undefined value.
    142         ANode() { }
    143         /// Copy constructor.
    144 
    145         /// Copy constructor.
    146         ///
    147         ANode(const ANode&) { }
     135      /// to use just as template parameters for special map types.
     136      class ANode : public Node {
     137      public:
     138        /// Default constructor
     139
     140        /// @warning The default constructor sets the iterator
     141        /// to an undefined value.
     142        ANode() : Node() { }
     143        /// Copy constructor.
     144
     145        /// Copy constructor.
     146        ///
     147        ANode(const ANode&) : Node() { }
    148148
    149149        /// Construct the same node as ANode.
     
    151151        /// Construct the same node as ANode. It may throws assertion
    152152        /// when the given node is from the BNode set.
    153         ANode(const Node&) { }
     153        ANode(const Node&) : Node() { }
     154
     155        /// Assign node to A-node.
     156
     157        /// Besides the core graph item functionality each node should
     158        /// be convertible to the represented A-node if it is it possible.
     159        ANode& operator=(const Node&) { return *this; }
    154160
    155161        /// Invalid constructor \& conversion.
     
    187193      /// suggested to use it directly. It can be converted easily to
    188194      /// node and vice versa. The usage of this class is limited
    189       /// two use just as template parameters for special map types.
    190       class BNode {
    191       public:
    192         /// Default constructor
    193 
    194         /// @warning The default constructor sets the iterator
    195         /// to an undefined value.
    196         BNode() { }
    197         /// Copy constructor.
    198 
    199         /// Copy constructor.
    200         ///
    201         BNode(const BNode&) { }
     195      /// to use just as template parameters for special map types.
     196      class BNode : public Node {
     197      public:
     198        /// Default constructor
     199
     200        /// @warning The default constructor sets the iterator
     201        /// to an undefined value.
     202        BNode() : Node() { }
     203        /// Copy constructor.
     204
     205        /// Copy constructor.
     206        ///
     207        BNode(const BNode&) : Node() { }
    202208
    203209        /// Construct the same node as BNode.
     
    205211        /// Construct the same node as BNode. It may throws assertion
    206212        /// when the given node is from the ANode set.
    207         BNode(const Node&) { }
     213        BNode(const Node&) : Node() { }
     214
     215        /// Assign node to B-node.
     216
     217        /// Besides the core graph item functionality each node should
     218        /// be convertible to the represented B-node if it is it possible.
     219        BNode& operator=(const Node&) { return *this; }
    208220
    209221        /// Invalid constructor \& conversion.
     
    718730        ///Assignment operator
    719731        NodeMap& operator=(const NodeMap&) { return *this; }
    720         // \todo fix this concept
     732        ///Assignment operator
     733        template <typename CMap>
     734        NodeMap& operator=(const CMap&) {
     735          checkConcept<ReadMap<Node, T>, CMap>();
     736          return *this;
     737        }
    721738      };
    722739
     
    739756
    740757        ///Copy constructor
    741         ANodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
     758        ANodeMap(const ANodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
    742759        ///Assignment operator
    743         ANodeMap& operator=(const NodeMap&) { return *this; }
    744         // \todo fix this concept
     760        ANodeMap& operator=(const ANodeMap&) { return *this; }
     761        ///Assignment operator
     762        template <typename CMap>
     763        ANodeMap& operator=(const CMap&) {
     764          checkConcept<ReadMap<Node, T>, CMap>();
     765          return *this;
     766        }
    745767      };
    746768
     
    763785
    764786        ///Copy constructor
    765         BNodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
     787        BNodeMap(const BNodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
    766788        ///Assignment operator
    767         BNodeMap& operator=(const NodeMap&) { return *this; }
    768         // \todo fix this concept
     789        BNodeMap& operator=(const BNodeMap&) { return *this; }
     790        ///Assignment operator
     791        template <typename CMap>
     792        BNodeMap& operator=(const CMap&) {
     793          checkConcept<ReadMap<Node, T>, CMap>();
     794          return *this;
     795        }
    769796      };
    770797
     
    789816        ///Assignment operator
    790817        EdgeMap& operator=(const EdgeMap&) { return *this; }
    791         // \todo fix this concept   
     818        ///Assignment operator
     819        template <typename CMap>
     820        EdgeMap& operator=(const CMap&) {
     821          checkConcept<ReadMap<Edge, T>, CMap>();
     822          return *this;
     823        }
    792824      };
    793825
     
    812844        ///Assignment operator
    813845        UEdgeMap &operator=(const UEdgeMap&) { return *this; }
    814         // \todo fix this concept   
     846        ///Assignment operator
     847        template <typename CMap>
     848        UEdgeMap& operator=(const CMap&) {
     849          checkConcept<ReadMap<UEdge, T>, CMap>();
     850          return *this;
     851        }
    815852      };
    816853
     
    934971      }
    935972
     973      void first(Node&) const {}
     974      void next(Node&) const {}
     975
     976      void first(Edge&) const {}
     977      void next(Edge&) const {}
     978
     979      void first(UEdge&) const {}
     980      void next(UEdge&) const {}
     981
     982      void firstANode(Node&) const {}
     983      void nextANode(Node&) const {}
     984
     985      void firstBNode(Node&) const {}
     986      void nextBNode(Node&) const {}
     987
     988      void firstIn(Edge&, const Node&) const {}
     989      void nextIn(Edge&) const {}
     990
     991      void firstOut(Edge&, const Node&) const {}
     992      void nextOut(Edge&) const {}
     993
     994      void firstInc(UEdge &, bool &, const Node &) const {}
     995      void nextInc(UEdge &, bool &) const {}
     996
     997      void firstFromANode(UEdge&, const Node&) const {}
     998      void nextFromANode(UEdge&) const {}
     999
     1000      void firstFromBNode(UEdge&, const Node&) const {}
     1001      void nextFromBNode(UEdge&) const {}
     1002
    9361003      template <typename Graph>
    9371004      struct Constraints {
    9381005        void constraints() {
     1006          checkConcept<IterableBpUGraphComponent<>, Graph>();
     1007          checkConcept<MappableBpUGraphComponent<>, Graph>();
    9391008        }
    9401009      };
  • lemon/concept/graph.h

    r2134 r2231  
    440440      struct Constraints {
    441441        void constraints() {
    442           checkConcept<BaseIterableGraphComponent<>, Graph>();
    443442          checkConcept<IterableGraphComponent<>, Graph>();
    444443          checkConcept<MappableGraphComponent<>, Graph>();
  • lemon/concept/graph_components.h

    r2181 r2231  
    219219        /// be convertible to the represented undirected edge.
    220220        UEdge(const Edge&) {}
     221        /// \brief Assign edge to undirected edge.
     222        ///
     223        /// Besides the core graph item functionality each edge should
     224        /// be convertible to the represented undirected edge.
     225        UEdge& operator=(const Edge&) { return *this; }
    221226      };
    222227
     
    291296    };
    292297
    293     /// \brief An empty iterable base graph class.
     298    /// \brief An empty base bipartite undirected graph class.
    294299    /// 
    295     /// This class provides beside the core graph features
    296     /// core iterable interface for the graph structure.
    297     /// Most of the base graphs should be conform to this concept.
    298     template <typename _Base = BaseGraphComponent>
    299     class BaseIterableGraphComponent : public _Base {
    300     public:
    301 
    302       typedef _Base Base;
    303       typedef typename Base::Node Node;
    304       typedef typename Base::Edge Edge;
    305 
    306       /// \brief Gives back the first node in the iterating order.
    307       ///     
    308       /// Gives back the first node in the iterating order.
    309       ///     
    310       void first(Node&) const {}
    311 
    312       /// \brief Gives back the next node in the iterating order.
    313       ///
    314       /// Gives back the next node in the iterating order.
    315       ///     
    316       void next(Node&) const {}
    317 
    318       /// \brief Gives back the first edge in the iterating order.
    319       ///
    320       /// Gives back the first edge in the iterating order.
    321       ///     
    322       void first(Edge&) const {}
    323 
    324       /// \brief Gives back the next edge in the iterating order.
    325       ///
    326       /// Gives back the next edge in the iterating order.
    327       ///     
    328       void next(Edge&) const {}
    329 
    330 
    331       /// \brief Gives back the first of the edges point to the given
    332       /// node.
    333       ///
    334       /// Gives back the first of the edges point to the given node.
    335       ///     
    336       void firstIn(Edge&, const Node&) const {}
    337 
    338       /// \brief Gives back the next of the edges points to the given
    339       /// node.
    340       ///
    341       /// Gives back the next of the edges points to the given node.
    342       ///
    343       void nextIn(Edge&) const {}
    344 
    345       /// \brief Gives back the first of the edges start from the
    346       /// given node.
    347       ///     
    348       /// Gives back the first of the edges start from the given node.
    349       ///     
    350       void firstOut(Edge&, const Node&) const {}
    351 
    352       /// \brief Gives back the next of the edges start from the given
    353       /// node.
    354       ///
    355       /// Gives back the next of the edges start from the given node.
    356       ///     
    357       void nextOut(Edge&) const {}
    358 
    359 
     300    /// This class provides the minimal set of features needed for an
     301    /// bipartite undirected graph structure. All bipartite undirected
     302    /// graph concepts have to be conform to this base graph. It just
     303    /// provides types for nodes, A-nodes, B-nodes, edges and
     304    /// undirected edges and functions to get the source and the
     305    /// target of the edges and undirected edges, conversion from
     306    /// edges to undirected edges and function to get both direction
     307    /// of the undirected edges.
     308    class BaseBpUGraphComponent : public BaseUGraphComponent {
     309    public:
     310      typedef BaseUGraphComponent::Node Node;
     311      typedef BaseUGraphComponent::Edge Edge;
     312      typedef BaseUGraphComponent::UEdge UEdge;
     313
     314      /// \brief Helper class for A-nodes.
     315      ///
     316      /// This class is just a helper class for A-nodes, it is not
     317      /// suggested to use it directly. It can be converted easily to
     318      /// node and vice versa. The usage of this class is limited
     319      /// to use just as template parameters for special map types.
     320      class ANode : public Node {
     321      public:
     322        typedef Node Parent;
     323
     324        /// \brief Default constructor.
     325        ///     
     326        /// \warning The default constructor is not required to set
     327        /// the item to some well-defined value. So you should consider it
     328        /// as uninitialized.
     329        ANode() {}
     330        /// \brief Copy constructor.
     331        ///
     332        /// Copy constructor.
     333        ///
     334        ANode(const ANode &) : Parent() {}
     335        /// \brief Invalid constructor \& conversion.
     336        ///
     337        /// This constructor initializes the item to be invalid.
     338        /// \sa Invalid for more details.
     339        ANode(Invalid) {}
     340        /// \brief Converter from node to A-node.
     341        ///
     342        /// Besides the core graph item functionality each node should
     343        /// be convertible to the represented A-node if it is it possible.
     344        ANode(const Node&) {}
     345        /// \brief Assign node to A-node.
     346        ///
     347        /// Besides the core graph item functionality each node should
     348        /// be convertible to the represented A-node if it is it possible.
     349        ANode& operator=(const Node&) { return *this; }
     350      };
     351
     352      /// \brief Helper class for B-nodes.
     353      ///
     354      /// This class is just a helper class for B-nodes, it is not
     355      /// suggested to use it directly. It can be converted easily to
     356      /// node and vice versa. The usage of this class is limited
     357      /// to use just as template parameters for special map types.
     358      class BNode : public Node {
     359      public:
     360        typedef Node Parent;
     361
     362        /// \brief Default constructor.
     363        ///     
     364        /// \warning The default constructor is not required to set
     365        /// the item to some well-defined value. So you should consider it
     366        /// as uninitialized.
     367        BNode() {}
     368        /// \brief Copy constructor.
     369        ///
     370        /// Copy constructor.
     371        ///
     372        BNode(const BNode &) : Parent() {}
     373        /// \brief Invalid constructor \& conversion.
     374        ///
     375        /// This constructor initializes the item to be invalid.
     376        /// \sa Invalid for more details.
     377        BNode(Invalid) {}
     378        /// \brief Converter from node to B-node.
     379        ///
     380        /// Besides the core graph item functionality each node should
     381        /// be convertible to the represented B-node if it is it possible.
     382        BNode(const Node&) {}
     383        /// \brief Assign node to B-node.
     384        ///
     385        /// Besides the core graph item functionality each node should
     386        /// be convertible to the represented B-node if it is it possible.
     387        BNode& operator=(const Node&) { return *this; }
     388      };
     389     
     390      /// \brief Gives back %true when the node is A-node.
     391      ///
     392      /// Gives back %true when the node is A-node.
     393      bool aNode(const Node&) const { return false; }
     394
     395      /// \brief Gives back %true when the node is B-node.
     396      ///
     397      /// Gives back %true when the node is B-node.
     398      bool bNode(const Node&) const { return false; }
     399
     400      /// \brief Gives back the A-node of the undirected edge.
     401      ///
     402      /// Gives back the A-node of the undirected edge.
     403      Node aNode(const UEdge&) const { return INVALID; }
     404
     405      /// \brief Gives back the B-node of the undirected edge.
     406      ///
     407      /// Gives back the B-node of the undirected edge.
     408      Node bNode(const UEdge&) const { return INVALID; }
     409     
    360410      template <typename _Graph>
    361411      struct Constraints {
     412        typedef typename _Graph::Node Node;
     413        typedef typename _Graph::ANode ANode;
     414        typedef typename _Graph::BNode BNode;
     415        typedef typename _Graph::Edge Edge;
     416        typedef typename _Graph::UEdge UEdge;
    362417     
    363418        void constraints() {
    364           checkConcept< BaseGraphComponent, _Graph >();
    365           typename _Graph::Node node(INVALID);     
    366           typename _Graph::Edge edge(INVALID);
     419          checkConcept<BaseUGraphComponent, _Graph>();
     420          checkConcept<GraphItem<'a'>, ANode>();
     421          checkConcept<GraphItem<'b'>, BNode>();
    367422          {
    368             graph.first(node);
    369             graph.next(node);
    370           }
    371           {
    372             graph.first(edge);
    373             graph.next(edge);
    374           }
    375           {
    376             graph.firstIn(edge, node);
    377             graph.nextIn(edge);
    378           }
    379           {
    380             graph.firstOut(edge, node);
    381             graph.nextOut(edge);
    382           }
    383         }
    384 
     423            Node n;
     424            UEdge ue(INVALID);
     425            bool b;
     426            n = graph.aNode(ue);
     427            n = graph.bNode(ue);
     428            b = graph.aNode(n);
     429            b = graph.bNode(n);
     430            ANode an;
     431            an = n; n = an;
     432            BNode bn;
     433            bn = n; n = bn;           
     434            ignore_unused_variable_warning(b);
     435          }     
     436        }
     437     
    385438        const _Graph& graph;
    386439      };
    387     };
    388 
    389     /// \brief An empty iterable base undirected graph class.
    390     /// 
    391     /// This class provides beside the core undirceted graph features
    392     /// core iterable interface for the undirected graph structure.
    393     /// Most of the base undirected graphs should be conform to this
    394     /// concept.
    395     template <typename _Base = BaseUGraphComponent>
    396     class BaseIterableUGraphComponent
    397       : public BaseIterableGraphComponent<_Base> {
    398     public:
    399 
    400       typedef _Base Base;
    401       typedef typename Base::UEdge UEdge;
    402       typedef typename Base::Node Node;
    403 
    404       using BaseIterableGraphComponent<_Base>::first;
    405       using BaseIterableGraphComponent<_Base>::next;
    406 
    407       /// \brief Gives back the first undirected edge in the iterating
    408       /// order.
    409       ///
    410       /// Gives back the first undirected edge in the iterating order.
    411       ///     
    412       void first(UEdge&) const {}
    413 
    414       /// \brief Gives back the next undirected edge in the iterating
    415       /// order.
    416       ///
    417       /// Gives back the next undirected edge in the iterating order.
    418       ///     
    419       void next(UEdge&) const {}
    420 
    421 
    422       /// \brief Gives back the first of the undirected edges from the
    423       /// given node.
    424       ///
    425       /// Gives back the first of the undirected edges from the given
    426       /// node. The bool parameter gives back that direction which
    427       /// gives a good direction of the uedge so the source of the
    428       /// directed edge is the given node.
    429       void firstInc(UEdge&, bool&, const Node&) const {}
    430 
    431       /// \brief Gives back the next of the undirected edges from the
    432       /// given node.
    433       ///
    434       /// Gives back the next of the undirected edges from the given
    435       /// node. The bool parameter should be used as the \c firstInc()
    436       /// use it.
    437       void nextInc(UEdge&, bool&) const {}
    438 
    439       template <typename _Graph>
    440       struct Constraints {
    441      
    442         void constraints() {
    443           checkConcept<Base, _Graph >();
    444           checkConcept<BaseIterableGraphComponent<Base>, _Graph>();
    445           typename _Graph::Node node(INVALID);
    446           typename _Graph::UEdge uedge(INVALID);
    447           bool dir;
    448           {
    449             graph.first(uedge);
    450             graph.next(uedge);
    451           }
    452           {
    453             graph.firstInc(uedge, dir, node);
    454             graph.nextInc(uedge, dir);
    455           }
    456         }
    457 
    458         const _Graph& graph;
    459       };
     440
    460441    };
    461442
     
    518499
    519500        void constraints() {
    520           checkConcept< BaseGraphComponent, _Graph >();
     501          checkConcept<Base, _Graph >();
    521502          typename _Graph::Node node;
    522503          int nid = graph.id(node);
     
    591572    };
    592573
    593     /// \brief An empty extendable base graph class.
    594     ///
    595     /// This class provides beside the core graph features
    596     /// core graph extend interface for the graph structure.
    597     /// The most of the base graphs should be conform to this concept.
    598     template <typename _Base = BaseGraphComponent>
    599     class BaseExtendableGraphComponent : public _Base {
    600     public:
    601 
    602       typedef typename _Base::Node Node;
    603       typedef typename _Base::Edge Edge;
    604 
    605       /// \brief Adds a new node to the graph.
    606       ///
    607       /// Adds a new node to the graph.
    608       ///
    609       Node addNode() {
    610         return INVALID;
    611       }
    612    
    613       /// \brief Adds a new edge connects the given two nodes.
    614       ///
    615       /// Adds a new edge connects the the given two nodes.
    616       Edge addEdge(const Node&, const Node&) {
    617         return INVALID;
    618       }
    619 
    620       template <typename _Graph>
    621       struct Constraints {
    622         void constraints() {
    623           typename _Graph::Node node_a, node_b;
    624           node_a = graph.addNode();
    625           node_b = graph.addNode();
    626           typename _Graph::Edge edge;
    627           edge = graph.addEdge(node_a, node_b);
    628         }
    629 
    630         _Graph& graph;
    631       };
    632     };
    633 
    634     /// \brief An empty extendable base undirected graph class.
    635     ///
    636     /// This class provides beside the core undirected graph features
    637     /// core undircted graph extend interface for the graph structure.
    638     /// The most of the base graphs should be conform to this concept.
    639     template <typename _Base = BaseUGraphComponent>
    640     class BaseExtendableUGraphComponent : public _Base {
    641     public:
    642 
    643       typedef typename _Base::Node Node;
    644       typedef typename _Base::UEdge UEdge;
    645 
    646       /// \brief Adds a new node to the graph.
    647       ///
    648       /// Adds a new node to the graph.
    649       ///
    650       Node addNode() {
    651         return INVALID;
    652       }
    653    
    654       /// \brief Adds a new edge connects the given two nodes.
    655       ///
    656       /// Adds a new edge connects the the given two nodes.
    657       UEdge addEdge(const Node&, const Node&) {
    658         return INVALID;
    659       }
    660 
    661       template <typename _Graph>
    662       struct Constraints {
    663         void constraints() {
    664           typename _Graph::Node node_a, node_b;
    665           node_a = graph.addNode();
    666           node_b = graph.addNode();
    667           typename _Graph::UEdge uedge;
    668           uedge = graph.addUEdge(node_a, node_b);
    669         }
    670 
    671         _Graph& graph;
    672       };
    673     };
    674 
    675     /// \brief An empty erasable base graph class.
     574    /// \brief An empty idable base bipartite undirected graph class.
    676575    /// 
    677     /// This class provides beside the core graph features
    678     /// core erase functions for the graph structure.
    679     /// The most of the base graphs should be conform to this concept.
    680     template <typename _Base = BaseGraphComponent>
    681     class BaseErasableGraphComponent : public _Base {
     576    /// This class provides beside the core bipartite undirected graph
     577    /// features core id functions for the bipartite undirected graph
     578    /// structure.  The most of the base undirected graphs should be
     579    /// conform to this concept.
     580    template <typename _Base = BaseBpUGraphComponent>
     581    class IDableBpUGraphComponent : public IDableUGraphComponent<_Base> {
    682582    public:
    683583
    684584      typedef _Base Base;
    685585      typedef typename Base::Node Node;
    686       typedef typename Base::Edge Edge;
    687 
    688       /// \brief Erase a node from the graph.
    689       ///
    690       /// Erase a node from the graph. This function should not
    691       /// erase edges connecting to the Node.
    692       void erase(const Node&) {}   
    693 
    694       /// \brief Erase an edge from the graph.
    695       ///
    696       /// Erase an edge from the graph.
    697       ///
    698       void erase(const Edge&) {}
     586
     587      using IDableUGraphComponent<_Base>::id;
     588
     589      /// \brief Gives back an unique integer id for the ANode.
     590      ///
     591      /// Gives back an unique integer id for the ANode.
     592      ///
     593      int aNodeId(const Node&) const { return -1;}
     594
     595      /// \brief Gives back the undirected edge by the unique id.
     596      ///
     597      /// Gives back the undirected edge by the unique id.  If the
     598      /// graph does not contain edge with the given id then the
     599      /// result of the function is undetermined.
     600      Node nodeFromANodeId(int) const { return INVALID;}
     601
     602      /// \brief Gives back an integer greater or equal to the maximum
     603      /// ANode id.
     604      ///
     605      /// Gives back an integer greater or equal to the maximum ANode
     606      /// id.
     607      int maxANodeId() const { return -1;}
     608
     609      /// \brief Gives back an unique integer id for the BNode.
     610      ///
     611      /// Gives back an unique integer id for the BNode.
     612      ///
     613      int bNodeId(const Node&) const { return -1;}
     614
     615      /// \brief Gives back the undirected edge by the unique id.
     616      ///
     617      /// Gives back the undirected edge by the unique id.  If the
     618      /// graph does not contain edge with the given id then the
     619      /// result of the function is undetermined.
     620      Node nodeFromBNodeId(int) const { return INVALID;}
     621
     622      /// \brief Gives back an integer greater or equal to the maximum
     623      /// BNode id.
     624      ///
     625      /// Gives back an integer greater or equal to the maximum BNode
     626      /// id.
     627      int maxBNodeId() const { return -1;}
    699628
    700629      template <typename _Graph>
    701630      struct Constraints {
    702         void constraints() {
    703           typename _Graph::Node node;
    704           graph.erase(node);
    705           typename _Graph::Edge edge;
    706           graph.erase(edge);
    707         }
    708 
    709         _Graph& graph;
    710       };
    711     };
    712 
    713     /// \brief An empty erasable base undirected graph class.
    714     /// 
    715     /// This class provides beside the core undirected graph features
    716     /// core erase functions for the undirceted graph structure.
    717     template <typename _Base = BaseUGraphComponent>
    718     class BaseErasableUGraphComponent : public _Base {
    719     public:
    720 
    721       typedef _Base Base;
    722       typedef typename Base::Node Node;
    723       typedef typename Base::UEdge UEdge;
    724 
    725       /// \brief Erase a node from the graph.
    726       ///
    727       /// Erase a node from the graph. This function should not
    728       /// erase edges connecting to the Node.
    729       void erase(const Node&) {}   
    730 
    731       /// \brief Erase an edge from the graph.
    732       ///
    733       /// Erase an edge from the graph.
    734       ///
    735       void erase(const UEdge&) {}
    736 
    737       template <typename _Graph>
    738       struct Constraints {
    739         void constraints() {
    740           typename _Graph::Node node;
    741           graph.erase(node);
    742           typename _Graph::Edge edge;
    743           graph.erase(edge);
    744         }
    745 
    746         _Graph& graph;
    747       };
    748     };
    749 
    750     /// \brief An empty clearable base graph class.
    751     ///
    752     /// This class provides beside the core graph features
    753     /// core clear functions for the graph structure.
    754     /// The most of the base graphs should be conform to this concept.
    755     template <typename _Base = BaseGraphComponent>
    756     class BaseClearableGraphComponent : public _Base {
    757     public:
    758 
    759       /// \brief Erase all the nodes and edges from the graph.
    760       ///
    761       /// Erase all the nodes and edges from the graph.
    762       ///
    763       void clear() {}   
    764 
    765       template <typename _Graph>
    766       struct Constraints {
    767         void constraints() {
    768           graph.clear();
    769         }
    770 
    771         _Graph graph;
    772       };
    773     };
    774 
    775     /// \brief An empty clearable base undirected graph class.
    776     ///
    777     /// This class provides beside the core undirected graph features
    778     /// core clear functions for the undirected graph structure.
    779     /// The most of the base graphs should be conform to this concept.
    780     template <typename _Base = BaseUGraphComponent>
    781     class BaseClearableUGraphComponent : public _Base {
    782     public:
    783 
    784       /// \brief Erase all the nodes and undirected edges from the graph.
    785       ///
    786       /// Erase all the nodes and undirected edges from the graph.
    787       ///
    788       void clear() {}   
    789 
    790       template <typename _Graph>
    791       struct Constraints {
    792         void constraints() {
    793           graph.clear();
    794         }
    795 
    796         _Graph graph;
    797       };
    798     };
    799 
     631
     632        void constraints() {
     633          checkConcept<Base, _Graph >();
     634          checkConcept<IDableGraphComponent<Base>, _Graph >();
     635          typename _Graph::Node node(INVALID);
     636          int id;
     637          id = graph.aNodeId(node);
     638          id = graph.bNodeId(node);
     639          node = graph.nodeFromANodeId(id);
     640          node = graph.nodeFromBNodeId(id);
     641          id = graph.maxANodeId();
     642          id = graph.maxBNodeId();
     643        }
     644
     645        const _Graph& graph;
     646      };
     647    };
    800648
    801649    /// \brief Skeleton class for graph NodeIt and EdgeIt
     
    948796    /// This class provides beside the core graph features
    949797    /// iterator based iterable interface for the graph structure.
    950     /// This concept is part of the GraphConcept.
     798    /// This concept is part of the Graph concept.
    951799    template <typename _Base = BaseGraphComponent>
    952800    class IterableGraphComponent : public _Base {
     
    960808      typedef IterableGraphComponent Graph;
    961809
     810      /// \name Base iteration
     811      ///
     812      /// This interface provides functions for iteration on graph items
     813      ///
     814      /// @{ 
     815
     816      /// \brief Gives back the first node in the iterating order.
     817      ///     
     818      /// Gives back the first node in the iterating order.
     819      ///     
     820      void first(Node&) const {}
     821
     822      /// \brief Gives back the next node in the iterating order.
     823      ///
     824      /// Gives back the next node in the iterating order.
     825      ///     
     826      void next(Node&) const {}
     827
     828      /// \brief Gives back the first edge in the iterating order.
     829      ///
     830      /// Gives back the first edge in the iterating order.
     831      ///     
     832      void first(Edge&) const {}
     833
     834      /// \brief Gives back the next edge in the iterating order.
     835      ///
     836      /// Gives back the next edge in the iterating order.
     837      ///     
     838      void next(Edge&) const {}
     839
     840
     841      /// \brief Gives back the first of the edges point to the given
     842      /// node.
     843      ///
     844      /// Gives back the first of the edges point to the given node.
     845      ///     
     846      void firstIn(Edge&, const Node&) const {}
     847
     848      /// \brief Gives back the next of the edges points to the given
     849      /// node.
     850      ///
     851      /// Gives back the next of the edges points to the given node.
     852      ///
     853      void nextIn(Edge&) const {}
     854
     855      /// \brief Gives back the first of the edges start from the
     856      /// given node.
     857      ///     
     858      /// Gives back the first of the edges start from the given node.
     859      ///     
     860      void firstOut(Edge&, const Node&) const {}
     861
     862      /// \brief Gives back the next of the edges start from the given
     863      /// node.
     864      ///
     865      /// Gives back the next of the edges start from the given node.
     866      ///     
     867      void nextOut(Edge&) const {}
     868
     869      /// @}
     870
     871      /// \name Class based iteration
     872      ///
     873      /// This interface provides functions for iteration on graph items
     874      ///
     875      /// @{
    962876
    963877      /// \brief This iterator goes through each node.
     
    1009923      Node runningNode(const OutEdgeIt&) const { return INVALID; }
    1010924
    1011       /// \brief The opposite node on the given edge.
    1012       ///
    1013       /// Gives back the opposite on the given edge.
    1014       /// \todo It should not be here.
    1015       Node oppositeNode(const Node&, const Edge&) const { return INVALID; }
    1016 
    1017    
     925      /// @}
     926
    1018927      template <typename _Graph>
    1019928      struct Constraints {
    1020929        void constraints() {
    1021930          checkConcept<Base, _Graph>();
    1022          
    1023           checkConcept<GraphItemIt<_Graph, typename _Graph::Edge>,
    1024             typename _Graph::EdgeIt >();
    1025           checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
    1026             typename _Graph::NodeIt >();
    1027           checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
    1028             typename _Graph::Node, 'i'>, typename _Graph::InEdgeIt>();
    1029           checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
    1030             typename _Graph::Node, 'o'>, typename _Graph::OutEdgeIt>();
    1031 
    1032           typename _Graph::Node n;
    1033           typename _Graph::InEdgeIt ieit(INVALID);
    1034           typename _Graph::OutEdgeIt oeit(INVALID);
    1035           n = graph.baseNode(ieit);
    1036           n = graph.runningNode(ieit);
    1037           n = graph.baseNode(oeit);
    1038           n = graph.runningNode(oeit);
    1039           ignore_unused_variable_warning(n);
     931
     932          {
     933            typename _Graph::Node node(INVALID);     
     934            typename _Graph::Edge edge(INVALID);
     935            {
     936              graph.first(node);
     937              graph.next(node);
     938            }
     939            {
     940              graph.first(edge);
     941              graph.next(edge);
     942            }
     943            {
     944              graph.firstIn(edge, node);
     945              graph.nextIn(edge);
     946            }
     947            {
     948              graph.firstOut(edge, node);
     949              graph.nextOut(edge);
     950            }
     951          }           
     952
     953          {
     954            checkConcept<GraphItemIt<_Graph, typename _Graph::Edge>,
     955              typename _Graph::EdgeIt >();
     956            checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
     957              typename _Graph::NodeIt >();
     958            checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
     959              typename _Graph::Node, 'i'>, typename _Graph::InEdgeIt>();
     960            checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
     961              typename _Graph::Node, 'o'>, typename _Graph::OutEdgeIt>();
     962
     963            typename _Graph::Node n;
     964            typename _Graph::InEdgeIt ieit(INVALID);
     965            typename _Graph::OutEdgeIt oeit(INVALID);
     966            n = graph.baseNode(ieit);
     967            n = graph.runningNode(ieit);
     968            n = graph.baseNode(oeit);
     969            n = graph.runningNode(oeit);
     970            ignore_unused_variable_warning(n);
     971          }
    1040972        }
    1041973       
     
    1049981    /// This class provides beside the core graph features iterator
    1050982    /// based iterable interface for the undirected graph structure.
    1051     /// This concept is part of the GraphConcept.
     983    /// This concept is part of the UGraph concept.
    1052984    template <typename _Base = BaseUGraphComponent>
    1053985    class IterableUGraphComponent : public IterableGraphComponent<_Base> {
     
    1061993   
    1062994      typedef IterableUGraphComponent Graph;
     995
     996      /// \name Base iteration
     997      ///
     998      /// This interface provides functions for iteration on graph items
     999      /// @{ 
     1000
     1001      using IterableGraphComponent<_Base>::first;
     1002      using IterableGraphComponent<_Base>::next;
     1003
     1004      /// \brief Gives back the first undirected edge in the iterating
     1005      /// order.
     1006      ///
     1007      /// Gives back the first undirected edge in the iterating order.
     1008      ///     
     1009      void first(UEdge&) const {}
     1010
     1011      /// \brief Gives back the next undirected edge in the iterating
     1012      /// order.
     1013      ///
     1014      /// Gives back the next undirected edge in the iterating order.
     1015      ///     
     1016      void next(UEdge&) const {}
     1017
     1018
     1019      /// \brief Gives back the first of the undirected edges from the
     1020      /// given node.
     1021      ///
     1022      /// Gives back the first of the undirected edges from the given
     1023      /// node. The bool parameter gives back that direction which
     1024      /// gives a good direction of the uedge so the source of the
     1025      /// directed edge is the given node.
     1026      void firstInc(UEdge&, bool&, const Node&) const {}
     1027
     1028      /// \brief Gives back the next of the undirected edges from the
     1029      /// given node.
     1030      ///
     1031      /// Gives back the next of the undirected edges from the given
     1032      /// node. The bool parameter should be used as the \c firstInc()
     1033      /// use it.
     1034      void nextInc(UEdge&, bool&) const {}
     1035
    10631036      using IterableGraphComponent<_Base>::baseNode;
    10641037      using IterableGraphComponent<_Base>::runningNode;
    10651038
     1039      /// @}
     1040
     1041      /// \name Class based iteration
     1042      ///
     1043      /// This interface provides functions for iteration on graph items
     1044      ///
     1045      /// @{
    10661046
    10671047      /// \brief This iterator goes through each node.
     
    10851065      Node runningNode(const IncEdgeIt&) const { return INVALID; }
    10861066
     1067      /// @}
     1068
    10871069      template <typename _Graph>
    10881070      struct Constraints {
    10891071        void constraints() {
    1090           checkConcept<Base, _Graph>();
    10911072          checkConcept<IterableGraphComponent<Base>, _Graph>();
    1092          
    1093           checkConcept<GraphItemIt<_Graph, typename _Graph::UEdge>,
    1094             typename _Graph::UEdgeIt >();
    1095           checkConcept<GraphIncIt<_Graph, typename _Graph::UEdge,
    1096             typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
    1097 
    1098           typename _Graph::Node n;
    1099           typename _Graph::IncEdgeIt ueit(INVALID);
    1100           n = graph.baseNode(ueit);
    1101           n = graph.runningNode(ueit);
     1073
     1074          {
     1075            typename _Graph::Node node(INVALID);
     1076            typename _Graph::UEdge uedge(INVALID);
     1077            bool dir;
     1078            {
     1079              graph.first(uedge);
     1080              graph.next(uedge);
     1081            }
     1082            {
     1083              graph.firstInc(uedge, dir, node);
     1084              graph.nextInc(uedge, dir);
     1085            }
     1086           
     1087          }     
     1088 
     1089          {
     1090            checkConcept<GraphItemIt<_Graph, typename _Graph::UEdge>,
     1091              typename _Graph::UEdgeIt >();
     1092            checkConcept<GraphIncIt<_Graph, typename _Graph::UEdge,
     1093              typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
     1094           
     1095            typename _Graph::Node n;
     1096            typename _Graph::IncEdgeIt ueit(INVALID);
     1097            n = graph.baseNode(ueit);
     1098            n = graph.runningNode(ueit);
     1099          }
     1100        }
     1101       
     1102        const _Graph& graph;
     1103       
     1104      };
     1105    };
     1106
     1107    /// \brief An empty iterable bipartite undirected graph class.
     1108    ///
     1109    /// This class provides beside the core graph features iterator
     1110    /// based iterable interface for the bipartite undirected graph
     1111    /// structure. This concept is part of the BpUGraph concept.
     1112    template <typename _Base = BaseUGraphComponent>
     1113    class IterableBpUGraphComponent : public IterableUGraphComponent<_Base> {
     1114    public:
     1115
     1116      typedef _Base Base;
     1117      typedef typename Base::Node Node;
     1118      typedef typename Base::UEdge UEdge;
     1119   
     1120      typedef IterableBpUGraphComponent Graph;
     1121
     1122      /// \name Base iteration
     1123      ///
     1124      /// This interface provides functions for iteration on graph items
     1125      /// @{ 
     1126
     1127      using IterableUGraphComponent<_Base>::first;
     1128      using IterableUGraphComponent<_Base>::next;
     1129
     1130      /// \brief Gives back the first A-node in the iterating order.
     1131      ///
     1132      /// Gives back the first undirected A-node in the iterating
     1133      /// order.
     1134      ///     
     1135      void firstANode(Node&) const {}
     1136
     1137      /// \brief Gives back the next A-node in the iterating order.
     1138      ///
     1139      /// Gives back the next A-node in the iterating order.
     1140      ///     
     1141      void nextANode(Node&) const {}
     1142
     1143      /// \brief Gives back the first B-node in the iterating order.
     1144      ///
     1145      /// Gives back the first undirected B-node in the iterating
     1146      /// order.
     1147      ///     
     1148      void firstBNode(Node&) const {}
     1149
     1150      /// \brief Gives back the next B-node in the iterating order.
     1151      ///
     1152      /// Gives back the next B-node in the iterating order.
     1153      ///     
     1154      void nextBNode(Node&) const {}
     1155
     1156
     1157      /// \brief Gives back the first of the undirected edges start
     1158      /// from the given A-node.
     1159      ///     
     1160      /// Gives back the first of the undirected edges start from the
     1161      /// given A-node.
     1162      void firstFromANode(UEdge&, const Node&) const {}
     1163
     1164      /// \brief Gives back the next of the undirected edges start
     1165      /// from the given A-node.
     1166      ///     
     1167      /// Gives back the next of the undirected edges start from the
     1168      /// given A-node.
     1169      void nextFromANode(UEdge&) const {}
     1170
     1171      /// \brief Gives back the first of the undirected edges start
     1172      /// from the given B-node.
     1173      ///     
     1174      /// Gives back the first of the undirected edges start from the
     1175      /// given B-node.
     1176      void firstFromBNode(UEdge&, const Node&) const {}
     1177
     1178      /// \brief Gives back the next of the undirected edges start
     1179      /// from the given B-node.
     1180      ///     
     1181      /// Gives back the next of the undirected edges start from the
     1182      /// given B-node.
     1183      void nextFromBNode(UEdge&) const {}
     1184
     1185
     1186      /// @}
     1187
     1188      /// \name Class based iteration
     1189      ///
     1190      /// This interface provides functions for iteration on graph items
     1191      ///
     1192      /// @{
     1193
     1194      /// \brief This iterator goes through each A-node.
     1195      ///
     1196      /// This iterator goes through each A-node.
     1197      typedef GraphItemIt<Graph, Node> ANodeIt;
     1198
     1199      /// \brief This iterator goes through each B-node.
     1200      ///
     1201      /// This iterator goes through each B-node.
     1202      typedef GraphItemIt<Graph, Node> BNodeIt;
     1203
     1204      /// @}
     1205
     1206      template <typename _Graph>
     1207      struct Constraints {
     1208        void constraints() {
     1209          checkConcept<IterableUGraphComponent<Base>, _Graph>();
     1210
     1211          {
     1212            typename _Graph::Node node(INVALID);
     1213            typename _Graph::UEdge uedge(INVALID);
     1214            graph.firstANode(node);
     1215            graph.nextANode(node);
     1216            graph.firstBNode(node);
     1217            graph.nextBNode(node);
     1218
     1219            graph.firstFromANode(uedge, node);
     1220            graph.nextFromANode(uedge);
     1221            graph.firstFromBNode(uedge, node);
     1222            graph.nextFromBNode(uedge);
     1223          }
     1224          {
     1225            checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
     1226              typename _Graph::ANodeIt >();
     1227            checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
     1228              typename _Graph::BNodeIt >();
     1229          }
     1230
    11021231        }
    11031232       
     
    11951324      struct Constraints {
    11961325        void constraints() {
    1197           checkConcept<Base, _Graph>();
    1198           checkConcept<AlterableGraphComponent, _Graph>();
     1326          checkConcept<AlterableGraphComponent<Base>, _Graph>();
    11991327          typename _Graph::UEdgeNotifier& uen
    12001328            = graph.getNotifier(typename _Graph::UEdge());
    12011329          ignore_unused_variable_warning(uen);
     1330        }
     1331       
     1332        const _Graph& graph;
     1333       
     1334      };
     1335     
     1336    };
     1337
     1338    /// \brief An empty alteration notifier bipartite undirected graph
     1339    /// class.
     1340    /// 
     1341    /// This class provides beside the core graph features alteration
     1342    /// notifier interface for the graph structure.  This implements
     1343    /// an observer-notifier pattern for each graph item. More
     1344    /// obsevers can be registered into the notifier and whenever an
     1345    /// alteration occured in the graph all the observers will
     1346    /// notified about it.
     1347    template <typename _Base = BaseUGraphComponent>
     1348    class AlterableBpUGraphComponent : public AlterableUGraphComponent<_Base> {
     1349    public:
     1350
     1351      typedef _Base Base;
     1352      typedef typename Base::ANode ANode;
     1353      typedef typename Base::BNode BNode;
     1354
     1355
     1356      /// The A-node observer registry.
     1357      typedef AlterationNotifier<AlterableBpUGraphComponent, ANode>
     1358      ANodeNotifier;
     1359
     1360      /// The B-node observer registry.
     1361      typedef AlterationNotifier<AlterableBpUGraphComponent, BNode>
     1362      BNodeNotifier;
     1363     
     1364      /// \brief Gives back the A-node alteration notifier.
     1365      ///
     1366      /// Gives back the A-node alteration notifier.
     1367      ANodeNotifier& getNotifier(ANode) const {
     1368        return ANodeNotifier();
     1369      }
     1370
     1371      /// \brief Gives back the B-node alteration notifier.
     1372      ///
     1373      /// Gives back the B-node alteration notifier.
     1374      BNodeNotifier& getNotifier(BNode) const {
     1375        return BNodeNotifier();
     1376      }
     1377
     1378      template <typename _Graph>
     1379      struct Constraints {
     1380        void constraints() {
     1381          checkConcept<AlterableUGraphComponent<Base>, _Graph>();
     1382          typename _Graph::ANodeNotifier& ann
     1383            = graph.getNotifier(typename _Graph::ANode());
     1384          typename _Graph::BNodeNotifier& bnn
     1385            = graph.getNotifier(typename _Graph::BNode());
     1386          ignore_unused_variable_warning(ann);
     1387          ignore_unused_variable_warning(bnn);
    12021388        }
    12031389       
     
    14161602    };
    14171603
    1418     /// \brief An empty mappable base graph class.
     1604    /// \brief An empty mappable base bipartite undirected graph class.
    14191605    ///
    14201606    /// This class provides beside the core graph features
     
    14791665
    14801666        void constraints() {
    1481           checkConcept<Base, _Graph>();
    14821667          checkConcept<MappableGraphComponent<Base>, _Graph>();
    14831668
     
    15011686    };
    15021687
     1688    /// \brief An empty mappable base bipartite undirected graph
     1689    /// class.
     1690    ///
     1691    /// This class provides beside the core graph features
     1692    /// map interface for the graph structure.
     1693    /// This concept is part of the BpUGraph concept.
     1694    template <typename _Base = BaseBpUGraphComponent>
     1695    class MappableBpUGraphComponent : public MappableUGraphComponent<_Base>  {
     1696    public:
     1697
     1698      typedef _Base Base;
     1699      typedef typename Base::Node Node;
     1700
     1701      typedef MappableBpUGraphComponent Graph;
     1702
     1703      /// \brief ReadWrite map of the A-nodes.
     1704      ///
     1705      /// ReadWrite map of the A-nodes.
     1706      ///
     1707      template <typename _Value>
     1708      class ANodeMap : public GraphMap<Graph, Node, _Value> { 
     1709      public:
     1710        typedef GraphMap<MappableBpUGraphComponent, Node, _Value> Parent;
     1711
     1712        /// \brief Construct a new map.
     1713        ///
     1714        /// Construct a new map for the graph.
     1715        /// \todo call the right parent class constructor
     1716        explicit ANodeMap(const MappableBpUGraphComponent& graph)
     1717          : Parent(graph) {}
     1718
     1719        /// \brief Construct a new map with default value.
     1720        ///
     1721        /// Construct a new map for the graph and initalise the values.
     1722        ANodeMap(const MappableBpUGraphComponent& graph, const _Value& value)
     1723          : Parent(graph, value) {}
     1724
     1725        /// \brief Copy constructor.
     1726        ///
     1727        /// Copy Constructor.
     1728        ANodeMap(const ANodeMap& nm) : Parent(nm) {}
     1729
     1730        /// \brief Assign operator.
     1731        ///
     1732        /// Assign operator.
     1733        template <typename CMap>
     1734        ANodeMap& operator=(const CMap&) {
     1735          checkConcept<ReadMap<Node, _Value>, CMap>();
     1736          return *this;
     1737        }
     1738
     1739      };
     1740
     1741      /// \brief ReadWrite map of the B-nodes.
     1742      ///
     1743      /// ReadWrite map of the A-nodes.
     1744      ///
     1745      template <typename _Value>
     1746      class BNodeMap : public GraphMap<Graph, Node, _Value> { 
     1747      public:
     1748        typedef GraphMap<MappableBpUGraphComponent, Node, _Value> Parent;
     1749
     1750        /// \brief Construct a new map.
     1751        ///
     1752        /// Construct a new map for the graph.
     1753        /// \todo call the right parent class constructor
     1754        explicit BNodeMap(const MappableBpUGraphComponent& graph)
     1755          : Parent(graph) {}
     1756
     1757        /// \brief Construct a new map with default value.
     1758        ///
     1759        /// Construct a new map for the graph and initalise the values.
     1760        BNodeMap(const MappableBpUGraphComponent& graph, const _Value& value)
     1761          : Parent(graph, value) {}
     1762
     1763        /// \brief Copy constructor.
     1764        ///
     1765        /// Copy Constructor.
     1766        BNodeMap(const BNodeMap& nm) : Parent(nm) {}
     1767
     1768        /// \brief Assign operator.
     1769        ///
     1770        /// Assign operator.
     1771        template <typename CMap>
     1772        BNodeMap& operator=(const CMap&) {
     1773          checkConcept<ReadMap<Node, _Value>, CMap>();
     1774          return *this;
     1775        }
     1776
     1777      };
     1778
     1779
     1780      template <typename _Graph>
     1781      struct Constraints {
     1782
     1783        struct Dummy {
     1784          int value;
     1785          Dummy() : value(0) {}
     1786          Dummy(int _v) : value(_v) {}
     1787        };
     1788
     1789        void constraints() {
     1790          checkConcept<MappableUGraphComponent<Base>, _Graph>();
     1791
     1792          { // int map test
     1793            typedef typename _Graph::template ANodeMap<int> IntANodeMap;
     1794            checkConcept<GraphMap<_Graph, typename _Graph::ANode, int>,
     1795              IntANodeMap >();
     1796          } { // bool map test
     1797            typedef typename _Graph::template ANodeMap<bool> BoolANodeMap;
     1798            checkConcept<GraphMap<_Graph, typename _Graph::ANode, bool>,
     1799              BoolANodeMap >();
     1800          } { // Dummy map test
     1801            typedef typename _Graph::template ANodeMap<Dummy> DummyANodeMap;
     1802            checkConcept<GraphMap<_Graph, typename _Graph::ANode, Dummy>,
     1803              DummyANodeMap >();
     1804          }
     1805        }
     1806
     1807        _Graph& graph;
     1808      };
     1809    };
     1810
    15031811
    15041812    /// \brief An empty extendable graph class.
     
    15111819    class ExtendableGraphComponent : public _Base {
    15121820    public:
     1821      typedef _Base Base;
    15131822
    15141823      typedef typename _Base::Node Node;
     
    15331842      struct Constraints {
    15341843        void constraints() {
     1844          checkConcept<Base, _Graph>();
    15351845          typename _Graph::Node node_a, node_b;
    15361846          node_a = graph.addNode();
     
    15551865    public:
    15561866
     1867      typedef _Base Base;
    15571868      typedef typename _Base::Node Node;
    15581869      typedef typename _Base::UEdge UEdge;
     
    15761887      struct Constraints {
    15771888        void constraints() {
     1889          checkConcept<Base, _Graph>();
    15781890          typename _Graph::Node node_a, node_b;
    15791891          node_a = graph.addNode();
     
    15841896
    15851897        _Graph& graph;
     1898      };
     1899    };
     1900
     1901    /// \brief An empty extendable base undirected graph class.
     1902    ///
     1903    /// This class provides beside the core bipartite undirected graph
     1904    /// features core undircted graph extend interface for the graph
     1905    /// structure.  The main difference between the base and this
     1906    /// interface is that the graph alterations should handled already
     1907    /// on this level.
     1908    template <typename _Base = BaseBpUGraphComponent>
     1909    class ExtendableBpUGraphComponent
     1910      : public ExtendableUGraphComponent<_Base> {
     1911
     1912      typedef _Base Base;
     1913
     1914      template <typename _Graph>
     1915      struct Constraints {
     1916        void constraints() {
     1917          checkConcept<ExtendableUGraphComponent<Base>, _Graph>();
     1918        }
    15861919      };
    15871920    };
     
    16161949      struct Constraints {
    16171950        void constraints() {
     1951          checkConcept<Base, _Graph>();
    16181952          typename _Graph::Node node;
    16191953          graph.erase(node);
     
    16551989      struct Constraints {
    16561990        void constraints() {
     1991          checkConcept<Base, _Graph>();
    16571992          typename _Graph::Node node;
    16581993          graph.erase(node);
     
    16621997
    16631998        _Graph& graph;
     1999      };
     2000    };
     2001
     2002    /// \brief An empty erasable base bipartite undirected graph class.
     2003    /// 
     2004    /// This class provides beside the core bipartite undirected graph
     2005    /// features core erase functions for the undirceted graph
     2006    /// structure. The main difference between the base and this
     2007    /// interface is that the graph alterations should handled already
     2008    /// on this level.
     2009    template <typename _Base = BaseBpUGraphComponent>
     2010    class ErasableBpUGraphComponent : public ErasableUGraphComponent<_Base> {
     2011    public:
     2012
     2013      typedef _Base Base;
     2014
     2015      template <typename _Graph>
     2016      struct Constraints {
     2017        void constraints() {
     2018          checkConcept<ErasableUGraphComponent<Base>, _Graph>();
     2019        }
    16642020      };
    16652021    };
     
    16752031    public:
    16762032
     2033      typedef _Base Base;
     2034
    16772035      /// \brief Erase all nodes and edges from the graph.
    16782036      ///
     
    16842042      struct Constraints {
    16852043        void constraints() {
     2044          checkConcept<Base, _Graph>();
    16862045          graph.clear();
    16872046        }
     
    16982057    /// the graph alterations should handled already on this level.
    16992058    template <typename _Base = BaseUGraphComponent>
    1700     class ClearableUGraphComponent : public _Base {
    1701     public:
    1702 
    1703       /// \brief Erase all nodes and undirected edges from the graph.
    1704       ///
    1705       /// Erase all nodes and undirected edges from the graph.
    1706       ///
    1707       void clear() {}   
     2059    class ClearableUGraphComponent : public ClearableUGraphComponent<_Base> {
     2060    public:
     2061
     2062      typedef _Base Base;
    17082063
    17092064      template <typename _Graph>
    17102065      struct Constraints {
    17112066        void constraints() {
    1712           graph.clear();
     2067          checkConcept<ClearableUGraphComponent<Base>, _Graph>();
    17132068        }
    17142069
     
    17172072    };
    17182073
     2074    /// \brief An empty clearable base bipartite undirected graph
     2075    /// class.
     2076    ///
     2077    /// This class provides beside the core bipartite undirected graph
     2078    /// features core clear functions for the undirected graph
     2079    /// structure. The main difference between the base and this
     2080    /// interface is that the graph alterations should handled already
     2081    /// on this level.
     2082    template <typename _Base = BaseUGraphComponent>
     2083    class ClearableBpUGraphComponent
     2084      : public ClearableBpUGraphComponent<_Base> {
     2085    public:
     2086
     2087      typedef _Base Base;
     2088
     2089      template <typename _Graph>
     2090      struct Constraints {
     2091        void constraints() {
     2092          checkConcept<ClearableBpUGraphComponent<Base>, _Graph>();
     2093        }
     2094
     2095      };
     2096
     2097    };
     2098
    17192099  }
    17202100
  • lemon/concept/ugraph.h

    r2163 r2231  
    698698      struct Constraints {
    699699        void constraints() {
    700           checkConcept<BaseIterableUGraphComponent<>, Graph>();
    701700          checkConcept<IterableUGraphComponent<>, Graph>();
    702701          checkConcept<MappableUGraphComponent<>, Graph>();
  • lemon/full_graph.h

    r2223 r2231  
    610610      return node.id >> 1;
    611611    }
    612     static Node fromANodeId(int id) {
     612    static Node nodeFromANodeId(int id) {
    613613      return Node(id << 1);
    614614    }
     
    620620      return node.id >> 1;
    621621    }
    622     static Node fromBNodeId(int id) {
     622    static Node nodeFromBNodeId(int id) {
    623623      return Node((id << 1) + 1);
    624624    }
     
    666666
    667667
    668   typedef BpUGraphExtender<FullBpUGraphBase> ExtendedFullBpUGraphBase;
     668  typedef BpUGraphExtender<BidirBpUGraphExtender<FullBpUGraphBase> >
     669  ExtendedFullBpUGraphBase;
    669670
    670671
  • lemon/list_graph.h

    r2189 r2231  
    12711271      return node.id >> 1;
    12721272    }
    1273     static Node fromANodeId(int id) {
     1273    static Node nodeFromANodeId(int id) {
    12741274      return Node(id << 1);
    12751275    }
     
    12811281      return node.id >> 1;
    12821282    }
    1283     static Node fromBNodeId(int id) {
     1283    static Node nodeFromBNodeId(int id) {
    12841284      return Node((id << 1) + 1);
    12851285    }
     
    14831483
    14841484
    1485   typedef BpUGraphExtender< ListBpUGraphBase > ExtendedListBpUGraphBase;
     1485  typedef BpUGraphExtender<BidirBpUGraphExtender<ListBpUGraphBase> >
     1486  ExtendedListBpUGraphBase;
    14861487
    14871488  /// \ingroup graphs
  • lemon/smart_graph.h

    r2190 r2231  
    663663      return node.id >> 1;
    664664    }
    665     static Node fromANodeId(int id) {
     665    static Node nodeFromANodeId(int id) {
    666666      return Node(id << 1);
    667667    }
     
    673673      return node.id >> 1;
    674674    }
    675     static Node fromBNodeId(int id) {
     675    static Node nodeFromBNodeId(int id) {
    676676      return Node((id << 1) + 1);
    677677    }
     
    744744
    745745
    746   typedef BpUGraphExtender<SmartBpUGraphBase> ExtendedSmartBpUGraphBase;
     746  typedef BpUGraphExtender<BidirBpUGraphExtender<SmartBpUGraphBase> >
     747  ExtendedSmartBpUGraphBase;
    747748
    748749  /// \ingroup graphs
     
    830831      }
    831832      while(s.anode_num<aNodes.size()) {
    832         Node node = fromANodeId(aNodes.size() - 1);
     833        Node node = nodeFromANodeId(aNodes.size() - 1);
    833834        Parent::getNotifier(ANode()).erase(node);
    834835        Parent::getNotifier(Node()).erase(node);
     
    836837      }
    837838      while(s.bnode_num<bNodes.size()) {
    838         Node node = fromBNodeId(bNodes.size() - 1);
     839        Node node = nodeFromBNodeId(bNodes.size() - 1);
    839840        Parent::getNotifier(BNode()).erase(node);
    840841        Parent::getNotifier(Node()).erase(node);
  • test/Makefile.am

    r2207 r2231  
    1616        test/bfs_test \
    1717        test/bipartite_matching_test \
     18        test/bpugraph_test \
    1819        test/counter_test \
    1920        test/dfs_test \
     
    5859test_bfs_test_SOURCES = test/bfs_test.cc
    5960test_bipartite_matching_test_SOURCES = test/bipartite_matching_test.cc
     61test_bpugraph_test_SOURCES = test/bpugraph_test.cc
    6062test_counter_test_SOURCES = test/counter_test.cc
    6163test_dfs_test_SOURCES = test/dfs_test.cc
  • test/graph_adaptor_test.cc

    r2111 r2231  
    2323#include<lemon/concept/graph.h>
    2424#include<lemon/concept/ugraph.h>
     25#include<lemon/concept/bpugraph.h>
    2526
    2627#include<lemon/list_graph.h>
     
    2829#include<lemon/graph_adaptor.h>
    2930#include<lemon/ugraph_adaptor.h>
     31#include<lemon/bpugraph_adaptor.h>
    3032
    3133#include"test/test_tools.h"
     
    7678    checkConcept<Graph, DirUGraphAdaptor<UGraph,
    7779      UGraph::UEdgeMap<bool> > >();
     80
     81    checkConcept<BpUGraph, BpUGraphAdaptor<BpUGraph> >();
     82
     83    checkConcept<BpUGraph, SwapBpUGraphAdaptor<BpUGraph> >();
     84
    7885  }
    7986  std::cout << __FILE__ ": All tests passed.\n";
  • test/graph_test.cc

    r2121 r2231  
    3838  { // checking graph components
    3939    checkConcept<BaseGraphComponent, BaseGraphComponent >();
    40 
    41     checkConcept<BaseIterableGraphComponent<>,
    42       BaseIterableGraphComponent<> >();
    4340
    4441    checkConcept<IDableGraphComponent<>,
  • test/ugraph_test.cc

    r2121 r2231  
    3737    checkConcept<BaseUGraphComponent, BaseUGraphComponent >();
    3838
    39     checkConcept<BaseIterableUGraphComponent<>,
    40       BaseIterableUGraphComponent<> >();
    41 
    4239    checkConcept<IDableUGraphComponent<>,
    4340      IDableUGraphComponent<> >();
Note: See TracChangeset for help on using the changeset viewer.