COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
05/20/04 17:40:59 (17 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@850
Message:

a

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/leda/leda_graph_wrapper.h

    r646 r650  
    3434    void setGraph(Graph& _l_graph) { l_graph=&_l_graph; }
    3535  public:
    36    
    37         //LedaGraphWrapper() { }
     36
     37    /// Constructor for wrapping LEDA graphs.
    3838    LedaGraphWrapper(Graph& _l_graph) : l_graph(&_l_graph) { }
    39     LedaGraphWrapper(const LedaGraphWrapper &G) : l_graph(G.l_graph) { }
     39    /// Copy constructor
     40    LedaGraphWrapper(const LedaGraphWrapper &g) : l_graph(g.l_graph) { }
    4041
    4142    template <typename T> class NodeMap;
     
    5152    class InEdgeIt;
    5253
    53     /// The base type of the node iterators.
     54    /// Trivial node-iterator
    5455    class Node {
    5556      friend class LedaGraphWrapper<Graph>;
     
    6667      /// @warning The default constructor sets the iterator
    6768      /// to an undefined value.
    68       Node() {}   //FIXME
     69      Node() { }   //FIXME
    6970      /// Initialize the iterator to be invalid
    7071      Node(Invalid) : l_n(0) { }
     
    8081      /// @warning The default constructor sets the iterator
    8182      /// to an undefined value.
    82       NodeIt() {} //FIXME
    83       /// Initialize the iterator to be invalid
    84       NodeIt(Invalid i) : Node(i) {}
     83      NodeIt() { } //FIXME
     84      /// Initialize the iterator to be invalid
     85      NodeIt(Invalid i) : Node(i) { }
    8586      /// Sets the iterator to the first node of \c G.
    8687      NodeIt(const LedaGraphWrapper &G) : Node(G.l_graph->first_node()) { }
     
    8889    };
    8990   
    90     /// The base type of the edge iterators.
     91    /// Trivial edge-iterator.
    9192    class Edge {
    9293      friend class LedaGraphWrapper;
     
    99100      /// @warning The default constructor sets the iterator
    100101      /// to an undefined value.
    101       Edge() {}   //FIXME
    102       /// Initialize the iterator to be invalid
    103       Edge(Invalid) : l_e(0) {}
     102      Edge() { }   //FIXME
     103      /// Initialize the iterator to be invalid
     104      Edge(Invalid) : l_e(0) { }
    104105      //Edge(const Edge &) {}
    105106      bool operator==(Edge e) const { return l_e==e.l_e; } //FIXME
     
    108109    };
    109110   
    110     /// This iterator goes trought the outgoing edges of a certain graph.
    111    
     111    /// This iterator goes trought the outgoing edges of a certain node.
    112112    class OutEdgeIt : public Edge {
    113113    public:
    114114      /// @warning The default constructor sets the iterator
    115115      /// to an undefined value.
    116       OutEdgeIt() {}
    117       /// Initialize the iterator to be invalid
    118       OutEdgeIt(Invalid i) : Edge(i) {}
     116      OutEdgeIt() { }
     117      /// Initialize the iterator to be invalid
     118      OutEdgeIt(Invalid i) : Edge(i) { }
    119119      /// This constructor sets the iterator to first outgoing edge.
    120120   
     
    126126    };
    127127
     128    /// This iterator goes trought the incoming edges of a certain node.
    128129    class InEdgeIt : public Edge {
    129130    public:
    130131      /// @warning The default constructor sets the iterator
    131132      /// to an undefined value.
    132       InEdgeIt() {}
    133       /// Initialize the iterator to be invalid
    134       InEdgeIt(Invalid i) : Edge(i) {}
     133      InEdgeIt() { }
     134      /// Initialize the iterator to be invalid
     135      InEdgeIt(Invalid i) : Edge(i) { }
    135136      InEdgeIt(const LedaGraphWrapper & G, Node n) : Edge(G.l_graph->first_in_edge(n.l_n)) { }
    136137    };
    137138
    138139    //  class SymEdgeIt : public Edge {};
     140   
     141    /// This iterator goes trought the edges of the graph.
    139142    class EdgeIt : public Edge {
    140143    public:
    141144      /// @warning The default constructor sets the iterator
    142145      /// to an undefined value.
    143       EdgeIt() {}
    144       /// Initialize the iterator to be invalid
    145       EdgeIt(Invalid i) : Edge(i) {}
     146      EdgeIt() { }
     147      /// Initialize the iterator to be invalid
     148      EdgeIt(Invalid i) : Edge(i) { }
    146149      EdgeIt(const LedaGraphWrapper & G) : Edge(G.l_graph->first_edge()) { }
    147150    };
    148151
    149152    /// First node of the graph.
    150 
     153    ///
    151154    /// \post \c i and the return value will be the first node.
    152155    ///
     
    164167    }
    165168    //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
    166     /// The first edge of the Graph.
     169    /// The first edge of the graph.
    167170    EdgeIt &first(EdgeIt &i) const {     
    168171      i=EdgeIt(*this);
     
    254257    int edgeNum() const { return l_graph->number_of_edges(); }
    255258
    256     ///Read/write map from the nodes to type \c T.
     259    /// Read/write map from the nodes to type \c T.
    257260    template<typename T> class NodeMap
    258261    {
     
    274277    };
    275278
    276     ///Read/write map from the edges to type \c T.
     279    /// Read/write map from the edges to type \c T.
    277280    template<typename T> class EdgeMap
    278281    {
     
    295298
    296299
    297     ///Read/write map from the nodes to type \c T.
     300    /// This class is to wrap existing
     301    /// LEDA node-maps to HUGO ones.
    298302    template<typename T> class NodeMapWrapper
    299303    {
    300       leda_node_map<T>* leda_stuff;
     304      leda_node_array<T>* leda_stuff;
    301305    public:
    302306      typedef T ValueType;
    303307      typedef Node KeyType;
    304308
    305       NodeMapWrapper(leda_node_map<T>& _leda_stuff) :
     309      NodeMapWrapper(leda_node_array<T>& _leda_stuff) :
    306310        leda_stuff(&_leda_stuff) { }
    307311      //NodeMap(leda_node_map& &G, T t) : leda_stuff(*(G.l_graph), t) {}
    308312
    309313      void set(Node i, T t) { (*leda_stuff)[i.l_n]=t; }
    310       T get(Node i) const { return (*leda_stuff)[i.l_n]; }  //FIXME: Is it necessary
     314      //T get(Node i) const { return (*leda_stuff)[i.l_n]; }  //FIXME: Is it necessary
    311315      T &operator[](Node i) { return (*leda_stuff)[i.l_n]; }
    312316      const T &operator[](Node i) const { return (*leda_stuff)[i.l_n]; }
     
    316320    };
    317321
    318     ///Read/write map from the edges to type \c T.
     322    /// This class is to wrap existing
     323    /// LEDA edge-maps to HUGO ones.
    319324    template<typename T> class EdgeMapWrapper
    320325    {
    321       leda_edge_map<T>* leda_stuff;
     326      leda_edge_array<T>* leda_stuff;
    322327    public:
    323328      typedef T ValueType;
    324329      typedef Edge KeyType;
    325330
    326       EdgeMapWrapper(leda_edge_map<T>& _leda_stuff) :
     331      EdgeMapWrapper(leda_edge_array<T>& _leda_stuff) :
    327332        leda_stuff(_leda_stuff) { }
    328333      //EdgeMap(const LedaGraphWrapper &G, T t) : leda_stuff(*(G.l_graph), t) {}
    329334
    330335      void set(Edge i, T t) { (*leda_stuff)[i.l_e]=t; }
    331       T get(Edge i) const { return (*leda_stuff)[i.l_e]; }  //FIXME: Is it necessary
     336      //T get(Edge i) const { return (*leda_stuff)[i.l_e]; }  //FIXME: Is it necessary
    332337      T &operator[](Edge i) { return (*leda_stuff)[i.l_e]; }
    333338      const T &operator[](Edge i) const { return (*leda_stuff)[i.l_e]; }
     
    335340      void update() { /*leda_stuff.init(leda_stuff.get_graph());*/ }
    336341      //void update(T a) { leda_stuff.init(leda_stuff.get_graph()/**(G.l_graph)*/, a); }   //FIXME: Is it necessary
     342    };
     343
     344    /// This class is used for access node-data of
     345    /// LEDA parametrized graphs.
     346    template<typename T>
     347    class NodeDataMap : public NodeMapWrapper<T>
     348    {
     349    public:
     350      NodeDataMap(LedaGraphWrapper<Graph>& LGW) :
     351        NodeMapWrapper<T>(*(LGW._g_graph).node_data()) { }
     352    };
     353
     354    /// This class is used for access edge-data of
     355    /// LEDA parametrized graphs.
     356    template<typename T>
     357    class EdgeDataMap : public EdgeMapWrapper<T>
     358    {
     359    public:
     360      EdgeDataMap(LedaGraphWrapper<Graph>& LGW) :
     361        EdgeMapWrapper<T>(*(LGW._g_graph).edge_data()) { }
    337362    };
    338363
Note: See TracChangeset for help on using the changeset viewer.