COIN-OR::LEMON - Graph Library

Changeset 2128:509846825ddf in lemon-0.x for lemon


Ignore:
Timestamp:
07/11/06 18:09:49 (13 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2841
Message:
  • Disable the copy constructor and operator= of {List|Smart}[U]Graph.
  • Improve graph doc
  • Also put private members into the doc (if they are documented)
Location:
lemon
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lemon/concept/graph.h

    r2126 r2128  
    5454      ///
    5555      Graph() { }
    56 
    57       /// The base type of node iterators,
    58       /// or in other words, the trivial node iterator.
    59 
    60       /// This is the base type of each node iterator,
    61       /// thus each kind of node iterator converts to this.
    62       /// More precisely each kind of node iterator should be inherited
    63       /// from the trivial node iterator.
     56      /// Class for identifying a node of the graph
     57
     58      /// This class identifies a node of the graph. It also serves
     59      /// as a base class of the node iterators,
     60      /// thus they will convert to this type.
    6461      class Node {
    6562      public:
     
    150147   
    151148   
    152       /// The base type of the edge iterators.
    153 
    154       /// The base type of the edge iterators.
    155       ///
     149      /// Class for identifying an edge of the graph
     150
     151      /// This class identifies an edge of the graph. It also serves
     152      /// as a base class of the edge iterators,
     153      /// thus they will convert to this type.
    156154      class Edge {
    157155      public:
     
    385383      /// ReadWrite map of the nodes to type \c T.
    386384      /// \sa Reference
    387       /// \warning Making maps that can handle bool type (NodeMap<bool>)
    388       /// needs some extra attention!
    389385      template<class T>
    390386      class NodeMap : public ReadWriteMap< Node, T > {
     
    410406      /// Reference map of the edges to type \c T.
    411407      /// \sa Reference
    412       /// \warning Making maps that can handle bool type (EdgeMap<bool>)
    413       /// needs some extra attention!
    414408      template<class T>
    415409      class EdgeMap : public ReadWriteMap<Edge,T> {
  • lemon/list_graph.h

    r2123 r2128  
    326326
    327327  class ListGraph : public ExtendedListGraphBase {
     328  private:
     329    ///ListGraph is \e not copy constructible. Use GraphCopy() instead.
     330   
     331    ///ListGraph is \e not copy constructible. Use GraphCopy() instead.
     332    ///
     333    ListGraph(const ListGraph &) :ExtendedListGraphBase() {};
     334    ///\brief Assignment of ListGraph to another is \e not allowed.
     335    ///Use GraphCopy() instead.
     336
     337    ///Assignment of ListGraph to another is \e not allowed.
     338    ///Use GraphCopy() instead.
     339    void operator=(const ListGraph &) {}
    328340  public:
    329341
    330342    typedef ExtendedListGraphBase Parent;
     343
     344    /// Constructor
     345   
     346    /// Constructor.
     347    ///
     348    ListGraph() {}
    331349
    332350    ///Add a new node to the graph.
     
    737755  ///
    738756  class ListUGraph : public ExtendedListUGraphBase {
     757  private:
     758    ///ListUGraph is \e not copy constructible. Use UGraphCopy() instead.
     759
     760    ///ListUGraph is \e not copy constructible. Use UGraphCopy() instead.
     761    ///
     762    ListUGraph(const ListUGraph &) :ExtendedListUGraphBase()  {};
     763    ///\brief Assignment of ListUGraph to another is \e not allowed.
     764    ///Use UGraphCopy() instead.
     765
     766    ///Assignment of ListUGraph to another is \e not allowed.
     767    ///Use UGraphCopy() instead.
     768    void operator=(const ListUGraph &) {}
    739769  public:
     770    /// Constructor
     771   
     772    /// Constructor.
     773    ///
     774    ListUGraph() {}
     775
    740776    typedef ExtendedListUGraphBase Parent;
    741777    /// \brief Add a new node to the graph.
     
    11321168      first_free_edge = edge.id;
    11331169    }
    1134 
     1170 
     1171    ///\e
     1172   
     1173    ///\bug Undocumented
     1174    ///\bug Doesn't destruct the maps.
    11351175    void clear() {
    11361176      aNodes.clear();
  • lemon/smart_graph.h

    r2123 r2128  
    9898    int maxEdgeId() const { return edges.size()-1; }
    9999
    100     Node source(Edge e) const { return edges[e.n].source; }
    101     Node target(Edge e) const { return edges[e.n].target; }
    102 
    103     /// Node ID.
    104    
    105     /// The ID of a valid Node is a nonnegative integer not greater than
    106     /// \ref maxNodeId(). The range of the ID's is not surely continuous
    107     /// and the greatest node ID can be actually less then \ref maxNodeId().
    108     ///
    109     /// The ID of the \ref INVALID node is -1.
    110     ///\return The ID of the node \c v.
    111     static int id(Node v) { return v.n; }
    112     /// Edge ID.
    113    
    114     /// The ID of a valid Edge is a nonnegative integer not greater than
    115     /// \ref maxEdgeId(). The range of the ID's is not surely continuous
    116     /// and the greatest edge ID can be actually less then \ref maxEdgeId().
    117     ///
    118     /// The ID of the \ref INVALID edge is -1.
    119     ///\return The ID of the edge \c e.
    120     static int id(Edge e) { return e.n; }
    121 
    122     /// \brief Returns the node from its \c id.
    123     ///
    124     /// Returns the node from its \c id. If there is not node
    125     /// with the given id the effect of the function is undefinied.
    126     static Node nodeFromId(int id) { return Node(id);}
    127 
    128     /// \brief Returns the edge from its \c id.
    129     ///
    130     /// Returns the edge from its \c id. If there is not edge
    131     /// with the given id the effect of the function is undefinied.
    132     static Edge edgeFromId(int id) { return Edge(id);}
    133 
    134100    Node addNode() {
    135101      Node n; n.n=nodes.size();
     
    148114    }
    149115
    150     void clear() {
    151       edges.clear();
    152       nodes.clear();
    153     }
    154 
     116
     117    Node source(Edge e) const { return edges[e.n].source; }
     118    Node target(Edge e) const { return edges[e.n].target; }
     119
     120    /// Node ID.
     121   
     122    /// The ID of a valid Node is a nonnegative integer not greater than
     123    /// \ref maxNodeId(). The range of the ID's is not surely continuous
     124    /// and the greatest node ID can be actually less then \ref maxNodeId().
     125    ///
     126    /// The ID of the \ref INVALID node is -1.
     127    ///\return The ID of the node \c v.
     128    static int id(Node v) { return v.n; }
     129    /// Edge ID.
     130   
     131    /// The ID of a valid Edge is a nonnegative integer not greater than
     132    /// \ref maxEdgeId(). The range of the ID's is not surely continuous
     133    /// and the greatest edge ID can be actually less then \ref maxEdgeId().
     134    ///
     135    /// The ID of the \ref INVALID edge is -1.
     136    ///\return The ID of the edge \c e.
     137    static int id(Edge e) { return e.n; }
     138
     139    /// \brief Returns the node from its \c id.
     140    ///
     141    /// Returns the node from its \c id. If there is not node
     142    /// with the given id the effect of the function is undefinied.
     143    static Node nodeFromId(int id) { return Node(id);}
     144
     145    /// \brief Returns the edge from its \c id.
     146    ///
     147    /// Returns the edge from its \c id. If there is not edge
     148    /// with the given id the effect of the function is undefinied.
     149    static Edge edgeFromId(int id) { return Edge(id);}
    155150
    156151    class Node {
     
    217212    }
    218213
    219     Node _split(Node n, bool connect = true)
    220     {
    221       Node b = addNode();
    222       nodes[b.n].first_out=nodes[n.n].first_out;
    223       nodes[n.n].first_out=-1;
    224       for(int i=nodes[b.n].first_out;i!=-1;i++) edges[i].source=b.n;
    225       if(connect) addEdge(n,b);
    226       return b;
    227     }
    228 
    229214  };
    230215
     
    252237    friend class Snapshot;
    253238
     239  private:
     240    ///SmartGraph is \e not copy constructible. Use GraphCopy() instead.
     241
     242    ///SmartGraph is \e not copy constructible. Use GraphCopy() instead.
     243    ///
     244    SmartGraph(const SmartGraph &) :ExtendedSmartGraphBase() {};
     245    ///\brief Assignment of SmartGraph to another is \e not allowed.
     246    ///Use GraphCopy() instead.
     247
     248    ///Assignment of SmartGraph to another is \e not allowed.
     249    ///Use GraphCopy() instead.
     250    void operator=(const SmartGraph &) {}
    254251  protected:
    255252    void restoreSnapshot(const Snapshot &s)
     
    269266
    270267  public:
     268   
     269    /// Constructor
     270   
     271    /// Constructor.
     272    ///
     273    SmartGraph() {};
     274   
     275    ///Add a new node to the graph.
     276   
     277    /// \return the new node.
     278    ///
     279    Node addNode() { return Parent::addNode(); }
     280   
     281    ///Add a new edge to the graph.
     282   
     283    ///Add a new edge to the graph with source node \c s
     284    ///and target node \c t.
     285    ///\return the new edge.
     286    Edge addEdge(const Node& s, const Node& t) {
     287      return Parent::addEdge(s, t);
     288    }
     289
     290    ///\e
     291   
     292    ///\bug Undocumented
     293    ///\bug Doesn't destruct the maps.
     294    void clear() {
     295      edges.clear();
     296      nodes.clear();
     297    }
    271298
    272299    ///Split a node.
     
    285312    ///feature.
    286313    ///\todo It could be implemented in a bit faster way.
    287     Node split(Node n, bool connect = true) 
     314    Node split(Node n, bool connect = true)
    288315    {
    289       Node b = _split(n,connect);
     316      Node b = addNode();
     317      nodes[b.n].first_out=nodes[n.n].first_out;
     318      nodes[n.n].first_out=-1;
     319      for(int i=nodes[b.n].first_out;i!=-1;i++) edges[i].source=b.n;
     320      if(connect) addEdge(n,b);
    290321      return b;
    291322    }
    292  
    293323
    294324    ///Class to make a snapshot of the graph and to restrore to it later.
     
    377407  ///
    378408  class SmartUGraph : public ExtendedSmartUGraphBase {
     409  private:
     410    ///SmartUGraph is \e not copy constructible. Use UGraphCopy() instead.
     411
     412    ///SmartUGraph is \e not copy constructible. Use UGraphCopy() instead.
     413    ///
     414    SmartUGraph(const SmartUGraph &) : ExtendedSmartUGraphBase() {};
     415    ///\brief Assignment of SmartUGraph to another is \e not allowed.
     416    ///Use UGraphCopy() instead.
     417
     418    ///Assignment of SmartUGraph to another is \e not allowed.
     419    ///Use UGraphCopy() instead.
     420    void operator=(const SmartUGraph &) {}
     421  public:
     422    /// Constructor
     423   
     424    /// Constructor.
     425    ///
     426    SmartUGraph() {}
    379427  };
    380428
Note: See TracChangeset for help on using the changeset viewer.