COIN-OR::LEMON - Graph Library

Changeset 1016:18d009b23e42 in lemon-0.x


Ignore:
Timestamp:
11/22/04 10:09:18 (19 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1406
Message:

bug fix in SubBidirGraphWrapper?, roadmap to MergeGraphWrapper?

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/graph_wrapper.h

    r1013 r1016  
    11931193
    11941194//      typename _Graph::template EdgeMap<T>::Reference
    1195       T operator[](Edge e) {
     1195      T operator[](Edge e) const {
    11961196        if (!e.backward)
    11971197          return forward_map[e];
  • src/work/marci/makefile

    r1007 r1016  
    22CXX3=$(CXX)
    33BOOSTROOT ?= /home/marci/boost
    4 INCLUDEDIRS ?= -I../{jacint,marci,alpar,klao,akos,athos} -I../.. -I.. -I$(BOOSTROOT)
     4INCLUDEDIRS ?= -ftemplate-depth-50 -I../{jacint,marci,alpar,klao,akos,athos} -I../.. -I.. -I$(BOOSTROOT)
    55
    66LEDABINARIES = leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo
  • src/work/marci/merge_node_graph_wrapper.h

    r1013 r1016  
    271271    into the node-set of one graph.
    272272    Specialization for the case when
    273     _Graph1::Node are base and derived _Graph2::Node.
    274     NOT YET IMPLEMENTED
     273    _Graph1::Node is a base class and _Graph2::Node is derived from it.
    275274   */
    276275  template <typename _Graph1, typename _Graph2>
     
    290289    MergeNodeGraphWrapperBase() { }
    291290  public:
    292     class Node { };
     291    template <typename _Value> class NodeMap;
     292
     293    class Node : public Graph2Node {
     294      friend class MergeNodeGraphWrapperBase<_Graph1, _Graph2>;
     295      template <typename _Value> friend class NodeMap;
     296    protected:
     297      bool backward; //true, iff backward
     298    public:
     299      Node() { }
     300      /// \todo =false is needed, or causes problems?
     301      /// If \c _backward is false, then we get an edge corresponding to the
     302      /// original one, otherwise its oppositely directed pair is obtained.
     303      Node(const Graph1Node& n1,
     304           const Graph2Node& n2, bool _backward) :
     305        Graph2Node(n2), backward(_backward) {
     306        if (!backward) *this=n1;
     307      }
     308      Node(Invalid i) : Graph2Node(i), backward(true) { }
     309      bool operator==(const Node& v) const {
     310        if (backward)
     311          return (v.backward &&
     312                  static_cast<Graph2Node>(*this)==static_cast<Graph2Node>(v));
     313        else
     314          return (!v.backward &&
     315                  static_cast<Graph1Node>(*this)==static_cast<Graph1Node>(v));
     316      }
     317      bool operator!=(const Node& v) const {
     318        return !(*this==v);
     319      }
     320    };
     321
     322    //typedef void Edge;
    293323    class Edge { };
    294     void first() const;
    295     void next() const;
     324   
     325    void first(Node& i) const {
     326      Parent1::graph->first(*static_cast<Graph1Node*>(&i));
     327      i.backward=false;
     328      if (*static_cast<Graph1Node*>(&i)==INVALID) {
     329        Parent2::graph->first(*static_cast<Graph2Node*>(&i));
     330        i.backward=true;
     331      }
     332    }
     333    void next(Node& i) const {
     334      if (!(i.backward)) {
     335        Parent1::graph->next(*static_cast<Graph1Node*>(&i));
     336        if (*static_cast<Graph1Node*>(&i)==INVALID) {
     337          Parent2::graph->first(*static_cast<Graph2Node*>(&i));
     338          i.backward=true;
     339        }
     340      } else {
     341        Parent2::graph->next(*static_cast<Graph2Node*>(&i));
     342      }
     343    }
     344
     345    int id(const Node& n) const {
     346      if (!n.backward)
     347        return this->Parent1::graph->id(n);
     348      else
     349        return this->Parent2::graph->id(n);
     350    }
     351
     352    template <typename _Value>
     353    class NodeMap {
     354    protected:
     355      typedef typename _Graph1::template NodeMap<_Value> ParentMap1;
     356      typedef typename _Graph2::template NodeMap<_Value> ParentMap2;
     357      ParentMap1 forward_map;
     358      ParentMap2 backward_map;
     359    public:
     360      typedef _Value Value;
     361      typedef Node Key;
     362      NodeMap(const MergeNodeGraphWrapperBase<_Graph1, _Graph2>& gw) :
     363        forward_map(*(gw.Parent1::graph)),
     364        backward_map(*(gw.Parent2::graph)) { }
     365      NodeMap(const MergeNodeGraphWrapperBase<_Graph1, _Graph2>& gw,
     366              const _Value& value) :
     367        forward_map(*(gw.Parent1::graph), value),
     368        backward_map(*(gw.Parent2::graph), value) { }
     369      _Value operator[](const Node& n) const {
     370        if (!n.backward)
     371          return forward_map[n];
     372        else
     373          return backward_map[n];
     374      }
     375      void set(const Node& n, const _Value& value) {
     376        if (!n.backward)
     377          forward_map.set(n, value);
     378        else
     379          backward_map.set(n, value);
     380      }
     381//       using ParentMap1::operator[];
     382//       using ParentMap2::operator[];
     383    };
     384
    296385  };
    297386
    298   //not yet working
     387
     388  /*! A graph wrapper base class
     389    for merging the node-set of two node-disjoint graphs
     390    into the node-set of one graph.
     391    Specialized implementaton for the case when _Graph1::Node is derived
     392    from _Graph2::Node.
     393   */
    299394  template <typename _Graph1, typename _Graph2>
    300395  class MergeNodeGraphWrapperBase<
     
    313408    MergeNodeGraphWrapperBase() { }
    314409  public:
    315     class Node { };
     410    template <typename _Value> class NodeMap;
     411
     412    class Node : public Graph1Node {
     413      friend class MergeNodeGraphWrapperBase<_Graph1, _Graph2>;
     414      template <typename _Value> friend class NodeMap;
     415    protected:
     416      bool backward; //true, iff backward
     417    public:
     418      Node() { }
     419      /// \todo =false is needed, or causes problems?
     420      /// If \c _backward is false, then we get an edge corresponding to the
     421      /// original one, otherwise its oppositely directed pair is obtained.
     422      Node(const Graph1Node& n1,
     423           const Graph2Node& n2, bool _backward) :
     424        Graph1Node(n1), backward(_backward) {
     425        if (backward) *this=n2;
     426      }
     427      Node(Invalid i) : Graph1Node(i), backward(true) { }
     428      bool operator==(const Node& v) const {
     429        if (backward)
     430          return (v.backward &&
     431                  static_cast<Graph2Node>(*this)==static_cast<Graph2Node>(v));
     432        else
     433          return (!v.backward &&
     434                  static_cast<Graph1Node>(*this)==static_cast<Graph1Node>(v));
     435      }
     436      bool operator!=(const Node& v) const {
     437        return !(*this==v);
     438      }
     439    };
     440
     441    //typedef void Edge;
    316442    class Edge { };
    317     void first() const;
    318     void next() const;
     443   
     444    void first(Node& i) const {
     445      Parent1::graph->first(*static_cast<Graph1Node*>(&i));
     446      i.backward=false;
     447      if (*static_cast<Graph1Node*>(&i)==INVALID) {
     448        Parent2::graph->first(*static_cast<Graph2Node*>(&i));
     449        i.backward=true;
     450      }
     451    }
     452    void next(Node& i) const {
     453      if (!(i.backward)) {
     454        Parent1::graph->next(*static_cast<Graph1Node*>(&i));
     455        if (*static_cast<Graph1Node*>(&i)==INVALID) {
     456          Parent2::graph->first(*static_cast<Graph2Node*>(&i));
     457          i.backward=true;
     458        }
     459      } else {
     460        Parent2::graph->next(*static_cast<Graph2Node*>(&i));
     461      }
     462    }
     463
     464    int id(const Node& n) const {
     465      if (!n.backward)
     466        return this->Parent1::graph->id(n);
     467      else
     468        return this->Parent2::graph->id(n);
     469    }
     470
     471    template <typename _Value>
     472    class NodeMap {
     473    protected:
     474      typedef typename _Graph1::template NodeMap<_Value> ParentMap1;
     475      typedef typename _Graph2::template NodeMap<_Value> ParentMap2;
     476      ParentMap1 forward_map;
     477      ParentMap2 backward_map;
     478    public:
     479      typedef _Value Value;
     480      typedef Node Key;
     481      NodeMap(const MergeNodeGraphWrapperBase<_Graph1, _Graph2>& gw) :
     482        forward_map(*(gw.Parent1::graph)),
     483        backward_map(*(gw.Parent2::graph)) { }
     484      NodeMap(const MergeNodeGraphWrapperBase<_Graph1, _Graph2>& gw,
     485              const _Value& value) :
     486        forward_map(*(gw.Parent1::graph), value),
     487        backward_map(*(gw.Parent2::graph), value) { }
     488      _Value operator[](const Node& n) const {
     489        if (!n.backward)
     490          return forward_map[n];
     491        else
     492          return backward_map[n];
     493      }
     494      void set(const Node& n, const _Value& value) {
     495        if (!n.backward)
     496          forward_map.set(n, value);
     497        else
     498          backward_map.set(n, value);
     499      }
     500//       using ParentMap1::operator[];
     501//       using ParentMap2::operator[];
     502    };
     503
    319504  };
    320505
     
    533718  class MergeEdgeGraphWrapperBase<
    534719    _Graph1, _Graph2, typename boost::enable_if<
    535     boost::is_same<typename _Graph1::Node, typename _Graph2::Node> >::type> :
     720    boost::is_same<typename _Graph1::Edge, typename _Graph2::Edge> >::type> :
    536721    public MergeNodeGraphWrapperBase<_Graph1, _Graph2> {
    537722  public:
     
    701886
    702887
     888  /*! A grah wrapper base class
     889    for merging the node-sets and edge-sets of
     890    two node-disjoint graphs
     891    into one graph.
     892    Specialized implementation for the case
     893    when _Graph1::Edge is a base class and _Graph2::Edge
     894    is derived from it.
     895   */
     896  template <typename _Graph1, typename _Graph2>
     897  class MergeEdgeGraphWrapperBase<
     898    _Graph1, _Graph2, typename boost::enable_if<
     899    boost::is_base_and_derived<typename _Graph1::Edge, typename _Graph2::Edge> >::type> :
     900    public MergeNodeGraphWrapperBase<_Graph1, _Graph2> {
     901  public:
     902    static void printEdge() { std::cout << "edge: 2nd is derived" << std::endl; }
     903    typedef _Graph1 Graph1;
     904    typedef _Graph2 Graph2;
     905    typedef MergeNodeGraphWrapperBase<_Graph1, _Graph2> Parent;
     906    typedef typename Parent::Parent1 Parent1;
     907    typedef typename Parent::Parent2 Parent2;
     908//     typedef P1<_Graph1> Parent1;
     909//     typedef P2<_Graph2> Parent2;
     910    typedef typename Parent1::Edge Graph1Edge;
     911    typedef typename Parent2::Edge Graph2Edge;
     912  protected:
     913    MergeEdgeGraphWrapperBase() { }
     914  public:
     915    template <typename _Value> class EdgeMap;
     916
     917    typedef typename Parent::Node Node;
     918
     919    class Edge : public Graph2Edge {
     920      friend class MergeEdgeGraphWrapperBase<_Graph1, _Graph2>;
     921      template <typename _Value> friend class EdgeMap;
     922    protected:
     923      bool backward; //true, iff backward
     924    public:
     925      Edge() { }
     926      /// \todo =false is needed, or causes problems?
     927      /// If \c _backward is false, then we get an edge corresponding to the
     928      /// original one, otherwise its oppositely directed pair is obtained.
     929      Edge(const Graph1Edge& n1,
     930           const Graph2Edge& n2, bool _backward) :
     931        Graph2Edge(n2), backward(_backward) {
     932        if (!backward) *this=n1;
     933      }
     934      Edge(Invalid i) : Graph2Edge(i), backward(true) { }
     935      bool operator==(const Edge& v) const {
     936        if (backward)
     937          return (v.backward &&
     938                  static_cast<Graph2Edge>(*this)==static_cast<Graph2Edge>(v));
     939        else
     940          return (!v.backward &&
     941                  static_cast<Graph1Edge>(*this)==static_cast<Graph1Edge>(v));
     942      }
     943      bool operator!=(const Edge& v) const {
     944        return !(*this==v);
     945      }
     946    };
     947
     948    using Parent::first;
     949    void first(Edge& i) const {
     950      Parent1::graph->first(*static_cast<Graph1Edge*>(&i));
     951      i.backward=false;
     952      if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     953        Parent2::graph->first(*static_cast<Graph2Edge*>(&i));
     954        i.backward=true;
     955      }
     956    }
     957    void firstIn(Edge& i, const Node& n) const {
     958      Parent1::graph->firstIn(*static_cast<Graph1Edge*>(&i), n);
     959      i.backward=false;
     960      if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     961        Parent2::graph->firstIn(*static_cast<Graph2Edge*>(&i), n);
     962        i.backward=true;
     963      }
     964    }
     965    void firstOut(Edge& i, const Node& n) const {
     966      Parent1::graph->firstOut(*static_cast<Graph1Edge*>(&i), n);
     967      i.backward=false;
     968      if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     969        Parent2::graph->firstOut(*static_cast<Graph2Edge*>(&i), n);
     970        i.backward=true;
     971      }
     972    }
     973
     974    using Parent::next;
     975    void next(Edge& i) const {
     976      if (!(i.backward)) {
     977        Parent1::graph->next(*static_cast<Graph1Edge*>(&i));
     978        if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     979          Parent2::graph->first(*static_cast<Graph2Edge*>(&i));
     980          i.backward=true;
     981        }
     982      } else {
     983        Parent2::graph->next(*static_cast<Graph2Edge*>(&i));
     984      }
     985    }
     986    void nextIn(Edge& i) const {
     987      if (!(i.backward)) {
     988        Parent1::graph->nextIn(*static_cast<Graph1Edge*>(&i));
     989        if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     990          Parent2::graph->first(*static_cast<Graph2Edge*>(&i));
     991          i.backward=true;
     992        }
     993      } else {
     994        Parent2::graph->nextIn(*static_cast<Graph2Edge*>(&i));
     995      }
     996    }
     997    void nextOut(Edge& i) const {
     998      if (!(i.backward)) {
     999        Parent1::graph->nextOut(*static_cast<Graph1Edge*>(&i));
     1000        if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     1001          Parent2::graph->first(*static_cast<Graph2Edge*>(&i));
     1002          i.backward=true;
     1003        }
     1004      } else {
     1005        Parent2::graph->nextOut(*static_cast<Graph2Edge*>(&i));
     1006      }
     1007    }
     1008
     1009    Node source(const Edge& i) const {
     1010      if (!(i.backward)) {
     1011        return
     1012          Node(Parent1::graph->source(i), INVALID, false);
     1013      } else {
     1014        return
     1015          Node(INVALID, Parent2::graph->source(i), true);
     1016      }
     1017    }
     1018
     1019    Node target(const Edge& i) const {
     1020      if (!(i.backward)) {
     1021        return
     1022          Node(Parent1::graph->target(i), INVALID, false);
     1023      } else {
     1024        return
     1025          Node(INVALID, Parent2::graph->target(i), true);
     1026      }
     1027    }
     1028
     1029    using Parent::id;
     1030    int id(const Edge& n) const {
     1031      if (!n.backward)
     1032        return this->Parent1::graph->id(n);
     1033      else
     1034        return this->Parent2::graph->id(n);
     1035    }
     1036
     1037    template <typename _Value>
     1038    class EdgeMap {
     1039    protected:
     1040      typedef typename Parent::Graph1::template EdgeMap<_Value> ParentMap1;
     1041      typedef typename Parent::Graph2::template EdgeMap<_Value> ParentMap2;
     1042      ParentMap1 forward_map;
     1043      ParentMap2 backward_map;
     1044    public:
     1045      typedef _Value Value;
     1046      typedef Edge Key;
     1047      EdgeMap(const MergeEdgeGraphWrapperBase<_Graph1, _Graph2>& gw) :
     1048        forward_map(*(gw.Parent1::graph)),
     1049        backward_map(*(gw.Parent2::graph)) { }
     1050      EdgeMap(const MergeEdgeGraphWrapperBase<_Graph1, _Graph2>& gw,
     1051              const _Value& value) :
     1052        forward_map(*(gw.Parent1::graph), value),
     1053        backward_map(*(gw.Parent2::graph), value) { }
     1054      _Value operator[](const Edge& n) const {
     1055        if (!n.backward)
     1056          return forward_map[n];
     1057        else
     1058          return backward_map[n];
     1059      }
     1060      void set(const Edge& n, const _Value& value) {
     1061        if (!n.backward)
     1062          forward_map.set(n, value);
     1063        else
     1064          backward_map.set(n, value);
     1065      }
     1066//       using ParentMap1::operator[];
     1067//       using ParentMap2::operator[];
     1068    };
     1069
     1070  };
     1071
     1072
     1073  /*! A grah wrapper base class
     1074    for merging the node-sets and edge-sets of
     1075    two node-disjoint graphs
     1076    into one graph.
     1077    Specialized implementation for the case
     1078    when _Graph1::Edge is derived from _Graph2::Edge.
     1079   */
     1080  template <typename _Graph1, typename _Graph2>
     1081  class MergeEdgeGraphWrapperBase<
     1082    _Graph1, _Graph2, typename boost::enable_if<
     1083    boost::is_base_and_derived<typename _Graph2::Edge, typename _Graph1::Edge> >::type> :
     1084    public MergeNodeGraphWrapperBase<_Graph1, _Graph2> {
     1085  public:
     1086    static void printEdge() { std::cout << "edge: 1st is derived" << std::endl; }
     1087    typedef _Graph1 Graph1;
     1088    typedef _Graph2 Graph2;
     1089    typedef MergeNodeGraphWrapperBase<_Graph1, _Graph2> Parent;
     1090    typedef typename Parent::Parent1 Parent1;
     1091    typedef typename Parent::Parent2 Parent2;
     1092//     typedef P1<_Graph1> Parent1;
     1093//     typedef P2<_Graph2> Parent2;
     1094    typedef typename Parent1::Edge Graph1Edge;
     1095    typedef typename Parent2::Edge Graph2Edge;
     1096  protected:
     1097    MergeEdgeGraphWrapperBase() { }
     1098  public:
     1099    template <typename _Value> class EdgeMap;
     1100
     1101    typedef typename Parent::Node Node;
     1102
     1103    class Edge : public Graph1Edge {
     1104      friend class MergeEdgeGraphWrapperBase<_Graph1, _Graph2>;
     1105      template <typename _Value> friend class EdgeMap;
     1106    protected:
     1107      bool backward; //true, iff backward
     1108    public:
     1109      Edge() { }
     1110      /// \todo =false is needed, or causes problems?
     1111      /// If \c _backward is false, then we get an edge corresponding to the
     1112      /// original one, otherwise its oppositely directed pair is obtained.
     1113      Edge(const Graph1Edge& n1,
     1114           const Graph2Edge& n2, bool _backward) :
     1115        Graph1Edge(n1), backward(_backward) {
     1116        if (backward) *this=n2;
     1117      }
     1118      Edge(Invalid i) : Graph1Edge(i), backward(true) { }
     1119      bool operator==(const Edge& v) const {
     1120        if (backward)
     1121          return (v.backward &&
     1122                  static_cast<Graph2Edge>(*this)==static_cast<Graph2Edge>(v));
     1123        else
     1124          return (!v.backward &&
     1125                  static_cast<Graph1Edge>(*this)==static_cast<Graph1Edge>(v));
     1126      }
     1127      bool operator!=(const Edge& v) const {
     1128        return !(*this==v);
     1129      }
     1130    };
     1131
     1132    using Parent::first;
     1133    void first(Edge& i) const {
     1134      Parent1::graph->first(*static_cast<Graph1Edge*>(&i));
     1135      i.backward=false;
     1136      if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     1137        Parent2::graph->first(*static_cast<Graph2Edge*>(&i));
     1138        i.backward=true;
     1139      }
     1140    }
     1141    void firstIn(Edge& i, const Node& n) const {
     1142      Parent1::graph->firstIn(*static_cast<Graph1Edge*>(&i), n);
     1143      i.backward=false;
     1144      if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     1145        Parent2::graph->firstIn(*static_cast<Graph2Edge*>(&i), n);
     1146        i.backward=true;
     1147      }
     1148    }
     1149    void firstOut(Edge& i, const Node& n) const {
     1150      Parent1::graph->firstOut(*static_cast<Graph1Edge*>(&i), n);
     1151      i.backward=false;
     1152      if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     1153        Parent2::graph->firstOut(*static_cast<Graph2Edge*>(&i), n);
     1154        i.backward=true;
     1155      }
     1156    }
     1157
     1158    using Parent::next;
     1159    void next(Edge& i) const {
     1160      if (!(i.backward)) {
     1161        Parent1::graph->next(*static_cast<Graph1Edge*>(&i));
     1162        if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     1163          Parent2::graph->first(*static_cast<Graph2Edge*>(&i));
     1164          i.backward=true;
     1165        }
     1166      } else {
     1167        Parent2::graph->next(*static_cast<Graph2Edge*>(&i));
     1168      }
     1169    }
     1170    void nextIn(Edge& i) const {
     1171      if (!(i.backward)) {
     1172        Parent1::graph->nextIn(*static_cast<Graph1Edge*>(&i));
     1173        if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     1174          Parent2::graph->first(*static_cast<Graph2Edge*>(&i));
     1175          i.backward=true;
     1176        }
     1177      } else {
     1178        Parent2::graph->nextIn(*static_cast<Graph2Edge*>(&i));
     1179      }
     1180    }
     1181    void nextOut(Edge& i) const {
     1182      if (!(i.backward)) {
     1183        Parent1::graph->nextOut(*static_cast<Graph1Edge*>(&i));
     1184        if (*static_cast<Graph1Edge*>(&i)==INVALID) {
     1185          Parent2::graph->first(*static_cast<Graph2Edge*>(&i));
     1186          i.backward=true;
     1187        }
     1188      } else {
     1189        Parent2::graph->nextOut(*static_cast<Graph2Edge*>(&i));
     1190      }
     1191    }
     1192
     1193    Node source(const Edge& i) const {
     1194      if (!(i.backward)) {
     1195        return
     1196          Node(Parent1::graph->source(i), INVALID, false);
     1197      } else {
     1198        return
     1199          Node(INVALID, Parent2::graph->source(i), true);
     1200      }
     1201    }
     1202
     1203    Node target(const Edge& i) const {
     1204      if (!(i.backward)) {
     1205        return
     1206          Node(Parent1::graph->target(i), INVALID, false);
     1207      } else {
     1208        return
     1209          Node(INVALID, Parent2::graph->target(i), true);
     1210      }
     1211    }
     1212
     1213    using Parent::id;
     1214    int id(const Edge& n) const {
     1215      if (!n.backward)
     1216        return this->Parent1::graph->id(n);
     1217      else
     1218        return this->Parent2::graph->id(n);
     1219    }
     1220
     1221    template <typename _Value>
     1222    class EdgeMap {
     1223    protected:
     1224      typedef typename Parent::Graph1::template EdgeMap<_Value> ParentMap1;
     1225      typedef typename Parent::Graph2::template EdgeMap<_Value> ParentMap2;
     1226      ParentMap1 forward_map;
     1227      ParentMap2 backward_map;
     1228    public:
     1229      typedef _Value Value;
     1230      typedef Edge Key;
     1231      EdgeMap(const MergeEdgeGraphWrapperBase<_Graph1, _Graph2>& gw) :
     1232        forward_map(*(gw.Parent1::graph)),
     1233        backward_map(*(gw.Parent2::graph)) { }
     1234      EdgeMap(const MergeEdgeGraphWrapperBase<_Graph1, _Graph2>& gw,
     1235              const _Value& value) :
     1236        forward_map(*(gw.Parent1::graph), value),
     1237        backward_map(*(gw.Parent2::graph), value) { }
     1238      _Value operator[](const Edge& n) const {
     1239        if (!n.backward)
     1240          return forward_map[n];
     1241        else
     1242          return backward_map[n];
     1243      }
     1244      void set(const Edge& n, const _Value& value) {
     1245        if (!n.backward)
     1246          forward_map.set(n, value);
     1247        else
     1248          backward_map.set(n, value);
     1249      }
     1250//       using ParentMap1::operator[];
     1251//       using ParentMap2::operator[];
     1252    };
     1253
     1254  };
     1255
     1256
    7031257  /*! A graph wrapper class
    7041258    for merging the node-sets and edge-sets of
  • src/work/marci/merge_node_graph_wrapper_test.cc

    r1013 r1016  
    4949      MergeEdgeGraphWrapper<Graph1, Graph1>::printNode();
    5050      MergeEdgeGraphWrapper<Graph1, Graph1>::printEdge();
     51      typedef ResGraphWrapper<Graph1, int,
     52        ConstMap<Graph1, int>, ConstMap<Graph1, int> > Graph4;
     53      checkConcept<StaticGraph, MergeEdgeGraphWrapper<Graph1, Graph4> >();   
     54      MergeEdgeGraphWrapper<Graph1, Graph4>::printNode();
     55      MergeEdgeGraphWrapper<Graph1, Graph4>::printEdge();
     56      checkConcept<StaticGraph, MergeEdgeGraphWrapper<Graph4, Graph1> >();   
     57      MergeEdgeGraphWrapper<Graph4, Graph1>::printNode();
     58      MergeEdgeGraphWrapper<Graph4, Graph1>::printEdge(); 
    5159    }
    5260 
     
    119127
    120128    typedef ListGraph Graph3;
     129    //typedef SmartGraph Graph3;
    121130    Graph3 g3;
    122131    GW::NodeMap<Graph3::Node> gwn(gw);
Note: See TracChangeset for help on using the changeset viewer.