bpugraph.h

Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  *
00003  * This file is a part of LEMON, a generic C++ optimization library
00004  *
00005  * Copyright (C) 2003-2006
00006  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
00007  * (Egervary Research Group on Combinatorial Optimization, EGRES).
00008  *
00009  * Permission to use, modify and distribute this software is granted
00010  * provided that this copyright notice appears in all copies. For
00011  * precise terms see the accompanying LICENSE file.
00012  *
00013  * This software is provided "AS IS" with no warranty of any kind,
00014  * express or implied, and with no claim as to its suitability for any
00015  * purpose.
00016  *
00017  */
00018 
00022 
00023 
00024 #ifndef LEMON_CONCEPT_BPUGRAPH_H
00025 #define LEMON_CONCEPT_BPUGRAPH_H
00026 
00027 #include <lemon/concept/graph_component.h>
00028 
00029 #include <lemon/concept/graph.h>
00030 #include <lemon/concept/ugraph.h>
00031 
00032 #include <lemon/utility.h>
00033 
00034 namespace lemon {
00035   namespace concept {
00036 
00039 
00040 
00068 
00069     class BpUGraph {
00070     public:
00073       typedef True UTag;
00074 
00083       class Node {
00084       public:
00086 
00089         Node() { }
00091 
00094         Node(const Node&) { }
00095 
00097 
00100         Node(Invalid) { }
00102 
00105         bool operator==(Node) const { return true; }
00106 
00108         
00111         bool operator!=(Node) const { return true; }
00112 
00114         
00123         bool operator<(Node) const { return false; }
00124 
00125       };
00126 
00136       class ANode {
00137       public:
00139 
00142         ANode() { }
00144 
00147         ANode(const ANode&) { }
00148 
00150 
00153         ANode(const Node&) { }
00154 
00156 
00159         ANode(Invalid) { }
00161 
00164         bool operator==(ANode) const { return true; }
00165 
00167         
00170         bool operator!=(ANode) const { return true; }
00171 
00173         
00180         bool operator<(ANode) const { return false; }
00181 
00182       };
00183 
00193       class BNode {
00194       public:
00196 
00199         BNode() { }
00201 
00204         BNode(const BNode&) { }
00205 
00207 
00210         BNode(const Node&) { }
00211 
00213 
00216         BNode(Invalid) { }
00218 
00221         bool operator==(BNode) const { return true; }
00222 
00224         
00227         bool operator!=(BNode) const { return true; }
00228 
00230         
00237         bool operator<(BNode) const { return false; }
00238 
00239       };
00240     
00242 
00250       class NodeIt : public Node {
00251       public:
00253 
00256         NodeIt() { }
00258         
00261         NodeIt(const NodeIt& n) : Node(n) { }
00263 
00266         NodeIt(Invalid) { }
00268 
00271         NodeIt(const BpUGraph&) { }
00273 
00278         NodeIt(const BpUGraph&, const Node&) { }
00280 
00283         NodeIt& operator++() { return *this; }
00284       };
00285 
00287 
00295       class ANodeIt : public ANode {
00296       public:
00298 
00301         ANodeIt() { }
00303         
00306         ANodeIt(const ANodeIt& n) : Node(n) { }
00308 
00311         ANodeIt(Invalid) { }
00313 
00316         ANodeIt(const BpUGraph&) { }
00318 
00323         ANodeIt(const BpUGraph&, const Node&) { }
00325 
00328         ANodeIt& operator++() { return *this; }
00329       };
00330 
00332 
00340       class BNodeIt : public BNode {
00341       public:
00343 
00346         BNodeIt() { }
00348         
00351         BNodeIt(const BNodeIt& n) : Node(n) { }
00353 
00356         BNodeIt(Invalid) { }
00358 
00361         BNodeIt(const BpUGraph&) { }
00363 
00368         BNodeIt(const BpUGraph&, const Node&) { }
00370 
00373         BNodeIt& operator++() { return *this; }
00374       };
00375     
00376     
00378 
00381       class UEdge {
00382       public:
00384 
00387         UEdge() { }
00389 
00392         UEdge(const UEdge&) { }
00394 
00397         UEdge(Invalid) { }
00399 
00402         bool operator==(UEdge) const { return true; }
00404 
00407         bool operator!=(UEdge) const { return true; }
00408 
00410         
00419         bool operator<(UEdge) const { return false; }
00420       };
00421 
00423 
00431       class UEdgeIt : public UEdge {
00432       public:
00434 
00437         UEdgeIt() { }
00439 
00442         UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
00444 
00447         UEdgeIt(Invalid) { }
00449     
00451         UEdgeIt(const BpUGraph&) { }
00453 
00458         UEdgeIt(const BpUGraph&, const UEdge&) { } 
00460         
00462         UEdgeIt& operator++() { return *this; }
00463       };
00464 
00479       class IncEdgeIt : public UEdge {
00480       public:
00482 
00485         IncEdgeIt() { }
00487 
00490         IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
00492 
00495         IncEdgeIt(Invalid) { }
00497     
00500         IncEdgeIt(const BpUGraph&, const Node&) { }
00502 
00506         IncEdgeIt(const BpUGraph&, const UEdge&) { }
00508 
00511         IncEdgeIt& operator++() { return *this; }
00512       };
00513 
00515 
00518       class Edge : public UEdge {
00519       public:
00521 
00524         Edge() { }
00526 
00529         Edge(const Edge& e) : UEdge(e) { }
00531 
00534         Edge(Invalid) { }
00536 
00539         bool operator==(Edge) const { return true; }
00541 
00544         bool operator!=(Edge) const { return true; }
00545 
00547         
00556         bool operator<(Edge) const { return false; }
00557         
00558       }; 
00560 
00568       class EdgeIt : public Edge {
00569       public:
00571 
00574         EdgeIt() { }
00576 
00579         EdgeIt(const EdgeIt& e) : Edge(e) { }
00581 
00584         EdgeIt(Invalid) { }
00586     
00589         EdgeIt(const BpUGraph &g) { ignore_unused_variable_warning(g); }
00591 
00595         EdgeIt(const BpUGraph&, const Edge&) { } 
00597         
00599         EdgeIt& operator++() { return *this; }
00600       };
00601    
00603 
00613     
00614       class OutEdgeIt : public Edge {
00615       public:
00617 
00620         OutEdgeIt() { }
00622 
00625         OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
00627 
00630         OutEdgeIt(Invalid) { }
00632     
00637         OutEdgeIt(const BpUGraph& n, const Node& g) {
00638           ignore_unused_variable_warning(n);
00639           ignore_unused_variable_warning(g);
00640         }
00642 
00646         OutEdgeIt(const BpUGraph&, const Edge&) { }
00648         
00651         OutEdgeIt& operator++() { return *this; }
00652       };
00653 
00655 
00665 
00666       class InEdgeIt : public Edge {
00667       public:
00669 
00672         InEdgeIt() { }
00674 
00677         InEdgeIt(const InEdgeIt& e) : Edge(e) { }
00679 
00682         InEdgeIt(Invalid) { }
00684     
00689         InEdgeIt(const BpUGraph& g, const Node& n) { 
00690           ignore_unused_variable_warning(n);
00691           ignore_unused_variable_warning(g);
00692         }
00694 
00698         InEdgeIt(const BpUGraph&, const Edge&) { }
00700 
00703         InEdgeIt& operator++() { return *this; }
00704       };
00705 
00713       template<class T> 
00714       class NodeMap : public ReadWriteMap< Node, T >
00715       {
00716       public:
00717 
00719         NodeMap(const BpUGraph&) { }
00721         NodeMap(const BpUGraph&, T) { }
00722 
00724         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
00726         NodeMap& operator=(const NodeMap&) { return *this; }
00727         // \todo fix this concept
00728       };
00729 
00737       template<class T> 
00738       class ANodeMap : public ReadWriteMap< Node, T >
00739       {
00740       public:
00741 
00743         ANodeMap(const BpUGraph&) { }
00745         ANodeMap(const BpUGraph&, T) { }
00746 
00748         ANodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
00750         ANodeMap& operator=(const NodeMap&) { return *this; }
00751         // \todo fix this concept
00752       };
00753 
00761       template<class T> 
00762       class BNodeMap : public ReadWriteMap< Node, T >
00763       {
00764       public:
00765 
00767         BNodeMap(const BpUGraph&) { }
00769         BNodeMap(const BpUGraph&, T) { }
00770 
00772         BNodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
00774         BNodeMap& operator=(const NodeMap&) { return *this; }
00775         // \todo fix this concept
00776       };
00777 
00785       template<class T> 
00786       class EdgeMap : public ReadWriteMap<Edge,T>
00787       {
00788       public:
00789 
00791         EdgeMap(const BpUGraph&) { }
00793         EdgeMap(const BpUGraph&, T) { }
00795         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
00797         EdgeMap& operator=(const EdgeMap&) { return *this; }
00798         // \todo fix this concept    
00799       };
00800 
00802 
00808       template<class T> 
00809       class UEdgeMap : public ReadWriteMap<UEdge,T>
00810       {
00811       public:
00812 
00814         UEdgeMap(const BpUGraph&) { }
00816         UEdgeMap(const BpUGraph&, T) { }
00818         UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
00820         UEdgeMap &operator=(const UEdgeMap&) { return *this; }
00821         // \todo fix this concept    
00822       };
00823 
00828       Edge direct(const UEdge&, const Node&) const {
00829         return INVALID;
00830       }
00831 
00837       Edge direct(const UEdge&, bool) const {
00838         return INVALID;
00839       }
00840 
00844       bool aNode(Node) const { return true;}
00845 
00849       bool bNode(Node) const { return true;}
00850 
00854       Node aNode(UEdge) const { return INVALID;}
00855 
00859       Node bNode(UEdge) const { return INVALID;}
00860 
00865       bool direction(Edge) const { return true; }
00866 
00870       Edge oppositeEdge(Edge) const { return INVALID; }
00871 
00875       Node oppositeNode(Node, UEdge) const { return INVALID; }
00876 
00888       Node source(UEdge) const { return INVALID; }
00889 
00891       Node target(UEdge) const { return INVALID; }
00892 
00894       Node source(Edge) const { return INVALID; }
00895 
00897       Node target(Edge) const { return INVALID; }
00898 
00902       Node baseNode(OutEdgeIt e) const {
00903         return source(e);
00904       }
00905 
00910       Node runningNode(OutEdgeIt e) const {
00911         return target(e);
00912       }
00913 
00917       Node baseNode(InEdgeIt e) const {
00918         return target(e);
00919       }
00924       Node runningNode(InEdgeIt e) const {
00925         return source(e);
00926       }
00927 
00931       Node baseNode(IncEdgeIt) const {
00932         return INVALID;
00933       }
00934       
00938       Node runningNode(IncEdgeIt) const {
00939         return INVALID;
00940       }
00941 
00942       template <typename Graph>
00943       struct Constraints {
00944         void constraints() {
00945         }
00946       };
00947 
00948     };
00949 
00954     class ExtendableBpUGraph : public BpUGraph {
00955     public:
00956       
00961       Node addANode();
00962 
00967       Node addBNode();
00968 
00975       UEdge addEdge(const Node& from, const Node& to);
00976 
00981       void clear() { }
00982 
00983       template <typename Graph>
00984       struct Constraints {
00985         void constraints() {}
00986       };
00987 
00988     };
00989 
00994     class ErasableBpUGraph : public ExtendableBpUGraph {
00995     public:
00996 
01001       void erase(Node) { }
01006       void erase(UEdge) { }
01007 
01008       template <typename Graph>
01009       struct Constraints {
01010         void constraints() {}
01011       };
01012 
01013     };
01014 
01016 
01017   }
01018 
01019 }
01020 
01021 #endif

Generated on Fri Feb 3 18:35:56 2006 for LEMON by  doxygen 1.4.6