COIN-OR::LEMON - Graph Library

Changes in / [739:32baeb8e5c8f:741:10c9c3a35b83] in lemon-main


Ignore:
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • doc/groups.dox

    r663 r735  
    637637\brief Skeleton and concept checking classes for graph structures
    638638
    639 This group contains the skeletons and concept checking classes of LEMON's
    640 graph structures and helper classes used to implement these.
     639This group contains the skeletons and concept checking classes of
     640graph structures.
    641641*/
    642642
  • lemon/concepts/digraph.h

    r580 r734  
    3636    /// \brief Class describing the concept of directed graphs.
    3737    ///
    38     /// This class describes the \ref concept "concept" of the
    39     /// immutable directed digraphs.
     38    /// This class describes the common interface of all directed
     39    /// graphs (digraphs).
    4040    ///
    41     /// Note that actual digraph implementation like @ref ListDigraph or
    42     /// @ref SmartDigraph may have several additional functionality.
     41    /// Like all concept classes, it only provides an interface
     42    /// without any sensible implementation. So any general algorithm for
     43    /// directed graphs should compile with this class, but it will not
     44    /// run properly, of course.
     45    /// An actual digraph implementation like \ref ListDigraph or
     46    /// \ref SmartDigraph may have additional functionality.
    4347    ///
    44     /// \sa concept
     48    /// \sa Graph
    4549    class Digraph {
    4650    private:
    47       ///Digraphs are \e not copy constructible. Use DigraphCopy() instead.
    48 
    49       ///Digraphs are \e not copy constructible. Use DigraphCopy() instead.
    50       ///
    51       Digraph(const Digraph &) {};
    52       ///\brief Assignment of \ref Digraph "Digraph"s to another ones are
    53       ///\e not allowed. Use DigraphCopy() instead.
    54 
    55       ///Assignment of \ref Digraph "Digraph"s to another ones are
    56       ///\e not allowed.  Use DigraphCopy() instead.
    57 
     51      /// Diraphs are \e not copy constructible. Use DigraphCopy instead.
     52      Digraph(const Digraph &) {}
     53      /// \brief Assignment of a digraph to another one is \e not allowed.
     54      /// Use DigraphCopy instead.
    5855      void operator=(const Digraph &) {}
     56
    5957    public:
    60       ///\e
    61 
    62       /// Defalult constructor.
    63 
    64       /// Defalult constructor.
    65       ///
     58      /// Default constructor.
    6659      Digraph() { }
    67       /// Class for identifying a node of the digraph
     60
     61      /// The node type of the digraph
    6862
    6963      /// This class identifies a node of the digraph. It also serves
    7064      /// as a base class of the node iterators,
    71       /// thus they will convert to this type.
     65      /// thus they convert to this type.
    7266      class Node {
    7367      public:
    7468        /// Default constructor
    7569
    76         /// @warning The default constructor sets the iterator
    77         /// to an undefined value.
     70        /// Default constructor.
     71        /// \warning It sets the object to an undefined value.
    7872        Node() { }
    7973        /// Copy constructor.
     
    8377        Node(const Node&) { }
    8478
    85         /// Invalid constructor \& conversion.
    86 
    87         /// This constructor initializes the iterator to be invalid.
     79        /// %Invalid constructor \& conversion.
     80
     81        /// Initializes the object to be invalid.
    8882        /// \sa Invalid for more details.
    8983        Node(Invalid) { }
    9084        /// Equality operator
    9185
     86        /// Equality operator.
     87        ///
    9288        /// Two iterators are equal if and only if they point to the
    93         /// same object or both are invalid.
     89        /// same object or both are \c INVALID.
    9490        bool operator==(Node) const { return true; }
    9591
    9692        /// Inequality operator
    9793
    98         /// \sa operator==(Node n)
    99         ///
     94        /// Inequality operator.
    10095        bool operator!=(Node) const { return true; }
    10196
    10297        /// Artificial ordering operator.
    10398
    104         /// To allow the use of digraph descriptors as key type in std::map or
    105         /// similar associative container we require this.
    106         ///
    107         /// \note This operator only have to define some strict ordering of
    108         /// the items; this order has nothing to do with the iteration
    109         /// ordering of the items.
     99        /// Artificial ordering operator.
     100        ///
     101        /// \note This operator only has to define some strict ordering of
     102        /// the nodes; this order has nothing to do with the iteration
     103        /// ordering of the nodes.
    110104        bool operator<(Node) const { return false; }
    111 
    112       };
    113 
    114       /// This iterator goes through each node.
    115 
    116       /// This iterator goes through each node.
     105      };
     106
     107      /// Iterator class for the nodes.
     108
     109      /// This iterator goes through each node of the digraph.
    117110      /// Its usage is quite simple, for example you can count the number
    118       /// of nodes in digraph \c g of type \c Digraph like this:
     111      /// of nodes in a digraph \c g of type \c %Digraph like this:
    119112      ///\code
    120113      /// int count=0;
     
    125118        /// Default constructor
    126119
    127         /// @warning The default constructor sets the iterator
    128         /// to an undefined value.
     120        /// Default constructor.
     121        /// \warning It sets the iterator to an undefined value.
    129122        NodeIt() { }
    130123        /// Copy constructor.
     
    133126        ///
    134127        NodeIt(const NodeIt& n) : Node(n) { }
    135         /// Invalid constructor \& conversion.
    136 
    137         /// Initialize the iterator to be invalid.
     128        /// %Invalid constructor \& conversion.
     129
     130        /// Initializes the iterator to be invalid.
    138131        /// \sa Invalid for more details.
    139132        NodeIt(Invalid) { }
    140133        /// Sets the iterator to the first node.
    141134
    142         /// Sets the iterator to the first node of \c g.
    143         ///
    144         NodeIt(const Digraph&) { }
    145         /// Node -> NodeIt conversion.
    146 
    147         /// Sets the iterator to the node of \c the digraph pointed by
    148         /// the trivial iterator.
    149         /// This feature necessitates that each time we
    150         /// iterate the arc-set, the iteration order is the same.
     135        /// Sets the iterator to the first node of the given digraph.
     136        ///
     137        explicit NodeIt(const Digraph&) { }
     138        /// Sets the iterator to the given node.
     139
     140        /// Sets the iterator to the given node of the given digraph.
     141        ///
    151142        NodeIt(const Digraph&, const Node&) { }
    152143        /// Next node.
     
    158149
    159150
    160       /// Class for identifying an arc of the digraph
     151      /// The arc type of the digraph
    161152
    162153      /// This class identifies an arc of the digraph. It also serves
     
    167158        /// Default constructor
    168159
    169         /// @warning The default constructor sets the iterator
    170         /// to an undefined value.
     160        /// Default constructor.
     161        /// \warning It sets the object to an undefined value.
    171162        Arc() { }
    172163        /// Copy constructor.
     
    175166        ///
    176167        Arc(const Arc&) { }
    177         /// Initialize the iterator to be invalid.
    178 
    179         /// Initialize the iterator to be invalid.
    180         ///
     168        /// %Invalid constructor \& conversion.
     169
     170        /// Initializes the object to be invalid.
     171        /// \sa Invalid for more details.
    181172        Arc(Invalid) { }
    182173        /// Equality operator
    183174
     175        /// Equality operator.
     176        ///
    184177        /// Two iterators are equal if and only if they point to the
    185         /// same object or both are invalid.
     178        /// same object or both are \c INVALID.
    186179        bool operator==(Arc) const { return true; }
    187180        /// Inequality operator
    188181
    189         /// \sa operator==(Arc n)
    190         ///
     182        /// Inequality operator.
    191183        bool operator!=(Arc) const { return true; }
    192184
    193185        /// Artificial ordering operator.
    194186
    195         /// To allow the use of digraph descriptors as key type in std::map or
    196         /// similar associative container we require this.
    197         ///
    198         /// \note This operator only have to define some strict ordering of
    199         /// the items; this order has nothing to do with the iteration
    200         /// ordering of the items.
     187        /// Artificial ordering operator.
     188        ///
     189        /// \note This operator only has to define some strict ordering of
     190        /// the arcs; this order has nothing to do with the iteration
     191        /// ordering of the arcs.
    201192        bool operator<(Arc) const { return false; }
    202193      };
    203194
    204       /// This iterator goes trough the outgoing arcs of a node.
     195      /// Iterator class for the outgoing arcs of a node.
    205196
    206197      /// This iterator goes trough the \e outgoing arcs of a certain node
     
    208199      /// Its usage is quite simple, for example you can count the number
    209200      /// of outgoing arcs of a node \c n
    210       /// in digraph \c g of type \c Digraph as follows.
     201      /// in a digraph \c g of type \c %Digraph as follows.
    211202      ///\code
    212203      /// int count=0;
    213       /// for (Digraph::OutArcIt e(g, n); e!=INVALID; ++e) ++count;
     204      /// for (Digraph::OutArcIt a(g, n); a!=INVALID; ++a) ++count;
    214205      ///\endcode
    215 
    216206      class OutArcIt : public Arc {
    217207      public:
    218208        /// Default constructor
    219209
    220         /// @warning The default constructor sets the iterator
    221         /// to an undefined value.
     210        /// Default constructor.
     211        /// \warning It sets the iterator to an undefined value.
    222212        OutArcIt() { }
    223213        /// Copy constructor.
     
    226216        ///
    227217        OutArcIt(const OutArcIt& e) : Arc(e) { }
    228         /// Initialize the iterator to be invalid.
    229 
    230         /// Initialize the iterator to be invalid.
    231         ///
     218        /// %Invalid constructor \& conversion.
     219
     220        /// Initializes the iterator to be invalid.
     221        /// \sa Invalid for more details.
    232222        OutArcIt(Invalid) { }
    233         /// This constructor sets the iterator to the first outgoing arc.
    234 
    235         /// This constructor sets the iterator to the first outgoing arc of
    236         /// the node.
     223        /// Sets the iterator to the first outgoing arc.
     224
     225        /// Sets the iterator to the first outgoing arc of the given node.
     226        ///
    237227        OutArcIt(const Digraph&, const Node&) { }
    238         /// Arc -> OutArcIt conversion
    239 
    240         /// Sets the iterator to the value of the trivial iterator.
    241         /// This feature necessitates that each time we
    242         /// iterate the arc-set, the iteration order is the same.
     228        /// Sets the iterator to the given arc.
     229
     230        /// Sets the iterator to the given arc of the given digraph.
     231        ///
    243232        OutArcIt(const Digraph&, const Arc&) { }
    244         ///Next outgoing arc
     233        /// Next outgoing arc
    245234
    246235        /// Assign the iterator to the next
     
    249238      };
    250239
    251       /// This iterator goes trough the incoming arcs of a node.
     240      /// Iterator class for the incoming arcs of a node.
    252241
    253242      /// This iterator goes trough the \e incoming arcs of a certain node
    254243      /// of a digraph.
    255244      /// Its usage is quite simple, for example you can count the number
    256       /// of outgoing arcs of a node \c n
    257       /// in digraph \c g of type \c Digraph as follows.
     245      /// of incoming arcs of a node \c n
     246      /// in a digraph \c g of type \c %Digraph as follows.
    258247      ///\code
    259248      /// int count=0;
    260       /// for(Digraph::InArcIt e(g, n); e!=INVALID; ++e) ++count;
     249      /// for(Digraph::InArcIt a(g, n); a!=INVALID; ++a) ++count;
    261250      ///\endcode
    262 
    263251      class InArcIt : public Arc {
    264252      public:
    265253        /// Default constructor
    266254
    267         /// @warning The default constructor sets the iterator
    268         /// to an undefined value.
     255        /// Default constructor.
     256        /// \warning It sets the iterator to an undefined value.
    269257        InArcIt() { }
    270258        /// Copy constructor.
     
    273261        ///
    274262        InArcIt(const InArcIt& e) : Arc(e) { }
    275         /// Initialize the iterator to be invalid.
    276 
    277         /// Initialize the iterator to be invalid.
    278         ///
     263        /// %Invalid constructor \& conversion.
     264
     265        /// Initializes the iterator to be invalid.
     266        /// \sa Invalid for more details.
    279267        InArcIt(Invalid) { }
    280         /// This constructor sets the iterator to first incoming arc.
    281 
    282         /// This constructor set the iterator to the first incoming arc of
    283         /// the node.
     268        /// Sets the iterator to the first incoming arc.
     269
     270        /// Sets the iterator to the first incoming arc of the given node.
     271        ///
    284272        InArcIt(const Digraph&, const Node&) { }
    285         /// Arc -> InArcIt conversion
    286 
    287         /// Sets the iterator to the value of the trivial iterator \c e.
    288         /// This feature necessitates that each time we
    289         /// iterate the arc-set, the iteration order is the same.
     273        /// Sets the iterator to the given arc.
     274
     275        /// Sets the iterator to the given arc of the given digraph.
     276        ///
    290277        InArcIt(const Digraph&, const Arc&) { }
    291278        /// Next incoming arc
    292279
    293         /// Assign the iterator to the next inarc of the corresponding node.
    294         ///
     280        /// Assign the iterator to the next
     281        /// incoming arc of the corresponding node.
    295282        InArcIt& operator++() { return *this; }
    296283      };
    297       /// This iterator goes through each arc.
    298 
    299       /// This iterator goes through each arc of a digraph.
     284
     285      /// Iterator class for the arcs.
     286
     287      /// This iterator goes through each arc of the digraph.
    300288      /// Its usage is quite simple, for example you can count the number
    301       /// of arcs in a digraph \c g of type \c Digraph as follows:
     289      /// of arcs in a digraph \c g of type \c %Digraph as follows:
    302290      ///\code
    303291      /// int count=0;
    304       /// for(Digraph::ArcIt e(g); e!=INVALID; ++e) ++count;
     292      /// for(Digraph::ArcIt a(g); a!=INVALID; ++a) ++count;
    305293      ///\endcode
    306294      class ArcIt : public Arc {
     
    308296        /// Default constructor
    309297
    310         /// @warning The default constructor sets the iterator
    311         /// to an undefined value.
     298        /// Default constructor.
     299        /// \warning It sets the iterator to an undefined value.
    312300        ArcIt() { }
    313301        /// Copy constructor.
     
    316304        ///
    317305        ArcIt(const ArcIt& e) : Arc(e) { }
    318         /// Initialize the iterator to be invalid.
    319 
    320         /// Initialize the iterator to be invalid.
    321         ///
     306        /// %Invalid constructor \& conversion.
     307
     308        /// Initializes the iterator to be invalid.
     309        /// \sa Invalid for more details.
    322310        ArcIt(Invalid) { }
    323         /// This constructor sets the iterator to the first arc.
    324 
    325         /// This constructor sets the iterator to the first arc of \c g.
    326         ///@param g the digraph
    327         ArcIt(const Digraph& g) { ignore_unused_variable_warning(g); }
    328         /// Arc -> ArcIt conversion
    329 
    330         /// Sets the iterator to the value of the trivial iterator \c e.
    331         /// This feature necessitates that each time we
    332         /// iterate the arc-set, the iteration order is the same.
     311        /// Sets the iterator to the first arc.
     312
     313        /// Sets the iterator to the first arc of the given digraph.
     314        ///
     315        explicit ArcIt(const Digraph& g) { ignore_unused_variable_warning(g); }
     316        /// Sets the iterator to the given arc.
     317
     318        /// Sets the iterator to the given arc of the given digraph.
     319        ///
    333320        ArcIt(const Digraph&, const Arc&) { }
    334         ///Next arc
     321        /// Next arc
    335322
    336323        /// Assign the iterator to the next arc.
     324        ///
    337325        ArcIt& operator++() { return *this; }
    338326      };
    339       ///Gives back the target node of an arc.
    340 
    341       ///Gives back the target node of an arc.
    342       ///
     327
     328      /// \brief The source node of the arc.
     329      ///
     330      /// Returns the source node of the given arc.
     331      Node source(Arc) const { return INVALID; }
     332
     333      /// \brief The target node of the arc.
     334      ///
     335      /// Returns the target node of the given arc.
    343336      Node target(Arc) const { return INVALID; }
    344       ///Gives back the source node of an arc.
    345 
    346       ///Gives back the source node of an arc.
    347       ///
    348       Node source(Arc) const { return INVALID; }
    349 
    350       /// \brief Returns the ID of the node.
     337
     338      /// \brief The ID of the node.
     339      ///
     340      /// Returns the ID of the given node.
    351341      int id(Node) const { return -1; }
    352342
    353       /// \brief Returns the ID of the arc.
     343      /// \brief The ID of the arc.
     344      ///
     345      /// Returns the ID of the given arc.
    354346      int id(Arc) const { return -1; }
    355347
    356       /// \brief Returns the node with the given ID.
    357       ///
    358       /// \pre The argument should be a valid node ID in the graph.
     348      /// \brief The node with the given ID.
     349      ///
     350      /// Returns the node with the given ID.
     351      /// \pre The argument should be a valid node ID in the digraph.
    359352      Node nodeFromId(int) const { return INVALID; }
    360353
    361       /// \brief Returns the arc with the given ID.
    362       ///
    363       /// \pre The argument should be a valid arc ID in the graph.
     354      /// \brief The arc with the given ID.
     355      ///
     356      /// Returns the arc with the given ID.
     357      /// \pre The argument should be a valid arc ID in the digraph.
    364358      Arc arcFromId(int) const { return INVALID; }
    365359
    366       /// \brief Returns an upper bound on the node IDs.
     360      /// \brief An upper bound on the node IDs.
     361      ///
     362      /// Returns an upper bound on the node IDs.
    367363      int maxNodeId() const { return -1; }
    368364
    369       /// \brief Returns an upper bound on the arc IDs.
     365      /// \brief An upper bound on the arc IDs.
     366      ///
     367      /// Returns an upper bound on the arc IDs.
    370368      int maxArcId() const { return -1; }
    371369
     
    393391      int maxId(Arc) const { return -1; }
    394392
     393      /// \brief The opposite node on the arc.
     394      ///
     395      /// Returns the opposite node on the given arc.
     396      Node oppositeNode(Node, Arc) const { return INVALID; }
     397
    395398      /// \brief The base node of the iterator.
    396399      ///
    397       /// Gives back the base node of the iterator.
    398       /// It is always the target of the pointed arc.
    399       Node baseNode(const InArcIt&) const { return INVALID; }
     400      /// Returns the base node of the given outgoing arc iterator
     401      /// (i.e. the source node of the corresponding arc).
     402      Node baseNode(OutArcIt) const { return INVALID; }
    400403
    401404      /// \brief The running node of the iterator.
    402405      ///
    403       /// Gives back the running node of the iterator.
    404       /// It is always the source of the pointed arc.
    405       Node runningNode(const InArcIt&) const { return INVALID; }
     406      /// Returns the running node of the given outgoing arc iterator
     407      /// (i.e. the target node of the corresponding arc).
     408      Node runningNode(OutArcIt) const { return INVALID; }
    406409
    407410      /// \brief The base node of the iterator.
    408411      ///
    409       /// Gives back the base node of the iterator.
    410       /// It is always the source of the pointed arc.
    411       Node baseNode(const OutArcIt&) const { return INVALID; }
     412      /// Returns the base node of the given incomming arc iterator
     413      /// (i.e. the target node of the corresponding arc).
     414      Node baseNode(InArcIt) const { return INVALID; }
    412415
    413416      /// \brief The running node of the iterator.
    414417      ///
    415       /// Gives back the running node of the iterator.
    416       /// It is always the target of the pointed arc.
    417       Node runningNode(const OutArcIt&) const { return INVALID; }
    418 
    419       /// \brief The opposite node on the given arc.
    420       ///
    421       /// Gives back the opposite node on the given arc.
    422       Node oppositeNode(const Node&, const Arc&) const { return INVALID; }
    423 
    424       /// \brief Reference map of the nodes to type \c T.
    425       ///
    426       /// Reference map of the nodes to type \c T.
     418      /// Returns the running node of the given incomming arc iterator
     419      /// (i.e. the source node of the corresponding arc).
     420      Node runningNode(InArcIt) const { return INVALID; }
     421
     422      /// \brief Standard graph map type for the nodes.
     423      ///
     424      /// Standard graph map type for the nodes.
     425      /// It conforms to the ReferenceMap concept.
    427426      template<class T>
    428427      class NodeMap : public ReferenceMap<Node, T, T&, const T&> {
    429428      public:
    430429
    431         ///\e
    432         NodeMap(const Digraph&) { }
    433         ///\e
     430        /// Constructor
     431        explicit NodeMap(const Digraph&) { }
     432        /// Constructor with given initial value
    434433        NodeMap(const Digraph&, T) { }
    435434
     
    446445      };
    447446
    448       /// \brief Reference map of the arcs to type \c T.
    449       ///
    450       /// Reference map of the arcs to type \c T.
     447      /// \brief Standard graph map type for the arcs.
     448      ///
     449      /// Standard graph map type for the arcs.
     450      /// It conforms to the ReferenceMap concept.
    451451      template<class T>
    452452      class ArcMap : public ReferenceMap<Arc, T, T&, const T&> {
    453453      public:
    454454
    455         ///\e
    456         ArcMap(const Digraph&) { }
    457         ///\e
     455        /// Constructor
     456        explicit ArcMap(const Digraph&) { }
     457        /// Constructor with given initial value
    458458        ArcMap(const Digraph&, T) { }
     459
    459460      private:
    460461        ///Copy constructor
  • lemon/concepts/graph.h

    r657 r734  
    1919///\ingroup graph_concepts
    2020///\file
    21 ///\brief The concept of Undirected Graphs.
     21///\brief The concept of undirected graphs.
    2222
    2323#ifndef LEMON_CONCEPTS_GRAPH_H
     
    2525
    2626#include <lemon/concepts/graph_components.h>
     27#include <lemon/concepts/maps.h>
     28#include <lemon/concept_check.h>
    2729#include <lemon/core.h>
    2830
     
    3234    /// \ingroup graph_concepts
    3335    ///
    34     /// \brief Class describing the concept of Undirected Graphs.
     36    /// \brief Class describing the concept of undirected graphs.
    3537    ///
    36     /// This class describes the common interface of all Undirected
    37     /// Graphs.
     38    /// This class describes the common interface of all undirected
     39    /// graphs.
    3840    ///
    39     /// As all concept describing classes it provides only interface
    40     /// without any sensible implementation. So any algorithm for
    41     /// undirected graph should compile with this class, but it will not
     41    /// Like all concept classes, it only provides an interface
     42    /// without any sensible implementation. So any general algorithm for
     43    /// undirected graphs should compile with this class, but it will not
    4244    /// run properly, of course.
     45    /// An actual graph implementation like \ref ListGraph or
     46    /// \ref SmartGraph may have additional functionality.   
    4347    ///
    44     /// The LEMON undirected graphs also fulfill the concept of
    45     /// directed graphs (\ref lemon::concepts::Digraph "Digraph
    46     /// Concept"). Each edges can be seen as two opposite
    47     /// directed arc and consequently the undirected graph can be
    48     /// seen as the direceted graph of these directed arcs. The
    49     /// Graph has the Edge inner class for the edges and
    50     /// the Arc type for the directed arcs. The Arc type is
    51     /// convertible to Edge or inherited from it so from a directed
    52     /// arc we can get the represented edge.
     48    /// The undirected graphs also fulfill the concept of \ref Digraph
     49    /// "directed graphs", since each edge can also be regarded as two
     50    /// oppositely directed arcs.
     51    /// Undirected graphs provide an Edge type for the undirected edges and
     52    /// an Arc type for the directed arcs. The Arc type is convertible to
     53    /// Edge or inherited from it, i.e. the corresponding edge can be
     54    /// obtained from an arc.
     55    /// EdgeIt and EdgeMap classes can be used for the edges, while ArcIt
     56    /// and ArcMap classes can be used for the arcs (just like in digraphs).
     57    /// Both InArcIt and OutArcIt iterates on the same edges but with
     58    /// opposite direction. IncEdgeIt also iterates on the same edges
     59    /// as OutArcIt and InArcIt, but it is not convertible to Arc,
     60    /// only to Edge.
    5361    ///
    54     /// In the sense of the LEMON each edge has a default
    55     /// direction (it should be in every computer implementation,
    56     /// because the order of edge's nodes defines an
    57     /// orientation). With the default orientation we can define that
    58     /// the directed arc is forward or backward directed. With the \c
    59     /// direction() and \c direct() function we can get the direction
    60     /// of the directed arc and we can direct an edge.
     62    /// In LEMON, each undirected edge has an inherent orientation.
     63    /// Thus it can defined if an arc is forward or backward oriented in
     64    /// an undirected graph with respect to this default oriantation of
     65    /// the represented edge.
     66    /// With the direction() and direct() functions the direction
     67    /// of an arc can be obtained and set, respectively.
    6168    ///
    62     /// The EdgeIt is an iterator for the edges. We can use
    63     /// the EdgeMap to map values for the edges. The InArcIt and
    64     /// OutArcIt iterates on the same edges but with opposite
    65     /// direction. The IncEdgeIt iterates also on the same edges
    66     /// as the OutArcIt and InArcIt but it is not convertible to Arc just
    67     /// to Edge.
     69    /// Only nodes and edges can be added to or removed from an undirected
     70    /// graph and the corresponding arcs are added or removed automatically.
     71    ///
     72    /// \sa Digraph
    6873    class Graph {
     74    private:
     75      /// Graphs are \e not copy constructible. Use DigraphCopy instead.
     76      Graph(const Graph&) {}
     77      /// \brief Assignment of a graph to another one is \e not allowed.
     78      /// Use DigraphCopy instead.
     79      void operator=(const Graph&) {}
     80
    6981    public:
    70       /// \brief The undirected graph should be tagged by the
    71       /// UndirectedTag.
    72       ///
    73       /// The undirected graph should be tagged by the UndirectedTag. This
    74       /// tag helps the enable_if technics to make compile time
     82      /// Default constructor.
     83      Graph() {}
     84
     85      /// \brief Undirected graphs should be tagged with \c UndirectedTag.
     86      ///
     87      /// Undirected graphs should be tagged with \c UndirectedTag.
     88      ///
     89      /// This tag helps the \c enable_if technics to make compile time
    7590      /// specializations for undirected graphs.
    7691      typedef True UndirectedTag;
    7792
    78       /// \brief The base type of node iterators,
    79       /// or in other words, the trivial node iterator.
    80       ///
    81       /// This is the base type of each node iterator,
    82       /// thus each kind of node iterator converts to this.
    83       /// More precisely each kind of node iterator should be inherited
    84       /// from the trivial node iterator.
     93      /// The node type of the graph
     94
     95      /// This class identifies a node of the graph. It also serves
     96      /// as a base class of the node iterators,
     97      /// thus they convert to this type.
    8598      class Node {
    8699      public:
    87100        /// Default constructor
    88101
    89         /// @warning The default constructor sets the iterator
    90         /// to an undefined value.
     102        /// Default constructor.
     103        /// \warning It sets the object to an undefined value.
    91104        Node() { }
    92105        /// Copy constructor.
     
    96109        Node(const Node&) { }
    97110
    98         /// Invalid constructor \& conversion.
    99 
    100         /// This constructor initializes the iterator to be invalid.
     111        /// %Invalid constructor \& conversion.
     112
     113        /// Initializes the object to be invalid.
    101114        /// \sa Invalid for more details.
    102115        Node(Invalid) { }
    103116        /// Equality operator
    104117
     118        /// Equality operator.
     119        ///
    105120        /// Two iterators are equal if and only if they point to the
    106         /// same object or both are invalid.
     121        /// same object or both are \c INVALID.
    107122        bool operator==(Node) const { return true; }
    108123
    109124        /// Inequality operator
    110125
    111         /// \sa operator==(Node n)
    112         ///
     126        /// Inequality operator.
    113127        bool operator!=(Node) const { return true; }
    114128
    115129        /// Artificial ordering operator.
    116130
    117         /// To allow the use of graph descriptors as key type in std::map or
    118         /// similar associative container we require this.
    119         ///
    120         /// \note This operator only have to define some strict ordering of
     131        /// Artificial ordering operator.
     132        ///
     133        /// \note This operator only has to define some strict ordering of
    121134        /// the items; this order has nothing to do with the iteration
    122135        /// ordering of the items.
     
    125138      };
    126139
    127       /// This iterator goes through each node.
    128 
    129       /// This iterator goes through each node.
     140      /// Iterator class for the nodes.
     141
     142      /// This iterator goes through each node of the graph.
    130143      /// Its usage is quite simple, for example you can count the number
    131       /// of nodes in graph \c g of type \c Graph like this:
     144      /// of nodes in a graph \c g of type \c %Graph like this:
    132145      ///\code
    133146      /// int count=0;
     
    138151        /// Default constructor
    139152
    140         /// @warning The default constructor sets the iterator
    141         /// to an undefined value.
     153        /// Default constructor.
     154        /// \warning It sets the iterator to an undefined value.
    142155        NodeIt() { }
    143156        /// Copy constructor.
     
    146159        ///
    147160        NodeIt(const NodeIt& n) : Node(n) { }
    148         /// Invalid constructor \& conversion.
    149 
    150         /// Initialize the iterator to be invalid.
     161        /// %Invalid constructor \& conversion.
     162
     163        /// Initializes the iterator to be invalid.
    151164        /// \sa Invalid for more details.
    152165        NodeIt(Invalid) { }
    153166        /// Sets the iterator to the first node.
    154167
    155         /// Sets the iterator to the first node of \c g.
    156         ///
    157         NodeIt(const Graph&) { }
    158         /// Node -> NodeIt conversion.
    159 
    160         /// Sets the iterator to the node of \c the graph pointed by
    161         /// the trivial iterator.
    162         /// This feature necessitates that each time we
    163         /// iterate the arc-set, the iteration order is the same.
     168        /// Sets the iterator to the first node of the given digraph.
     169        ///
     170        explicit NodeIt(const Graph&) { }
     171        /// Sets the iterator to the given node.
     172
     173        /// Sets the iterator to the given node of the given digraph.
     174        ///
    164175        NodeIt(const Graph&, const Node&) { }
    165176        /// Next node.
     
    171182
    172183
    173       /// The base type of the edge iterators.
    174 
    175       /// The base type of the edge iterators.
    176       ///
     184      /// The edge type of the graph
     185
     186      /// This class identifies an edge of the graph. It also serves
     187      /// as a base class of the edge iterators,
     188      /// thus they will convert to this type.
    177189      class Edge {
    178190      public:
    179191        /// Default constructor
    180192
    181         /// @warning The default constructor sets the iterator
    182         /// to an undefined value.
     193        /// Default constructor.
     194        /// \warning It sets the object to an undefined value.
    183195        Edge() { }
    184196        /// Copy constructor.
     
    187199        ///
    188200        Edge(const Edge&) { }
    189         /// Initialize the iterator to be invalid.
    190 
    191         /// Initialize the iterator to be invalid.
    192         ///
     201        /// %Invalid constructor \& conversion.
     202
     203        /// Initializes the object to be invalid.
     204        /// \sa Invalid for more details.
    193205        Edge(Invalid) { }
    194206        /// Equality operator
    195207
     208        /// Equality operator.
     209        ///
    196210        /// Two iterators are equal if and only if they point to the
    197         /// same object or both are invalid.
     211        /// same object or both are \c INVALID.
    198212        bool operator==(Edge) const { return true; }
    199213        /// Inequality operator
    200214
    201         /// \sa operator==(Edge n)
    202         ///
     215        /// Inequality operator.
    203216        bool operator!=(Edge) const { return true; }
    204217
    205218        /// Artificial ordering operator.
    206219
    207         /// To allow the use of graph descriptors as key type in std::map or
    208         /// similar associative container we require this.
    209         ///
    210         /// \note This operator only have to define some strict ordering of
    211         /// the items; this order has nothing to do with the iteration
    212         /// ordering of the items.
     220        /// Artificial ordering operator.
     221        ///
     222        /// \note This operator only has to define some strict ordering of
     223        /// the edges; this order has nothing to do with the iteration
     224        /// ordering of the edges.
    213225        bool operator<(Edge) const { return false; }
    214226      };
    215227
    216       /// This iterator goes through each edge.
    217 
    218       /// This iterator goes through each edge of a graph.
     228      /// Iterator class for the edges.
     229
     230      /// This iterator goes through each edge of the graph.
    219231      /// Its usage is quite simple, for example you can count the number
    220       /// of edges in a graph \c g of type \c Graph as follows:
     232      /// of edges in a graph \c g of type \c %Graph as follows:
    221233      ///\code
    222234      /// int count=0;
     
    227239        /// Default constructor
    228240
    229         /// @warning The default constructor sets the iterator
    230         /// to an undefined value.
     241        /// Default constructor.
     242        /// \warning It sets the iterator to an undefined value.
    231243        EdgeIt() { }
    232244        /// Copy constructor.
     
    235247        ///
    236248        EdgeIt(const EdgeIt& e) : Edge(e) { }
    237         /// Initialize the iterator to be invalid.
    238 
    239         /// Initialize the iterator to be invalid.
    240         ///
     249        /// %Invalid constructor \& conversion.
     250
     251        /// Initializes the iterator to be invalid.
     252        /// \sa Invalid for more details.
    241253        EdgeIt(Invalid) { }
    242         /// This constructor sets the iterator to the first edge.
    243 
    244         /// This constructor sets the iterator to the first edge.
    245         EdgeIt(const Graph&) { }
    246         /// Edge -> EdgeIt conversion
    247 
    248         /// Sets the iterator to the value of the trivial iterator.
    249         /// This feature necessitates that each time we
    250         /// iterate the edge-set, the iteration order is the
    251         /// same.
     254        /// Sets the iterator to the first edge.
     255
     256        /// Sets the iterator to the first edge of the given graph.
     257        ///
     258        explicit EdgeIt(const Graph&) { }
     259        /// Sets the iterator to the given edge.
     260
     261        /// Sets the iterator to the given edge of the given graph.
     262        ///
    252263        EdgeIt(const Graph&, const Edge&) { }
    253264        /// Next edge
    254265
    255266        /// Assign the iterator to the next edge.
     267        ///
    256268        EdgeIt& operator++() { return *this; }
    257269      };
    258270
    259       /// \brief This iterator goes trough the incident undirected
    260       /// arcs of a node.
    261       ///
    262       /// This iterator goes trough the incident edges
    263       /// of a certain node of a graph. You should assume that the
    264       /// loop arcs will be iterated twice.
    265       ///
     271      /// Iterator class for the incident edges of a node.
     272
     273      /// This iterator goes trough the incident undirected edges
     274      /// of a certain node of a graph.
    266275      /// Its usage is quite simple, for example you can compute the
    267       /// degree (i.e. count the number of incident arcs of a node \c n
    268       /// in graph \c g of type \c Graph as follows.
     276      /// degree (i.e. the number of incident edges) of a node \c n
     277      /// in a graph \c g of type \c %Graph as follows.
    269278      ///
    270279      ///\code
     
    272281      /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
    273282      ///\endcode
     283      ///
     284      /// \warning Loop edges will be iterated twice.
    274285      class IncEdgeIt : public Edge {
    275286      public:
    276287        /// Default constructor
    277288
    278         /// @warning The default constructor sets the iterator
    279         /// to an undefined value.
     289        /// Default constructor.
     290        /// \warning It sets the iterator to an undefined value.
    280291        IncEdgeIt() { }
    281292        /// Copy constructor.
     
    284295        ///
    285296        IncEdgeIt(const IncEdgeIt& e) : Edge(e) { }
    286         /// Initialize the iterator to be invalid.
    287 
    288         /// Initialize the iterator to be invalid.
    289         ///
     297        /// %Invalid constructor \& conversion.
     298
     299        /// Initializes the iterator to be invalid.
     300        /// \sa Invalid for more details.
    290301        IncEdgeIt(Invalid) { }
    291         /// This constructor sets the iterator to first incident arc.
    292 
    293         /// This constructor set the iterator to the first incident arc of
    294         /// the node.
     302        /// Sets the iterator to the first incident edge.
     303
     304        /// Sets the iterator to the first incident edge of the given node.
     305        ///
    295306        IncEdgeIt(const Graph&, const Node&) { }
    296         /// Edge -> IncEdgeIt conversion
    297 
    298         /// Sets the iterator to the value of the trivial iterator \c e.
    299         /// This feature necessitates that each time we
    300         /// iterate the arc-set, the iteration order is the same.
     307        /// Sets the iterator to the given edge.
     308
     309        /// Sets the iterator to the given edge of the given graph.
     310        ///
    301311        IncEdgeIt(const Graph&, const Edge&) { }
    302         /// Next incident arc
    303 
    304         /// Assign the iterator to the next incident arc
     312        /// Next incident edge
     313
     314        /// Assign the iterator to the next incident edge
    305315        /// of the corresponding node.
    306316        IncEdgeIt& operator++() { return *this; }
    307317      };
    308318
    309       /// The directed arc type.
    310 
    311       /// The directed arc type. It can be converted to the
    312       /// edge or it should be inherited from the undirected
    313       /// edge.
     319      /// The arc type of the graph
     320
     321      /// This class identifies a directed arc of the graph. It also serves
     322      /// as a base class of the arc iterators,
     323      /// thus they will convert to this type.
    314324      class Arc {
    315325      public:
    316326        /// Default constructor
    317327
    318         /// @warning The default constructor sets the iterator
    319         /// to an undefined value.
     328        /// Default constructor.
     329        /// \warning It sets the object to an undefined value.
    320330        Arc() { }
    321331        /// Copy constructor.
     
    324334        ///
    325335        Arc(const Arc&) { }
    326         /// Initialize the iterator to be invalid.
    327 
    328         /// Initialize the iterator to be invalid.
    329         ///
     336        /// %Invalid constructor \& conversion.
     337
     338        /// Initializes the object to be invalid.
     339        /// \sa Invalid for more details.
    330340        Arc(Invalid) { }
    331341        /// Equality operator
    332342
     343        /// Equality operator.
     344        ///
    333345        /// Two iterators are equal if and only if they point to the
    334         /// same object or both are invalid.
     346        /// same object or both are \c INVALID.
    335347        bool operator==(Arc) const { return true; }
    336348        /// Inequality operator
    337349
    338         /// \sa operator==(Arc n)
    339         ///
     350        /// Inequality operator.
    340351        bool operator!=(Arc) const { return true; }
    341352
    342353        /// Artificial ordering operator.
    343354
    344         /// To allow the use of graph descriptors as key type in std::map or
    345         /// similar associative container we require this.
    346         ///
    347         /// \note This operator only have to define some strict ordering of
    348         /// the items; this order has nothing to do with the iteration
    349         /// ordering of the items.
     355        /// Artificial ordering operator.
     356        ///
     357        /// \note This operator only has to define some strict ordering of
     358        /// the arcs; this order has nothing to do with the iteration
     359        /// ordering of the arcs.
    350360        bool operator<(Arc) const { return false; }
    351361
    352         /// Converison to Edge
     362        /// Converison to \c Edge
     363       
     364        /// Converison to \c Edge.
     365        ///
    353366        operator Edge() const { return Edge(); }
    354367      };
    355       /// This iterator goes through each directed arc.
    356 
    357       /// This iterator goes through each arc of a graph.
     368
     369      /// Iterator class for the arcs.
     370
     371      /// This iterator goes through each directed arc of the graph.
    358372      /// Its usage is quite simple, for example you can count the number
    359       /// of arcs in a graph \c g of type \c Graph as follows:
     373      /// of arcs in a graph \c g of type \c %Graph as follows:
    360374      ///\code
    361375      /// int count=0;
    362       /// for(Graph::ArcIt e(g); e!=INVALID; ++e) ++count;
     376      /// for(Graph::ArcIt a(g); a!=INVALID; ++a) ++count;
    363377      ///\endcode
    364378      class ArcIt : public Arc {
     
    366380        /// Default constructor
    367381
    368         /// @warning The default constructor sets the iterator
    369         /// to an undefined value.
     382        /// Default constructor.
     383        /// \warning It sets the iterator to an undefined value.
    370384        ArcIt() { }
    371385        /// Copy constructor.
     
    374388        ///
    375389        ArcIt(const ArcIt& e) : Arc(e) { }
    376         /// Initialize the iterator to be invalid.
    377 
    378         /// Initialize the iterator to be invalid.
    379         ///
     390        /// %Invalid constructor \& conversion.
     391
     392        /// Initializes the iterator to be invalid.
     393        /// \sa Invalid for more details.
    380394        ArcIt(Invalid) { }
    381         /// This constructor sets the iterator to the first arc.
    382 
    383         /// This constructor sets the iterator to the first arc of \c g.
    384         ///@param g the graph
    385         ArcIt(const Graph &g) { ignore_unused_variable_warning(g); }
    386         /// Arc -> ArcIt conversion
    387 
    388         /// Sets the iterator to the value of the trivial iterator \c e.
    389         /// This feature necessitates that each time we
    390         /// iterate the arc-set, the iteration order is the same.
     395        /// Sets the iterator to the first arc.
     396
     397        /// Sets the iterator to the first arc of the given graph.
     398        ///
     399        explicit ArcIt(const Graph &g) { ignore_unused_variable_warning(g); }
     400        /// Sets the iterator to the given arc.
     401
     402        /// Sets the iterator to the given arc of the given graph.
     403        ///
    391404        ArcIt(const Graph&, const Arc&) { }
    392         ///Next arc
     405        /// Next arc
    393406
    394407        /// Assign the iterator to the next arc.
     408        ///
    395409        ArcIt& operator++() { return *this; }
    396410      };
    397411
    398       /// This iterator goes trough the outgoing directed arcs of a node.
    399 
    400       /// This iterator goes trough the \e outgoing arcs of a certain node
    401       /// of a graph.
     412      /// Iterator class for the outgoing arcs of a node.
     413
     414      /// This iterator goes trough the \e outgoing directed arcs of a
     415      /// certain node of a graph.
    402416      /// Its usage is quite simple, for example you can count the number
    403417      /// of outgoing arcs of a node \c n
    404       /// in graph \c g of type \c Graph as follows.
     418      /// in a graph \c g of type \c %Graph as follows.
    405419      ///\code
    406420      /// int count=0;
    407       /// for (Graph::OutArcIt e(g, n); e!=INVALID; ++e) ++count;
     421      /// for (Digraph::OutArcIt a(g, n); a!=INVALID; ++a) ++count;
    408422      ///\endcode
    409 
    410423      class OutArcIt : public Arc {
    411424      public:
    412425        /// Default constructor
    413426
    414         /// @warning The default constructor sets the iterator
    415         /// to an undefined value.
     427        /// Default constructor.
     428        /// \warning It sets the iterator to an undefined value.
    416429        OutArcIt() { }
    417430        /// Copy constructor.
     
    420433        ///
    421434        OutArcIt(const OutArcIt& e) : Arc(e) { }
    422         /// Initialize the iterator to be invalid.
    423 
    424         /// Initialize the iterator to be invalid.
    425         ///
     435        /// %Invalid constructor \& conversion.
     436
     437        /// Initializes the iterator to be invalid.
     438        /// \sa Invalid for more details.
    426439        OutArcIt(Invalid) { }
    427         /// This constructor sets the iterator to the first outgoing arc.
    428 
    429         /// This constructor sets the iterator to the first outgoing arc of
    430         /// the node.
    431         ///@param n the node
    432         ///@param g the graph
     440        /// Sets the iterator to the first outgoing arc.
     441
     442        /// Sets the iterator to the first outgoing arc of the given node.
     443        ///
    433444        OutArcIt(const Graph& n, const Node& g) {
    434445          ignore_unused_variable_warning(n);
    435446          ignore_unused_variable_warning(g);
    436447        }
    437         /// Arc -> OutArcIt conversion
    438 
    439         /// Sets the iterator to the value of the trivial iterator.
    440         /// This feature necessitates that each time we
    441         /// iterate the arc-set, the iteration order is the same.
     448        /// Sets the iterator to the given arc.
     449
     450        /// Sets the iterator to the given arc of the given graph.
     451        ///
    442452        OutArcIt(const Graph&, const Arc&) { }
    443         ///Next outgoing arc
     453        /// Next outgoing arc
    444454
    445455        /// Assign the iterator to the next
     
    448458      };
    449459
    450       /// This iterator goes trough the incoming directed arcs of a node.
    451 
    452       /// This iterator goes trough the \e incoming arcs of a certain node
    453       /// of a graph.
     460      /// Iterator class for the incoming arcs of a node.
     461
     462      /// This iterator goes trough the \e incoming directed arcs of a
     463      /// certain node of a graph.
    454464      /// Its usage is quite simple, for example you can count the number
    455       /// of outgoing arcs of a node \c n
    456       /// in graph \c g of type \c Graph as follows.
     465      /// of incoming arcs of a node \c n
     466      /// in a graph \c g of type \c %Graph as follows.
    457467      ///\code
    458468      /// int count=0;
    459       /// for(Graph::InArcIt e(g, n); e!=INVALID; ++e) ++count;
     469      /// for (Digraph::InArcIt a(g, n); a!=INVALID; ++a) ++count;
    460470      ///\endcode
    461 
    462471      class InArcIt : public Arc {
    463472      public:
    464473        /// Default constructor
    465474
    466         /// @warning The default constructor sets the iterator
    467         /// to an undefined value.
     475        /// Default constructor.
     476        /// \warning It sets the iterator to an undefined value.
    468477        InArcIt() { }
    469478        /// Copy constructor.
     
    472481        ///
    473482        InArcIt(const InArcIt& e) : Arc(e) { }
    474         /// Initialize the iterator to be invalid.
    475 
    476         /// Initialize the iterator to be invalid.
    477         ///
     483        /// %Invalid constructor \& conversion.
     484
     485        /// Initializes the iterator to be invalid.
     486        /// \sa Invalid for more details.
    478487        InArcIt(Invalid) { }
    479         /// This constructor sets the iterator to first incoming arc.
    480 
    481         /// This constructor set the iterator to the first incoming arc of
    482         /// the node.
    483         ///@param n the node
    484         ///@param g the graph
     488        /// Sets the iterator to the first incoming arc.
     489
     490        /// Sets the iterator to the first incoming arc of the given node.
     491        ///
    485492        InArcIt(const Graph& g, const Node& n) {
    486493          ignore_unused_variable_warning(n);
    487494          ignore_unused_variable_warning(g);
    488495        }
    489         /// Arc -> InArcIt conversion
    490 
    491         /// Sets the iterator to the value of the trivial iterator \c e.
    492         /// This feature necessitates that each time we
    493         /// iterate the arc-set, the iteration order is the same.
     496        /// Sets the iterator to the given arc.
     497
     498        /// Sets the iterator to the given arc of the given graph.
     499        ///
    494500        InArcIt(const Graph&, const Arc&) { }
    495501        /// Next incoming arc
    496502
    497         /// Assign the iterator to the next inarc of the corresponding node.
    498         ///
     503        /// Assign the iterator to the next
     504        /// incoming arc of the corresponding node.
    499505        InArcIt& operator++() { return *this; }
    500506      };
    501507
    502       /// \brief Reference map of the nodes to type \c T.
    503       ///
    504       /// Reference map of the nodes to type \c T.
     508      /// \brief Standard graph map type for the nodes.
     509      ///
     510      /// Standard graph map type for the nodes.
     511      /// It conforms to the ReferenceMap concept.
    505512      template<class T>
    506513      class NodeMap : public ReferenceMap<Node, T, T&, const T&>
     
    508515      public:
    509516
    510         ///\e
    511         NodeMap(const Graph&) { }
    512         ///\e
     517        /// Constructor
     518        explicit NodeMap(const Graph&) { }
     519        /// Constructor with given initial value
    513520        NodeMap(const Graph&, T) { }
    514521
     
    525532      };
    526533
    527       /// \brief Reference map of the arcs to type \c T.
    528       ///
    529       /// Reference map of the arcs to type \c T.
     534      /// \brief Standard graph map type for the arcs.
     535      ///
     536      /// Standard graph map type for the arcs.
     537      /// It conforms to the ReferenceMap concept.
    530538      template<class T>
    531539      class ArcMap : public ReferenceMap<Arc, T, T&, const T&>
     
    533541      public:
    534542
    535         ///\e
    536         ArcMap(const Graph&) { }
    537         ///\e
     543        /// Constructor
     544        explicit ArcMap(const Graph&) { }
     545        /// Constructor with given initial value
    538546        ArcMap(const Graph&, T) { }
     547
    539548      private:
    540549        ///Copy constructor
     
    549558      };
    550559
    551       /// Reference map of the edges to type \c T.
    552 
    553       /// Reference map of the edges to type \c T.
     560      /// \brief Standard graph map type for the edges.
     561      ///
     562      /// Standard graph map type for the edges.
     563      /// It conforms to the ReferenceMap concept.
    554564      template<class T>
    555565      class EdgeMap : public ReferenceMap<Edge, T, T&, const T&>
     
    557567      public:
    558568
    559         ///\e
    560         EdgeMap(const Graph&) { }
    561         ///\e
     569        /// Constructor
     570        explicit EdgeMap(const Graph&) { }
     571        /// Constructor with given initial value
    562572        EdgeMap(const Graph&, T) { }
     573
    563574      private:
    564575        ///Copy constructor
     
    573584      };
    574585
    575       /// \brief Direct the given edge.
    576       ///
    577       /// Direct the given edge. The returned arc source
    578       /// will be the given node.
    579       Arc direct(const Edge&, const Node&) const {
    580         return INVALID;
    581       }
    582 
    583       /// \brief Direct the given edge.
    584       ///
    585       /// Direct the given edge. The returned arc
    586       /// represents the given edge and the direction comes
    587       /// from the bool parameter. The source of the edge and
    588       /// the directed arc is the same when the given bool is true.
    589       Arc direct(const Edge&, bool) const {
    590         return INVALID;
    591       }
    592 
    593       /// \brief Returns true if the arc has default orientation.
    594       ///
    595       /// Returns whether the given directed arc is same orientation as
    596       /// the corresponding edge's default orientation.
    597       bool direction(Arc) const { return true; }
    598 
    599       /// \brief Returns the opposite directed arc.
    600       ///
    601       /// Returns the opposite directed arc.
    602       Arc oppositeArc(Arc) const { return INVALID; }
    603 
    604       /// \brief Opposite node on an arc
    605       ///
    606       /// \return The opposite of the given node on the given edge.
    607       Node oppositeNode(Node, Edge) const { return INVALID; }
    608 
    609       /// \brief First node of the edge.
    610       ///
    611       /// \return The first node of the given edge.
    612       ///
    613       /// Naturally edges don't have direction and thus
    614       /// don't have source and target node. However we use \c u() and \c v()
    615       /// methods to query the two nodes of the arc. The direction of the
    616       /// arc which arises this way is called the inherent direction of the
    617       /// edge, and is used to define the "default" direction
    618       /// of the directed versions of the arcs.
     586      /// \brief The first node of the edge.
     587      ///
     588      /// Returns the first node of the given edge.
     589      ///
     590      /// Edges don't have source and target nodes, however methods
     591      /// u() and v() are used to query the two end-nodes of an edge.
     592      /// The orientation of an edge that arises this way is called
     593      /// the inherent direction, it is used to define the default
     594      /// direction for the corresponding arcs.
    619595      /// \sa v()
    620596      /// \sa direction()
    621597      Node u(Edge) const { return INVALID; }
    622598
    623       /// \brief Second node of the edge.
    624       ///
    625       /// \return The second node of the given edge.
    626       ///
    627       /// Naturally edges don't have direction and thus
    628       /// don't have source and target node. However we use \c u() and \c v()
    629       /// methods to query the two nodes of the arc. The direction of the
    630       /// arc which arises this way is called the inherent direction of the
    631       /// edge, and is used to define the "default" direction
    632       /// of the directed versions of the arcs.
     599      /// \brief The second node of the edge.
     600      ///
     601      /// Returns the second node of the given edge.
     602      ///
     603      /// Edges don't have source and target nodes, however methods
     604      /// u() and v() are used to query the two end-nodes of an edge.
     605      /// The orientation of an edge that arises this way is called
     606      /// the inherent direction, it is used to define the default
     607      /// direction for the corresponding arcs.
    633608      /// \sa u()
    634609      /// \sa direction()
    635610      Node v(Edge) const { return INVALID; }
    636611
    637       /// \brief Source node of the directed arc.
     612      /// \brief The source node of the arc.
     613      ///
     614      /// Returns the source node of the given arc.
    638615      Node source(Arc) const { return INVALID; }
    639616
    640       /// \brief Target node of the directed arc.
     617      /// \brief The target node of the arc.
     618      ///
     619      /// Returns the target node of the given arc.
    641620      Node target(Arc) const { return INVALID; }
    642621
    643       /// \brief Returns the id of the node.
     622      /// \brief The ID of the node.
     623      ///
     624      /// Returns the ID of the given node.
    644625      int id(Node) const { return -1; }
    645626
    646       /// \brief Returns the id of the edge.
     627      /// \brief The ID of the edge.
     628      ///
     629      /// Returns the ID of the given edge.
    647630      int id(Edge) const { return -1; }
    648631
    649       /// \brief Returns the id of the arc.
     632      /// \brief The ID of the arc.
     633      ///
     634      /// Returns the ID of the given arc.
    650635      int id(Arc) const { return -1; }
    651636
    652       /// \brief Returns the node with the given id.
    653       ///
    654       /// \pre The argument should be a valid node id in the graph.
     637      /// \brief The node with the given ID.
     638      ///
     639      /// Returns the node with the given ID.
     640      /// \pre The argument should be a valid node ID in the graph.
    655641      Node nodeFromId(int) const { return INVALID; }
    656642
    657       /// \brief Returns the edge with the given id.
    658       ///
    659       /// \pre The argument should be a valid edge id in the graph.
     643      /// \brief The edge with the given ID.
     644      ///
     645      /// Returns the edge with the given ID.
     646      /// \pre The argument should be a valid edge ID in the graph.
    660647      Edge edgeFromId(int) const { return INVALID; }
    661648
    662       /// \brief Returns the arc with the given id.
    663       ///
    664       /// \pre The argument should be a valid arc id in the graph.
     649      /// \brief The arc with the given ID.
     650      ///
     651      /// Returns the arc with the given ID.
     652      /// \pre The argument should be a valid arc ID in the graph.
    665653      Arc arcFromId(int) const { return INVALID; }
    666654
    667       /// \brief Returns an upper bound on the node IDs.
     655      /// \brief An upper bound on the node IDs.
     656      ///
     657      /// Returns an upper bound on the node IDs.
    668658      int maxNodeId() const { return -1; }
    669659
    670       /// \brief Returns an upper bound on the edge IDs.
     660      /// \brief An upper bound on the edge IDs.
     661      ///
     662      /// Returns an upper bound on the edge IDs.
    671663      int maxEdgeId() const { return -1; }
    672664
    673       /// \brief Returns an upper bound on the arc IDs.
     665      /// \brief An upper bound on the arc IDs.
     666      ///
     667      /// Returns an upper bound on the arc IDs.
    674668      int maxArcId() const { return -1; }
     669
     670      /// \brief The direction of the arc.
     671      ///
     672      /// Returns \c true if the direction of the given arc is the same as
     673      /// the inherent orientation of the represented edge.
     674      bool direction(Arc) const { return true; }
     675
     676      /// \brief Direct the edge.
     677      ///
     678      /// Direct the given edge. The returned arc
     679      /// represents the given edge and its direction comes
     680      /// from the bool parameter. If it is \c true, then the direction
     681      /// of the arc is the same as the inherent orientation of the edge.
     682      Arc direct(Edge, bool) const {
     683        return INVALID;
     684      }
     685
     686      /// \brief Direct the edge.
     687      ///
     688      /// Direct the given edge. The returned arc represents the given
     689      /// edge and its source node is the given node.
     690      Arc direct(Edge, Node) const {
     691        return INVALID;
     692      }
     693
     694      /// \brief The oppositely directed arc.
     695      ///
     696      /// Returns the oppositely directed arc representing the same edge.
     697      Arc oppositeArc(Arc) const { return INVALID; }
     698
     699      /// \brief The opposite node on the edge.
     700      ///
     701      /// Returns the opposite node on the given edge.
     702      Node oppositeNode(Node, Edge) const { return INVALID; }
    675703
    676704      void first(Node&) const {}
     
    706734      int maxId(Arc) const { return -1; }
    707735
    708       /// \brief Base node of the iterator
    709       ///
    710       /// Returns the base node (the source in this case) of the iterator
    711       Node baseNode(OutArcIt e) const {
    712         return source(e);
    713       }
    714       /// \brief Running node of the iterator
    715       ///
    716       /// Returns the running node (the target in this case) of the
    717       /// iterator
    718       Node runningNode(OutArcIt e) const {
    719         return target(e);
    720       }
    721 
    722       /// \brief Base node of the iterator
    723       ///
    724       /// Returns the base node (the target in this case) of the iterator
    725       Node baseNode(InArcIt e) const {
    726         return target(e);
    727       }
    728       /// \brief Running node of the iterator
    729       ///
    730       /// Returns the running node (the source in this case) of the
    731       /// iterator
    732       Node runningNode(InArcIt e) const {
    733         return source(e);
    734       }
    735 
    736       /// \brief Base node of the iterator
    737       ///
    738       /// Returns the base node of the iterator
    739       Node baseNode(IncEdgeIt) const {
    740         return INVALID;
    741       }
    742 
    743       /// \brief Running node of the iterator
    744       ///
    745       /// Returns the running node of the iterator
    746       Node runningNode(IncEdgeIt) const {
    747         return INVALID;
    748       }
     736      /// \brief The base node of the iterator.
     737      ///
     738      /// Returns the base node of the given incident edge iterator.
     739      Node baseNode(IncEdgeIt) const { return INVALID; }
     740
     741      /// \brief The running node of the iterator.
     742      ///
     743      /// Returns the running node of the given incident edge iterator.
     744      Node runningNode(IncEdgeIt) const { return INVALID; }
     745
     746      /// \brief The base node of the iterator.
     747      ///
     748      /// Returns the base node of the given outgoing arc iterator
     749      /// (i.e. the source node of the corresponding arc).
     750      Node baseNode(OutArcIt) const { return INVALID; }
     751
     752      /// \brief The running node of the iterator.
     753      ///
     754      /// Returns the running node of the given outgoing arc iterator
     755      /// (i.e. the target node of the corresponding arc).
     756      Node runningNode(OutArcIt) const { return INVALID; }
     757
     758      /// \brief The base node of the iterator.
     759      ///
     760      /// Returns the base node of the given incomming arc iterator
     761      /// (i.e. the target node of the corresponding arc).
     762      Node baseNode(InArcIt) const { return INVALID; }
     763
     764      /// \brief The running node of the iterator.
     765      ///
     766      /// Returns the running node of the given incomming arc iterator
     767      /// (i.e. the source node of the corresponding arc).
     768      Node runningNode(InArcIt) const { return INVALID; }
    749769
    750770      template <typename _Graph>
  • lemon/concepts/graph_components.h

    r666 r734  
    9393      /// associative containers (e.g. \c std::map).
    9494      ///
    95       /// \note This operator only have to define some strict ordering of
     95      /// \note This operator only has to define some strict ordering of
    9696      /// the items; this order has nothing to do with the iteration
    9797      /// ordering of the items.
  • lemon/full_graph.h

    r617 r735  
    2525///\ingroup graphs
    2626///\file
    27 ///\brief FullGraph and FullDigraph classes.
     27///\brief FullDigraph and FullGraph classes.
    2828
    2929namespace lemon {
     
    149149  /// \ingroup graphs
    150150  ///
    151   /// \brief A full digraph class.
    152   ///
    153   /// This is a simple and fast directed full graph implementation.
    154   /// From each node go arcs to each node (including the source node),
    155   /// therefore the number of the arcs in the digraph is the square of
    156   /// the node number. This digraph type is completely static, so you
    157   /// can neither add nor delete either arcs or nodes, and it needs
    158   /// constant space in memory.
    159   ///
    160   /// This class fully conforms to the \ref concepts::Digraph
    161   /// "Digraph concept".
    162   ///
    163   /// The \c FullDigraph and \c FullGraph classes are very similar,
     151  /// \brief A directed full graph class.
     152  ///
     153  /// FullDigraph is a simple and fast implmenetation of directed full
     154  /// (complete) graphs. It contains an arc from each node to each node
     155  /// (including a loop for each node), therefore the number of arcs
     156  /// is the square of the number of nodes.
     157  /// This class is completely static and it needs constant memory space.
     158  /// Thus you can neither add nor delete nodes or arcs, however
     159  /// the structure can be resized using resize().
     160  ///
     161  /// This type fully conforms to the \ref concepts::Digraph "Digraph concept".
     162  /// Most of its member functions and nested classes are documented
     163  /// only in the concept class.
     164  ///
     165  /// \note FullDigraph and FullGraph classes are very similar,
    164166  /// but there are two differences. While this class conforms only
    165   /// to the \ref concepts::Digraph "Digraph" concept, the \c FullGraph
    166   /// class conforms to the \ref concepts::Graph "Graph" concept,
    167   /// moreover \c FullGraph does not contain a loop arc for each
    168   /// node as \c FullDigraph does.
     167  /// to the \ref concepts::Digraph "Digraph" concept, FullGraph
     168  /// conforms to the \ref concepts::Graph "Graph" concept,
     169  /// moreover FullGraph does not contain a loop for each
     170  /// node as this class does.
    169171  ///
    170172  /// \sa FullGraph
     
    174176  public:
    175177
    176     /// \brief Constructor
     178    /// \brief Default constructor.
     179    ///
     180    /// Default constructor. The number of nodes and arcs will be zero.
    177181    FullDigraph() { construct(0); }
    178182
     
    185189    /// \brief Resizes the digraph
    186190    ///
    187     /// Resizes the digraph. The function will fully destroy and
    188     /// rebuild the digraph. This cause that the maps of the digraph will
     191    /// This function resizes the digraph. It fully destroys and
     192    /// rebuilds the structure, therefore the maps of the digraph will be
    189193    /// reallocated automatically and the previous values will be lost.
    190194    void resize(int n) {
     
    198202    /// \brief Returns the node with the given index.
    199203    ///
    200     /// Returns the node with the given index. Since it is a static
    201     /// digraph its nodes can be indexed with integers from the range
    202     /// <tt>[0..nodeNum()-1]</tt>.
     204    /// Returns the node with the given index. Since this structure is
     205    /// completely static, the nodes can be indexed with integers from
     206    /// the range <tt>[0..nodeNum()-1]</tt>.
    203207    /// \sa index()
    204208    Node operator()(int ix) const { return Parent::operator()(ix); }
     
    206210    /// \brief Returns the index of the given node.
    207211    ///
    208     /// Returns the index of the given node. Since it is a static
    209     /// digraph its nodes can be indexed with integers from the range
    210     /// <tt>[0..nodeNum()-1]</tt>.
    211     /// \sa operator()
    212     int index(const Node& node) const { return Parent::index(node); }
     212    /// Returns the index of the given node. Since this structure is
     213    /// completely static, the nodes can be indexed with integers from
     214    /// the range <tt>[0..nodeNum()-1]</tt>.
     215    /// \sa operator()()
     216    int index(Node node) const { return Parent::index(node); }
    213217
    214218    /// \brief Returns the arc connecting the given nodes.
    215219    ///
    216220    /// Returns the arc connecting the given nodes.
    217     Arc arc(const Node& u, const Node& v) const {
     221    Arc arc(Node u, Node v) const {
    218222      return Parent::arc(u, v);
    219223    }
     
    521525  /// \brief An undirected full graph class.
    522526  ///
    523   /// This is a simple and fast undirected full graph
    524   /// implementation. From each node go edge to each other node,
    525   /// therefore the number of edges in the graph is \f$n(n-1)/2\f$.
    526   /// This graph type is completely static, so you can neither
    527   /// add nor delete either edges or nodes, and it needs constant
    528   /// space in memory.
    529   ///
    530   /// This class fully conforms to the \ref concepts::Graph "Graph concept".
    531   ///
    532   /// The \c FullGraph and \c FullDigraph classes are very similar,
    533   /// but there are two differences. While the \c FullDigraph class
     527  /// FullGraph is a simple and fast implmenetation of undirected full
     528  /// (complete) graphs. It contains an edge between every distinct pair
     529  /// of nodes, therefore the number of edges is <tt>n(n-1)/2</tt>.
     530  /// This class is completely static and it needs constant memory space.
     531  /// Thus you can neither add nor delete nodes or edges, however
     532  /// the structure can be resized using resize().
     533  ///
     534  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
     535  /// Most of its member functions and nested classes are documented
     536  /// only in the concept class.
     537  ///
     538  /// \note FullDigraph and FullGraph classes are very similar,
     539  /// but there are two differences. While FullDigraph
    534540  /// conforms only to the \ref concepts::Digraph "Digraph" concept,
    535541  /// this class conforms to the \ref concepts::Graph "Graph" concept,
    536   /// moreover \c FullGraph does not contain a loop arc for each
    537   /// node as \c FullDigraph does.
     542  /// moreover this class does not contain a loop for each
     543  /// node as FullDigraph does.
    538544  ///
    539545  /// \sa FullDigraph
     
    543549  public:
    544550
    545     /// \brief Constructor
     551    /// \brief Default constructor.
     552    ///
     553    /// Default constructor. The number of nodes and edges will be zero.
    546554    FullGraph() { construct(0); }
    547555
     
    554562    /// \brief Resizes the graph
    555563    ///
    556     /// Resizes the graph. The function will fully destroy and
    557     /// rebuild the graph. This cause that the maps of the graph will
     564    /// This function resizes the graph. It fully destroys and
     565    /// rebuilds the structure, therefore the maps of the graph will be
    558566    /// reallocated automatically and the previous values will be lost.
    559567    void resize(int n) {
     
    569577    /// \brief Returns the node with the given index.
    570578    ///
    571     /// Returns the node with the given index. Since it is a static
    572     /// graph its nodes can be indexed with integers from the range
    573     /// <tt>[0..nodeNum()-1]</tt>.
     579    /// Returns the node with the given index. Since this structure is
     580    /// completely static, the nodes can be indexed with integers from
     581    /// the range <tt>[0..nodeNum()-1]</tt>.
    574582    /// \sa index()
    575583    Node operator()(int ix) const { return Parent::operator()(ix); }
     
    577585    /// \brief Returns the index of the given node.
    578586    ///
    579     /// Returns the index of the given node. Since it is a static
    580     /// graph its nodes can be indexed with integers from the range
    581     /// <tt>[0..nodeNum()-1]</tt>.
    582     /// \sa operator()
    583     int index(const Node& node) const { return Parent::index(node); }
     587    /// Returns the index of the given node. Since this structure is
     588    /// completely static, the nodes can be indexed with integers from
     589    /// the range <tt>[0..nodeNum()-1]</tt>.
     590    /// \sa operator()()
     591    int index(Node node) const { return Parent::index(node); }
    584592
    585593    /// \brief Returns the arc connecting the given nodes.
    586594    ///
    587595    /// Returns the arc connecting the given nodes.
    588     Arc arc(const Node& s, const Node& t) const {
     596    Arc arc(Node s, Node t) const {
    589597      return Parent::arc(s, t);
    590598    }
    591599
    592     /// \brief Returns the edge connects the given nodes.
    593     ///
    594     /// Returns the edge connects the given nodes.
    595     Edge edge(const Node& u, const Node& v) const {
     600    /// \brief Returns the edge connecting the given nodes.
     601    ///
     602    /// Returns the edge connecting the given nodes.
     603    Edge edge(Node u, Node v) const {
    596604      return Parent::edge(u, v);
    597605    }
  • lemon/grid_graph.h

    r617 r735  
    471471  /// \brief Grid graph class
    472472  ///
    473   /// This class implements a special graph type. The nodes of the
    474   /// graph can be indexed by two integer \c (i,j) value where \c i is
    475   /// in the \c [0..width()-1] range and j is in the \c
    476   /// [0..height()-1] range. Two nodes are connected in the graph if
    477   /// the indexes differ exactly on one position and exactly one is
    478   /// the difference. The nodes of the graph can be indexed by position
    479   /// with the \c operator()() function. The positions of the nodes can be
    480   /// get with \c pos(), \c col() and \c row() members. The outgoing
     473  /// GridGraph implements a special graph type. The nodes of the
     474  /// graph can be indexed by two integer values \c (i,j) where \c i is
     475  /// in the range <tt>[0..width()-1]</tt> and j is in the range
     476  /// <tt>[0..height()-1]</tt>. Two nodes are connected in the graph if
     477  /// the indices differ exactly on one position and the difference is
     478  /// also exactly one. The nodes of the graph can be obtained by position
     479  /// using the \c operator()() function and the indices of the nodes can
     480  /// be obtained using \c pos(), \c col() and \c row() members. The outgoing
    481481  /// arcs can be retrieved with the \c right(), \c up(), \c left()
    482482  /// and \c down() functions, where the bottom-left corner is the
    483483  /// origin.
     484  ///
     485  /// This class is completely static and it needs constant memory space.
     486  /// Thus you can neither add nor delete nodes or edges, however
     487  /// the structure can be resized using resize().
    484488  ///
    485489  /// \image html grid_graph.png
     
    497501  ///\endcode
    498502  ///
    499   /// This graph type fully conforms to the \ref concepts::Graph
    500   /// "Graph concept".
     503  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
     504  /// Most of its member functions and nested classes are documented
     505  /// only in the concept class.
    501506  class GridGraph : public ExtendedGridGraphBase {
    502507    typedef ExtendedGridGraphBase Parent;
     
    504509  public:
    505510
    506     /// \brief Map to get the indices of the nodes as dim2::Point<int>.
    507     ///
    508     /// Map to get the indices of the nodes as dim2::Point<int>.
     511    /// \brief Map to get the indices of the nodes as \ref dim2::Point
     512    /// "dim2::Point<int>".
     513    ///
     514    /// Map to get the indices of the nodes as \ref dim2::Point
     515    /// "dim2::Point<int>".
    509516    class IndexMap {
    510517    public:
     
    515522
    516523      /// \brief Constructor
    517       ///
    518       /// Constructor
    519524      IndexMap(const GridGraph& graph) : _graph(graph) {}
    520525
    521526      /// \brief The subscript operator
    522       ///
    523       /// The subscript operator.
    524527      Value operator[](Key key) const {
    525528        return _graph.pos(key);
     
    541544
    542545      /// \brief Constructor
    543       ///
    544       /// Constructor
    545546      ColMap(const GridGraph& graph) : _graph(graph) {}
    546547
    547548      /// \brief The subscript operator
    548       ///
    549       /// The subscript operator.
    550549      Value operator[](Key key) const {
    551550        return _graph.col(key);
     
    567566
    568567      /// \brief Constructor
    569       ///
    570       /// Constructor
    571568      RowMap(const GridGraph& graph) : _graph(graph) {}
    572569
    573570      /// \brief The subscript operator
    574       ///
    575       /// The subscript operator.
    576571      Value operator[](Key key) const {
    577572        return _graph.row(key);
     
    584579    /// \brief Constructor
    585580    ///
    586     /// Construct a grid graph with given size.
     581    /// Construct a grid graph with the given size.
    587582    GridGraph(int width, int height) { construct(width, height); }
    588583
    589     /// \brief Resize the graph
    590     ///
    591     /// Resize the graph. The function will fully destroy and rebuild
    592     /// the graph.  This cause that the maps of the graph will
    593     /// reallocated automatically and the previous values will be
    594     /// lost.
     584    /// \brief Resizes the graph
     585    ///
     586    /// This function resizes the graph. It fully destroys and
     587    /// rebuilds the structure, therefore the maps of the graph will be
     588    /// reallocated automatically and the previous values will be lost.
    595589    void resize(int width, int height) {
    596590      Parent::notifier(Arc()).clear();
     
    610604    }
    611605
    612     /// \brief Gives back the column index of the node.
     606    /// \brief The column index of the node.
    613607    ///
    614608    /// Gives back the column index of the node.
     
    617611    }
    618612
    619     /// \brief Gives back the row index of the node.
     613    /// \brief The row index of the node.
    620614    ///
    621615    /// Gives back the row index of the node.
     
    624618    }
    625619
    626     /// \brief Gives back the position of the node.
     620    /// \brief The position of the node.
    627621    ///
    628622    /// Gives back the position of the node, ie. the <tt>(col,row)</tt> pair.
     
    631625    }
    632626
    633     /// \brief Gives back the number of the columns.
     627    /// \brief The number of the columns.
    634628    ///
    635629    /// Gives back the number of the columns.
     
    638632    }
    639633
    640     /// \brief Gives back the number of the rows.
     634    /// \brief The number of the rows.
    641635    ///
    642636    /// Gives back the number of the rows.
     
    645639    }
    646640
    647     /// \brief Gives back the arc goes right from the node.
     641    /// \brief The arc goes right from the node.
    648642    ///
    649643    /// Gives back the arc goes right from the node. If there is not
     
    653647    }
    654648
    655     /// \brief Gives back the arc goes left from the node.
     649    /// \brief The arc goes left from the node.
    656650    ///
    657651    /// Gives back the arc goes left from the node. If there is not
     
    661655    }
    662656
    663     /// \brief Gives back the arc goes up from the node.
     657    /// \brief The arc goes up from the node.
    664658    ///
    665659    /// Gives back the arc goes up from the node. If there is not
     
    669663    }
    670664
    671     /// \brief Gives back the arc goes down from the node.
     665    /// \brief The arc goes down from the node.
    672666    ///
    673667    /// Gives back the arc goes down from the node. If there is not
  • lemon/hypercube_graph.h

    r617 r737  
    283283  /// \brief Hypercube graph class
    284284  ///
    285   /// This class implements a special graph type. The nodes of the graph
    286   /// are indiced with integers with at most \c dim binary digits.
     285  /// HypercubeGraph implements a special graph type. The nodes of the
     286  /// graph are indexed with integers having at most \c dim binary digits.
    287287  /// Two nodes are connected in the graph if and only if their indices
    288288  /// differ only on one position in the binary form.
     289  /// This class is completely static and it needs constant memory space.
     290  /// Thus you can neither add nor delete nodes or edges, however
     291  /// the structure can be resized using resize().
     292  ///
     293  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
     294  /// Most of its member functions and nested classes are documented
     295  /// only in the concept class.
    289296  ///
    290297  /// \note The type of the indices is chosen to \c int for efficiency
    291298  /// reasons. Thus the maximum dimension of this implementation is 26
    292299  /// (assuming that the size of \c int is 32 bit).
    293   ///
    294   /// This graph type fully conforms to the \ref concepts::Graph
    295   /// "Graph concept".
    296300  class HypercubeGraph : public ExtendedHypercubeGraphBase {
    297301    typedef ExtendedHypercubeGraphBase Parent;
     
    303307    /// Constructs a hypercube graph with \c dim dimensions.
    304308    HypercubeGraph(int dim) { construct(dim); }
     309
     310    /// \brief Resizes the graph
     311    ///
     312    /// This function resizes the graph. It fully destroys and
     313    /// rebuilds the structure, therefore the maps of the graph will be
     314    /// reallocated automatically and the previous values will be lost.
     315    void resize(int dim) {
     316      Parent::notifier(Arc()).clear();
     317      Parent::notifier(Edge()).clear();
     318      Parent::notifier(Node()).clear();
     319      construct(dim);
     320      Parent::notifier(Node()).build();
     321      Parent::notifier(Edge()).build();
     322      Parent::notifier(Arc()).build();
     323    }
    305324
    306325    /// \brief The number of dimensions.
     
    321340    ///
    322341    /// Gives back the dimension id of the given edge.
    323     /// It is in the [0..dim-1] range.
     342    /// It is in the range <tt>[0..dim-1]</tt>.
    324343    int dimension(Edge edge) const {
    325344      return Parent::dimension(edge);
     
    329348    ///
    330349    /// Gives back the dimension id of the given arc.
    331     /// It is in the [0..dim-1] range.
     350    /// It is in the range <tt>[0..dim-1]</tt>.
    332351    int dimension(Arc arc) const {
    333352      return Parent::dimension(arc);
  • lemon/list_graph.h

    r739 r741  
    2222///\ingroup graphs
    2323///\file
    24 ///\brief ListDigraph, ListGraph classes.
     24///\brief ListDigraph and ListGraph classes.
    2525
    2626#include <lemon/core.h>
     
    3232
    3333namespace lemon {
     34
     35  class ListDigraph;
    3436
    3537  class ListDigraphBase {
     
    6365    class Node {
    6466      friend class ListDigraphBase;
     67      friend class ListDigraph;
    6568    protected:
    6669
     
    7881    class Arc {
    7982      friend class ListDigraphBase;
     83      friend class ListDigraph;
    8084    protected:
    8185
     
    312316  ///A general directed graph structure.
    313317
    314   ///\ref ListDigraph is a simple and fast <em>directed graph</em>
    315   ///implementation based on static linked lists that are stored in
     318  ///\ref ListDigraph is a versatile and fast directed graph
     319  ///implementation based on linked lists that are stored in
    316320  ///\c std::vector structures.
    317321  ///
    318   ///It conforms to the \ref concepts::Digraph "Digraph concept" and it
    319   ///also provides several useful additional functionalities.
    320   ///Most of the member functions and nested classes are documented
     322  ///This type fully conforms to the \ref concepts::Digraph "Digraph concept"
     323  ///and it also provides several useful additional functionalities.
     324  ///Most of its member functions and nested classes are documented
    321325  ///only in the concept class.
    322326  ///
    323327  ///\sa concepts::Digraph
    324 
     328  ///\sa ListGraph
    325329  class ListDigraph : public ExtendedListDigraphBase {
    326330    typedef ExtendedListDigraphBase Parent;
    327331
    328332  private:
    329     ///ListDigraph is \e not copy constructible. Use copyDigraph() instead.
    330 
    331     ///ListDigraph is \e not copy constructible. Use copyDigraph() instead.
    332     ///
     333    /// Digraphs are \e not copy constructible. Use DigraphCopy instead.
    333334    ListDigraph(const ListDigraph &) :ExtendedListDigraphBase() {};
    334     ///\brief Assignment of ListDigraph to another one is \e not allowed.
    335     ///Use copyDigraph() instead.
    336 
    337     ///Assignment of ListDigraph to another one is \e not allowed.
    338     ///Use copyDigraph() instead.
     335    /// \brief Assignment of a digraph to another one is \e not allowed.
     336    /// Use DigraphCopy instead.
    339337    void operator=(const ListDigraph &) {}
    340338  public:
     
    348346    ///Add a new node to the digraph.
    349347
    350     ///Add a new node to the digraph.
     348    ///This function adds a new node to the digraph.
    351349    ///\return The new node.
    352350    Node addNode() { return Parent::addNode(); }
     
    354352    ///Add a new arc to the digraph.
    355353
    356     ///Add a new arc to the digraph with source node \c s
     354    ///This function adds a new arc to the digraph with source node \c s
    357355    ///and target node \c t.
    358356    ///\return The new arc.
    359     Arc addArc(const Node& s, const Node& t) {
     357    Arc addArc(Node s, Node t) {
    360358      return Parent::addArc(s, t);
    361359    }
     
    363361    ///\brief Erase a node from the digraph.
    364362    ///
    365     ///Erase a node from the digraph.
    366     ///
    367     void erase(const Node& n) { Parent::erase(n); }
     363    ///This function erases the given node from the digraph.
     364    void erase(Node n) { Parent::erase(n); }
    368365
    369366    ///\brief Erase an arc from the digraph.
    370367    ///
    371     ///Erase an arc from the digraph.
    372     ///
    373     void erase(const Arc& a) { Parent::erase(a); }
     368    ///This function erases the given arc from the digraph.
     369    void erase(Arc a) { Parent::erase(a); }
    374370
    375371    /// Node validity check
    376372
    377     /// This function gives back true if the given node is valid,
    378     /// ie. it is a real node of the graph.
    379     ///
    380     /// \warning A Node pointing to a removed item
    381     /// could become valid again later if new nodes are
    382     /// added to the graph.
     373    /// This function gives back \c true if the given node is valid,
     374    /// i.e. it is a real node of the digraph.
     375    ///
     376    /// \warning A removed node could become valid again if new nodes are
     377    /// added to the digraph.
    383378    bool valid(Node n) const { return Parent::valid(n); }
    384379
    385380    /// Arc validity check
    386381
    387     /// This function gives back true if the given arc is valid,
    388     /// ie. it is a real arc of the graph.
    389     ///
    390     /// \warning An Arc pointing to a removed item
    391     /// could become valid again later if new nodes are
    392     /// added to the graph.
     382    /// This function gives back \c true if the given arc is valid,
     383    /// i.e. it is a real arc of the digraph.
     384    ///
     385    /// \warning A removed arc could become valid again if new arcs are
     386    /// added to the digraph.
    393387    bool valid(Arc a) const { return Parent::valid(a); }
    394388
    395     /// Change the target of \c a to \c n
    396 
    397     /// Change the target of \c a to \c n
    398     ///
    399     ///\note The <tt>ArcIt</tt>s and <tt>OutArcIt</tt>s referencing
    400     ///the changed arc remain valid. However <tt>InArcIt</tt>s are
    401     ///invalidated.
     389    /// Change the target node of an arc
     390
     391    /// This function changes the target node of the given arc \c a to \c n.
     392    ///
     393    ///\note \c ArcIt and \c OutArcIt iterators referencing the changed
     394    ///arc remain valid, however \c InArcIt iterators are invalidated.
    402395    ///
    403396    ///\warning This functionality cannot be used together with the Snapshot
     
    406399      Parent::changeTarget(a,n);
    407400    }
    408     /// Change the source of \c a to \c n
    409 
    410     /// Change the source of \c a to \c n
    411     ///
    412     ///\note The <tt>InArcIt</tt>s referencing the changed arc remain
    413     ///valid. However the <tt>ArcIt</tt>s and <tt>OutArcIt</tt>s are
    414     ///invalidated.
     401    /// Change the source node of an arc
     402
     403    /// This function changes the source node of the given arc \c a to \c n.
     404    ///
     405    ///\note \c InArcIt iterators referencing the changed arc remain
     406    ///valid, however \c ArcIt and \c OutArcIt iterators are invalidated.
    415407    ///
    416408    ///\warning This functionality cannot be used together with the Snapshot
     
    420412    }
    421413
    422     /// Invert the direction of an arc.
    423 
    424     ///\note The <tt>ArcIt</tt>s referencing the changed arc remain
    425     ///valid. However <tt>OutArcIt</tt>s and <tt>InArcIt</tt>s are
    426     ///invalidated.
     414    /// Reverse the direction of an arc.
     415
     416    /// This function reverses the direction of the given arc.
     417    ///\note \c ArcIt, \c OutArcIt and \c InArcIt iterators referencing
     418    ///the changed arc are invalidated.
    427419    ///
    428420    ///\warning This functionality cannot be used together with the Snapshot
    429421    ///feature.
    430     void reverseArc(Arc e) {
    431       Node t=target(e);
    432       changeTarget(e,source(e));
    433       changeSource(e,t);
    434     }
    435 
    436     /// Reserve memory for nodes.
    437 
    438     /// Using this function it is possible to avoid the superfluous memory
    439     /// allocation: if you know that the digraph you want to build will
    440     /// be very large (e.g. it will contain millions of nodes and/or arcs)
    441     /// then it is worth reserving space for this amount before starting
    442     /// to build the digraph.
    443     /// \sa reserveArc
    444     void reserveNode(int n) { nodes.reserve(n); };
    445 
    446     /// Reserve memory for arcs.
    447 
    448     /// Using this function it is possible to avoid the superfluous memory
    449     /// allocation: if you know that the digraph you want to build will
    450     /// be very large (e.g. it will contain millions of nodes and/or arcs)
    451     /// then it is worth reserving space for this amount before starting
    452     /// to build the digraph.
    453     /// \sa reserveNode
    454     void reserveArc(int m) { arcs.reserve(m); };
     422    void reverseArc(Arc a) {
     423      Node t=target(a);
     424      changeTarget(a,source(a));
     425      changeSource(a,t);
     426    }
    455427
    456428    ///Contract two nodes.
    457429
    458     ///This function contracts two nodes.
    459     ///Node \p b will be removed but instead of deleting
    460     ///incident arcs, they will be joined to \p a.
    461     ///The last parameter \p r controls whether to remove loops. \c true
    462     ///means that loops will be removed.
    463     ///
    464     ///\note The <tt>ArcIt</tt>s referencing a moved arc remain
    465     ///valid. However <tt>InArcIt</tt>s and <tt>OutArcIt</tt>s
    466     ///may be invalidated.
     430    ///This function contracts the given two nodes.
     431    ///Node \c v is removed, but instead of deleting its
     432    ///incident arcs, they are joined to node \c u.
     433    ///If the last parameter \c r is \c true (this is the default value),
     434    ///then the newly created loops are removed.
     435    ///
     436    ///\note The moved arcs are joined to node \c u using changeSource()
     437    ///or changeTarget(), thus \c ArcIt and \c OutArcIt iterators are
     438    ///invalidated for the outgoing arcs of node \c v and \c InArcIt
     439    ///iterators are invalidated for the incomming arcs of \c v.
     440    ///Moreover all iterators referencing node \c v or the removed
     441    ///loops are also invalidated. Other iterators remain valid.
    467442    ///
    468443    ///\warning This functionality cannot be used together with the Snapshot
    469444    ///feature.
    470     void contract(Node a, Node b, bool r = true)
     445    void contract(Node u, Node v, bool r = true)
    471446    {
    472       for(OutArcIt e(*this,b);e!=INVALID;) {
     447      for(OutArcIt e(*this,v);e!=INVALID;) {
    473448        OutArcIt f=e;
    474449        ++f;
    475         if(r && target(e)==a) erase(e);
    476         else changeSource(e,a);
     450        if(r && target(e)==u) erase(e);
     451        else changeSource(e,u);
    477452        e=f;
    478453      }
    479       for(InArcIt e(*this,b);e!=INVALID;) {
     454      for(InArcIt e(*this,v);e!=INVALID;) {
    480455        InArcIt f=e;
    481456        ++f;
    482         if(r && source(e)==a) erase(e);
    483         else changeTarget(e,a);
     457        if(r && source(e)==u) erase(e);
     458        else changeTarget(e,u);
    484459        e=f;
    485460      }
    486       erase(b);
     461      erase(v);
    487462    }
    488463
    489464    ///Split a node.
    490465
    491     ///This function splits a node. First a new node is added to the digraph,
    492     ///then the source of each outgoing arc of \c n is moved to this new node.
    493     ///If \c connect is \c true (this is the default value), then a new arc
    494     ///from \c n to the newly created node is also added.
     466    ///This function splits the given node. First, a new node is added
     467    ///to the digraph, then the source of each outgoing arc of node \c n
     468    ///is moved to this new node.
     469    ///If the second parameter \c connect is \c true (this is the default
     470    ///value), then a new arc from node \c n to the newly created node
     471    ///is also added.
    495472    ///\return The newly created node.
    496473    ///
    497     ///\note The <tt>ArcIt</tt>s referencing a moved arc remain
    498     ///valid. However <tt>InArcIt</tt>s and <tt>OutArcIt</tt>s may
    499     ///be invalidated.
    500     ///
    501     ///\warning This functionality cannot be used in conjunction with the
     474    ///\note All iterators remain valid.
     475    ///
     476    ///\warning This functionality cannot be used together with the
    502477    ///Snapshot feature.
    503478    Node split(Node n, bool connect = true) {
    504479      Node b = addNode();
    505       for(OutArcIt e(*this,n);e!=INVALID;) {
    506         OutArcIt f=e;
    507         ++f;
    508         changeSource(e,b);
    509         e=f;
     480      nodes[b.id].first_out=nodes[n.id].first_out;
     481      nodes[n.id].first_out=-1;
     482      for(int i=nodes[b.id].first_out; i!=-1; i=arcs[i].next_out) {
     483        arcs[i].source=b.id;
    510484      }
    511485      if (connect) addArc(n,b);
     
    515489    ///Split an arc.
    516490
    517     ///This function splits an arc. First a new node \c b is added to
    518     ///the digraph, then the original arc is re-targeted to \c
    519     ///b. Finally an arc from \c b to the original target is added.
    520     ///
     491    ///This function splits the given arc. First, a new node \c v is
     492    ///added to the digraph, then the target node of the original arc
     493    ///is set to \c v. Finally, an arc from \c v to the original target
     494    ///is added.
    521495    ///\return The newly created node.
     496    ///
     497    ///\note \c InArcIt iterators referencing the original arc are
     498    ///invalidated. Other iterators remain valid.
    522499    ///
    523500    ///\warning This functionality cannot be used together with the
    524501    ///Snapshot feature.
    525     Node split(Arc e) {
    526       Node b = addNode();
    527       addArc(b,target(e));
    528       changeTarget(e,b);
    529       return b;
    530     }
     502    Node split(Arc a) {
     503      Node v = addNode();
     504      addArc(v,target(a));
     505      changeTarget(a,v);
     506      return v;
     507    }
     508
     509    ///Clear the digraph.
     510
     511    ///This function erases all nodes and arcs from the digraph.
     512    ///
     513    void clear() {
     514      Parent::clear();
     515    }
     516
     517    /// Reserve memory for nodes.
     518
     519    /// Using this function, it is possible to avoid superfluous memory
     520    /// allocation: if you know that the digraph you want to build will
     521    /// be large (e.g. it will contain millions of nodes and/or arcs),
     522    /// then it is worth reserving space for this amount before starting
     523    /// to build the digraph.
     524    /// \sa reserveArc()
     525    void reserveNode(int n) { nodes.reserve(n); };
     526
     527    /// Reserve memory for arcs.
     528
     529    /// Using this function, it is possible to avoid superfluous memory
     530    /// allocation: if you know that the digraph you want to build will
     531    /// be large (e.g. it will contain millions of nodes and/or arcs),
     532    /// then it is worth reserving space for this amount before starting
     533    /// to build the digraph.
     534    /// \sa reserveNode()
     535    void reserveArc(int m) { arcs.reserve(m); };
    531536
    532537    /// \brief Class to make a snapshot of the digraph and restore
     
    538543    /// restore() function.
    539544    ///
    540     /// \warning Arc and node deletions and other modifications (e.g.
    541     /// contracting, splitting, reversing arcs or nodes) cannot be
     545    /// \note After a state is restored, you cannot restore a later state,
     546    /// i.e. you cannot add the removed nodes and arcs again using
     547    /// another Snapshot instance.
     548    ///
     549    /// \warning Node and arc deletions and other modifications (e.g.
     550    /// reversing, contracting, splitting arcs or nodes) cannot be
    542551    /// restored. These events invalidate the snapshot.
     552    /// However the arcs and nodes that were added to the digraph after
     553    /// making the current snapshot can be removed without invalidating it.
    543554    class Snapshot {
    544555    protected:
     
    710721      ///
    711722      /// Default constructor.
    712       /// To actually make a snapshot you must call save().
     723      /// You have to call save() to actually make a snapshot.
    713724      Snapshot()
    714725        : digraph(0), node_observer_proxy(*this),
     
    717728      /// \brief Constructor that immediately makes a snapshot.
    718729      ///
    719       /// This constructor immediately makes a snapshot of the digraph.
    720       /// \param _digraph The digraph we make a snapshot of.
    721       Snapshot(ListDigraph &_digraph)
     730      /// This constructor immediately makes a snapshot of the given digraph.
     731      Snapshot(ListDigraph &gr)
    722732        : node_observer_proxy(*this),
    723733          arc_observer_proxy(*this) {
    724         attach(_digraph);
     734        attach(gr);
    725735      }
    726736
    727737      /// \brief Make a snapshot.
    728738      ///
    729       /// Make a snapshot of the digraph.
    730       ///
    731       /// This function can be called more than once. In case of a repeated
     739      /// This function makes a snapshot of the given digraph.
     740      /// It can be called more than once. In case of a repeated
    732741      /// call, the previous snapshot gets lost.
    733       /// \param _digraph The digraph we make the snapshot of.
    734       void save(ListDigraph &_digraph) {
     742      void save(ListDigraph &gr) {
    735743        if (attached()) {
    736744          detach();
    737745          clear();
    738746        }
    739         attach(_digraph);
     747        attach(gr);
    740748      }
    741749
    742750      /// \brief Undo the changes until the last snapshot.
    743       //
    744       /// Undo the changes until the last snapshot created by save().
     751      ///
     752      /// This function undos the changes until the last snapshot
     753      /// created by save() or Snapshot(ListDigraph&).
     754      ///
     755      /// \warning This method invalidates the snapshot, i.e. repeated
     756      /// restoring is not supported unless you call save() again.
    745757      void restore() {
    746758        detach();
     
    756768      }
    757769
    758       /// \brief Gives back true when the snapshot is valid.
     770      /// \brief Returns \c true if the snapshot is valid.
    759771      ///
    760       /// Gives back true when the snapshot is valid.
     772      /// This function returns \c true if the snapshot is valid.
    761773      bool valid() const {
    762774        return attached();
     
    795807
    796808    typedef ListGraphBase Graph;
    797 
    798     class Node;
    799     class Arc;
    800     class Edge;
    801809
    802810    class Node {
     
    848856      bool operator<(const Arc& arc) const {return id < arc.id;}
    849857    };
    850 
    851 
    852858
    853859    ListGraphBase()
     
    11651171  ///A general undirected graph structure.
    11661172
    1167   ///\ref ListGraph is a simple and fast <em>undirected graph</em>
    1168   ///implementation based on static linked lists that are stored in
     1173  ///\ref ListGraph is a versatile and fast undirected graph
     1174  ///implementation based on linked lists that are stored in
    11691175  ///\c std::vector structures.
    11701176  ///
    1171   ///It conforms to the \ref concepts::Graph "Graph concept" and it
    1172   ///also provides several useful additional functionalities.
    1173   ///Most of the member functions and nested classes are documented
     1177  ///This type fully conforms to the \ref concepts::Graph "Graph concept"
     1178  ///and it also provides several useful additional functionalities.
     1179  ///Most of its member functions and nested classes are documented
    11741180  ///only in the concept class.
    11751181  ///
    11761182  ///\sa concepts::Graph
    1177 
     1183  ///\sa ListDigraph
    11781184  class ListGraph : public ExtendedListGraphBase {
    11791185    typedef ExtendedListGraphBase Parent;
    11801186
    11811187  private:
    1182     ///ListGraph is \e not copy constructible. Use copyGraph() instead.
    1183 
    1184     ///ListGraph is \e not copy constructible. Use copyGraph() instead.
    1185     ///
     1188    /// Graphs are \e not copy constructible. Use GraphCopy instead.
    11861189    ListGraph(const ListGraph &) :ExtendedListGraphBase()  {};
    1187     ///\brief Assignment of ListGraph to another one is \e not allowed.
    1188     ///Use copyGraph() instead.
    1189 
    1190     ///Assignment of ListGraph to another one is \e not allowed.
    1191     ///Use copyGraph() instead.
     1190    /// \brief Assignment of a graph to another one is \e not allowed.
     1191    /// Use GraphCopy instead.
    11921192    void operator=(const ListGraph &) {}
    11931193  public:
     
    12021202    /// \brief Add a new node to the graph.
    12031203    ///
    1204     /// Add a new node to the graph.
     1204    /// This function adds a new node to the graph.
    12051205    /// \return The new node.
    12061206    Node addNode() { return Parent::addNode(); }
     
    12081208    /// \brief Add a new edge to the graph.
    12091209    ///
    1210     /// Add a new edge to the graph with source node \c s
    1211     /// and target node \c t.
     1210    /// This function adds a new edge to the graph between nodes
     1211    /// \c u and \c v with inherent orientation from node \c u to
     1212    /// node \c v.
    12121213    /// \return The new edge.
    1213     Edge addEdge(const Node& s, const Node& t) {
    1214       return Parent::addEdge(s, t);
    1215     }
    1216 
    1217     /// \brief Erase a node from the graph.
    1218     ///
    1219     /// Erase a node from the graph.
    1220     ///
    1221     void erase(const Node& n) { Parent::erase(n); }
    1222 
    1223     /// \brief Erase an edge from the graph.
    1224     ///
    1225     /// Erase an edge from the graph.
    1226     ///
    1227     void erase(const Edge& e) { Parent::erase(e); }
     1214    Edge addEdge(Node u, Node v) {
     1215      return Parent::addEdge(u, v);
     1216    }
     1217
     1218    ///\brief Erase a node from the graph.
     1219    ///
     1220    /// This function erases the given node from the graph.
     1221    void erase(Node n) { Parent::erase(n); }
     1222
     1223    ///\brief Erase an edge from the graph.
     1224    ///
     1225    /// This function erases the given edge from the graph.
     1226    void erase(Edge e) { Parent::erase(e); }
    12281227    /// Node validity check
    12291228
    1230     /// This function gives back true if the given node is valid,
    1231     /// ie. it is a real node of the graph.
    1232     ///
    1233     /// \warning A Node pointing to a removed item
    1234     /// could become valid again later if new nodes are
     1229    /// This function gives back \c true if the given node is valid,
     1230    /// i.e. it is a real node of the graph.
     1231    ///
     1232    /// \warning A removed node could become valid again if new nodes are
    12351233    /// added to the graph.
    12361234    bool valid(Node n) const { return Parent::valid(n); }
     1235    /// Edge validity check
     1236
     1237    /// This function gives back \c true if the given edge is valid,
     1238    /// i.e. it is a real edge of the graph.
     1239    ///
     1240    /// \warning A removed edge could become valid again if new edges are
     1241    /// added to the graph.
     1242    bool valid(Edge e) const { return Parent::valid(e); }
    12371243    /// Arc validity check
    12381244
    1239     /// This function gives back true if the given arc is valid,
    1240     /// ie. it is a real arc of the graph.
    1241     ///
    1242     /// \warning An Arc pointing to a removed item
    1243     /// could become valid again later if new edges are
     1245    /// This function gives back \c true if the given arc is valid,
     1246    /// i.e. it is a real arc of the graph.
     1247    ///
     1248    /// \warning A removed arc could become valid again if new edges are
    12441249    /// added to the graph.
    12451250    bool valid(Arc a) const { return Parent::valid(a); }
    1246     /// Edge validity check
    1247 
    1248     /// This function gives back true if the given edge is valid,
    1249     /// ie. it is a real arc of the graph.
    1250     ///
    1251     /// \warning A Edge pointing to a removed item
    1252     /// could become valid again later if new edges are
    1253     /// added to the graph.
    1254     bool valid(Edge e) const { return Parent::valid(e); }
    1255     /// \brief Change the end \c u of \c e to \c n
    1256     ///
    1257     /// This function changes the end \c u of \c e to node \c n.
    1258     ///
    1259     ///\note The <tt>EdgeIt</tt>s and <tt>ArcIt</tt>s referencing the
    1260     ///changed edge are invalidated and if the changed node is the
    1261     ///base node of an iterator then this iterator is also
    1262     ///invalidated.
     1251
     1252    /// \brief Change the first node of an edge.
     1253    ///
     1254    /// This function changes the first node of the given edge \c e to \c n.
     1255    ///
     1256    ///\note \c EdgeIt and \c ArcIt iterators referencing the
     1257    ///changed edge are invalidated and all other iterators whose
     1258    ///base node is the changed node are also invalidated.
    12631259    ///
    12641260    ///\warning This functionality cannot be used together with the
     
    12671263      Parent::changeU(e,n);
    12681264    }
    1269     /// \brief Change the end \c v of \c e to \c n
    1270     ///
    1271     /// This function changes the end \c v of \c e to \c n.
    1272     ///
    1273     ///\note The <tt>EdgeIt</tt>s referencing the changed edge remain
    1274     ///valid, however <tt>ArcIt</tt>s and if the changed node is the
    1275     ///base node of an iterator then this iterator is invalidated.
     1265    /// \brief Change the second node of an edge.
     1266    ///
     1267    /// This function changes the second node of the given edge \c e to \c n.
     1268    ///
     1269    ///\note \c EdgeIt iterators referencing the changed edge remain
     1270    ///valid, however \c ArcIt iterators referencing the changed edge and
     1271    ///all other iterators whose base node is the changed node are also
     1272    ///invalidated.
    12761273    ///
    12771274    ///\warning This functionality cannot be used together with the
     
    12801277      Parent::changeV(e,n);
    12811278    }
     1279
    12821280    /// \brief Contract two nodes.
    12831281    ///
    1284     /// This function contracts two nodes.
    1285     /// Node \p b will be removed but instead of deleting
    1286     /// its neighboring arcs, they will be joined to \p a.
    1287     /// The last parameter \p r controls whether to remove loops. \c true
    1288     /// means that loops will be removed.
    1289     ///
    1290     /// \note The <tt>ArcIt</tt>s referencing a moved arc remain
    1291     /// valid.
     1282    /// This function contracts the given two nodes.
     1283    /// Node \c b is removed, but instead of deleting
     1284    /// its incident edges, they are joined to node \c a.
     1285    /// If the last parameter \c r is \c true (this is the default value),
     1286    /// then the newly created loops are removed.
     1287    ///
     1288    /// \note The moved edges are joined to node \c a using changeU()
     1289    /// or changeV(), thus all edge and arc iterators whose base node is
     1290    /// \c b are invalidated.
     1291    /// Moreover all iterators referencing node \c b or the removed
     1292    /// loops are also invalidated. Other iterators remain valid.
    12921293    ///
    12931294    ///\warning This functionality cannot be used together with the
     
    13081309    }
    13091310
     1311    ///Clear the graph.
     1312
     1313    ///This function erases all nodes and arcs from the graph.
     1314    ///
     1315    void clear() {
     1316      Parent::clear();
     1317    }
     1318
     1319    /// Reserve memory for nodes.
     1320
     1321    /// Using this function, it is possible to avoid superfluous memory
     1322    /// allocation: if you know that the graph you want to build will
     1323    /// be large (e.g. it will contain millions of nodes and/or edges),
     1324    /// then it is worth reserving space for this amount before starting
     1325    /// to build the graph.
     1326    /// \sa reserveEdge()
     1327    void reserveNode(int n) { nodes.reserve(n); };
     1328
     1329    /// Reserve memory for edges.
     1330
     1331    /// Using this function, it is possible to avoid superfluous memory
     1332    /// allocation: if you know that the graph you want to build will
     1333    /// be large (e.g. it will contain millions of nodes and/or edges),
     1334    /// then it is worth reserving space for this amount before starting
     1335    /// to build the graph.
     1336    /// \sa reserveNode()
     1337    void reserveEdge(int m) { arcs.reserve(2 * m); };
    13101338
    13111339    /// \brief Class to make a snapshot of the graph and restore
     
    13171345    /// using the restore() function.
    13181346    ///
    1319     /// \warning Edge and node deletions and other modifications
    1320     /// (e.g. changing nodes of edges, contracting nodes) cannot be
    1321     /// restored. These events invalidate the snapshot.
     1347    /// \note After a state is restored, you cannot restore a later state,
     1348    /// i.e. you cannot add the removed nodes and edges again using
     1349    /// another Snapshot instance.
     1350    ///
     1351    /// \warning Node and edge deletions and other modifications
     1352    /// (e.g. changing the end-nodes of edges or contracting nodes)
     1353    /// cannot be restored. These events invalidate the snapshot.
     1354    /// However the edges and nodes that were added to the graph after
     1355    /// making the current snapshot can be removed without invalidating it.
    13221356    class Snapshot {
    13231357    protected:
     
    14891523      ///
    14901524      /// Default constructor.
    1491       /// To actually make a snapshot you must call save().
     1525      /// You have to call save() to actually make a snapshot.
    14921526      Snapshot()
    14931527        : graph(0), node_observer_proxy(*this),
     
    14961530      /// \brief Constructor that immediately makes a snapshot.
    14971531      ///
    1498       /// This constructor immediately makes a snapshot of the graph.
    1499       /// \param _graph The graph we make a snapshot of.
    1500       Snapshot(ListGraph &_graph)
     1532      /// This constructor immediately makes a snapshot of the given graph.
     1533      Snapshot(ListGraph &gr)
    15011534        : node_observer_proxy(*this),
    15021535          edge_observer_proxy(*this) {
    1503         attach(_graph);
     1536        attach(gr);
    15041537      }
    15051538
    15061539      /// \brief Make a snapshot.
    15071540      ///
    1508       /// Make a snapshot of the graph.
    1509       ///
    1510       /// This function can be called more than once. In case of a repeated
     1541      /// This function makes a snapshot of the given graph.
     1542      /// It can be called more than once. In case of a repeated
    15111543      /// call, the previous snapshot gets lost.
    1512       /// \param _graph The graph we make the snapshot of.
    1513       void save(ListGraph &_graph) {
     1544      void save(ListGraph &gr) {
    15141545        if (attached()) {
    15151546          detach();
    15161547          clear();
    15171548        }
    1518         attach(_graph);
     1549        attach(gr);
    15191550      }
    15201551
    15211552      /// \brief Undo the changes until the last snapshot.
    1522       //
    1523       /// Undo the changes until the last snapshot created by save().
     1553      ///
     1554      /// This function undos the changes until the last snapshot
     1555      /// created by save() or Snapshot(ListGraph&).
     1556      ///
     1557      /// \warning This method invalidates the snapshot, i.e. repeated
     1558      /// restoring is not supported unless you call save() again.
    15241559      void restore() {
    15251560        detach();
     
    15351570      }
    15361571
    1537       /// \brief Gives back true when the snapshot is valid.
     1572      /// \brief Returns \c true if the snapshot is valid.
    15381573      ///
    1539       /// Gives back true when the snapshot is valid.
     1574      /// This function returns \c true if the snapshot is valid.
    15401575      bool valid() const {
    15411576        return attached();
  • lemon/smart_graph.h

    r617 r736  
    3333
    3434  class SmartDigraph;
    35   ///Base of SmartDigraph
    36 
    37   ///Base of SmartDigraph
    38   ///
     35
    3936  class SmartDigraphBase {
    4037  protected:
     
    188185  ///\brief A smart directed graph class.
    189186  ///
    190   ///This is a simple and fast digraph implementation.
    191   ///It is also quite memory efficient, but at the price
    192   ///that <b> it does support only limited (only stack-like)
    193   ///node and arc deletions</b>.
    194   ///It fully conforms to the \ref concepts::Digraph "Digraph concept".
     187  ///\ref SmartDigraph is a simple and fast digraph implementation.
     188  ///It is also quite memory efficient but at the price
     189  ///that it does not support node and arc deletion
     190  ///(except for the Snapshot feature).
    195191  ///
    196   ///\sa concepts::Digraph.
     192  ///This type fully conforms to the \ref concepts::Digraph "Digraph concept"
     193  ///and it also provides some additional functionalities.
     194  ///Most of its member functions and nested classes are documented
     195  ///only in the concept class.
     196  ///
     197  ///\sa concepts::Digraph
     198  ///\sa SmartGraph
    197199  class SmartDigraph : public ExtendedSmartDigraphBase {
    198200    typedef ExtendedSmartDigraphBase Parent;
    199201
    200202  private:
    201 
    202     ///SmartDigraph is \e not copy constructible. Use DigraphCopy() instead.
    203 
    204     ///SmartDigraph is \e not copy constructible. Use DigraphCopy() instead.
    205     ///
     203    /// Digraphs are \e not copy constructible. Use DigraphCopy instead.
    206204    SmartDigraph(const SmartDigraph &) : ExtendedSmartDigraphBase() {};
    207     ///\brief Assignment of SmartDigraph to another one is \e not allowed.
    208     ///Use DigraphCopy() instead.
    209 
    210     ///Assignment of SmartDigraph to another one is \e not allowed.
    211     ///Use DigraphCopy() instead.
     205    /// \brief Assignment of a digraph to another one is \e not allowed.
     206    /// Use DigraphCopy instead.
    212207    void operator=(const SmartDigraph &) {}
    213208
     
    222217    ///Add a new node to the digraph.
    223218
    224     /// Add a new node to the digraph.
    225     /// \return The new node.
     219    ///This function adds a new node to the digraph.
     220    ///\return The new node.
    226221    Node addNode() { return Parent::addNode(); }
    227222
    228223    ///Add a new arc to the digraph.
    229224
    230     ///Add a new arc to the digraph with source node \c s
     225    ///This function adds a new arc to the digraph with source node \c s
    231226    ///and target node \c t.
    232227    ///\return The new arc.
    233     Arc addArc(const Node& s, const Node& t) {
     228    Arc addArc(Node s, Node t) {
    234229      return Parent::addArc(s, t);
    235230    }
    236231
    237     /// \brief Using this it is possible to avoid the superfluous memory
    238     /// allocation.
    239 
    240     /// Using this it is possible to avoid the superfluous memory
    241     /// allocation: if you know that the digraph you want to build will
    242     /// be very large (e.g. it will contain millions of nodes and/or arcs)
    243     /// then it is worth reserving space for this amount before starting
    244     /// to build the digraph.
    245     /// \sa reserveArc
    246     void reserveNode(int n) { nodes.reserve(n); };
    247 
    248     /// \brief Using this it is possible to avoid the superfluous memory
    249     /// allocation.
    250 
    251     /// Using this it is possible to avoid the superfluous memory
    252     /// allocation: if you know that the digraph you want to build will
    253     /// be very large (e.g. it will contain millions of nodes and/or arcs)
    254     /// then it is worth reserving space for this amount before starting
    255     /// to build the digraph.
    256     /// \sa reserveNode
    257     void reserveArc(int m) { arcs.reserve(m); };
    258 
    259232    /// \brief Node validity check
    260233    ///
    261     /// This function gives back true if the given node is valid,
    262     /// ie. it is a real node of the graph.
     234    /// This function gives back \c true if the given node is valid,
     235    /// i.e. it is a real node of the digraph.
    263236    ///
    264237    /// \warning A removed node (using Snapshot) could become valid again
    265     /// when new nodes are added to the graph.
     238    /// if new nodes are added to the digraph.
    266239    bool valid(Node n) const { return Parent::valid(n); }
    267240
    268241    /// \brief Arc validity check
    269242    ///
    270     /// This function gives back true if the given arc is valid,
    271     /// ie. it is a real arc of the graph.
     243    /// This function gives back \c true if the given arc is valid,
     244    /// i.e. it is a real arc of the digraph.
    272245    ///
    273246    /// \warning A removed arc (using Snapshot) could become valid again
    274     /// when new arcs are added to the graph.
     247    /// if new arcs are added to the graph.
    275248    bool valid(Arc a) const { return Parent::valid(a); }
    276249
    277     ///Clear the digraph.
    278 
    279     ///Erase all the nodes and arcs from the digraph.
    280     ///
    281     void clear() {
    282       Parent::clear();
    283     }
    284 
    285250    ///Split a node.
    286251
    287     ///This function splits a node. First a new node is added to the digraph,
    288     ///then the source of each outgoing arc of \c n is moved to this new node.
    289     ///If \c connect is \c true (this is the default value), then a new arc
    290     ///from \c n to the newly created node is also added.
     252    ///This function splits the given node. First, a new node is added
     253    ///to the digraph, then the source of each outgoing arc of node \c n
     254    ///is moved to this new node.
     255    ///If the second parameter \c connect is \c true (this is the default
     256    ///value), then a new arc from node \c n to the newly created node
     257    ///is also added.
    291258    ///\return The newly created node.
    292259    ///
    293     ///\note The <tt>Arc</tt>s
    294     ///referencing a moved arc remain
    295     ///valid. However <tt>InArc</tt>'s and <tt>OutArc</tt>'s
    296     ///may be invalidated.
     260    ///\note All iterators remain valid.
     261    ///
    297262    ///\warning This functionality cannot be used together with the Snapshot
    298263    ///feature.
     
    309274    }
    310275
     276    ///Clear the digraph.
     277
     278    ///This function erases all nodes and arcs from the digraph.
     279    ///
     280    void clear() {
     281      Parent::clear();
     282    }
     283
     284    /// Reserve memory for nodes.
     285
     286    /// Using this function, it is possible to avoid superfluous memory
     287    /// allocation: if you know that the digraph you want to build will
     288    /// be large (e.g. it will contain millions of nodes and/or arcs),
     289    /// then it is worth reserving space for this amount before starting
     290    /// to build the digraph.
     291    /// \sa reserveArc()
     292    void reserveNode(int n) { nodes.reserve(n); };
     293
     294    /// Reserve memory for arcs.
     295
     296    /// Using this function, it is possible to avoid superfluous memory
     297    /// allocation: if you know that the digraph you want to build will
     298    /// be large (e.g. it will contain millions of nodes and/or arcs),
     299    /// then it is worth reserving space for this amount before starting
     300    /// to build the digraph.
     301    /// \sa reserveNode()
     302    void reserveArc(int m) { arcs.reserve(m); };
     303
    311304  public:
    312305
     
    333326  public:
    334327
    335     ///Class to make a snapshot of the digraph and to restrore to it later.
    336 
    337     ///Class to make a snapshot of the digraph and to restrore to it later.
     328    ///Class to make a snapshot of the digraph and to restore it later.
     329
     330    ///Class to make a snapshot of the digraph and to restore it later.
    338331    ///
    339332    ///The newly added nodes and arcs can be removed using the
    340     ///restore() function.
    341     ///\note After you restore a state, you cannot restore
    342     ///a later state, in other word you cannot add again the arcs deleted
    343     ///by restore() using another one Snapshot instance.
    344     ///
    345     ///\warning If you do not use correctly the snapshot that can cause
    346     ///either broken program, invalid state of the digraph, valid but
    347     ///not the restored digraph or no change. Because the runtime performance
    348     ///the validity of the snapshot is not stored.
     333    ///restore() function. This is the only way for deleting nodes and/or
     334    ///arcs from a SmartDigraph structure.
     335    ///
     336    ///\note After a state is restored, you cannot restore a later state,
     337    ///i.e. you cannot add the removed nodes and arcs again using
     338    ///another Snapshot instance.
     339    ///
     340    ///\warning Node splitting cannot be restored.
     341    ///\warning The validity of the snapshot is not stored due to
     342    ///performance reasons. If you do not use the snapshot correctly,
     343    ///it can cause broken program, invalid or not restored state of
     344    ///the digraph or no change.
    349345    class Snapshot
    350346    {
     
    358354
    359355      ///Default constructor.
    360       ///To actually make a snapshot you must call save().
    361       ///
     356      ///You have to call save() to actually make a snapshot.
    362357      Snapshot() : _graph(0) {}
    363358      ///Constructor that immediately makes a snapshot
    364359
    365       ///This constructor immediately makes a snapshot of the digraph.
    366       ///\param graph The digraph we make a snapshot of.
    367       Snapshot(SmartDigraph &graph) : _graph(&graph) {
     360      ///This constructor immediately makes a snapshot of the given digraph.
     361      ///
     362      Snapshot(SmartDigraph &gr) : _graph(&gr) {
    368363        node_num=_graph->nodes.size();
    369364        arc_num=_graph->arcs.size();
     
    372367      ///Make a snapshot.
    373368
    374       ///Make a snapshot of the digraph.
    375       ///
    376       ///This function can be called more than once. In case of a repeated
     369      ///This function makes a snapshot of the given digraph.
     370      ///It can be called more than once. In case of a repeated
    377371      ///call, the previous snapshot gets lost.
    378       ///\param graph The digraph we make the snapshot of.
    379       void save(SmartDigraph &graph)
    380       {
    381         _graph=&graph;
     372      void save(SmartDigraph &gr) {
     373        _graph=&gr;
    382374        node_num=_graph->nodes.size();
    383375        arc_num=_graph->arcs.size();
     
    386378      ///Undo the changes until a snapshot.
    387379
    388       ///Undo the changes until a snapshot created by save().
    389       ///
    390       ///\note After you restored a state, you cannot restore
    391       ///a later state, in other word you cannot add again the arcs deleted
    392       ///by restore().
     380      ///This function undos the changes until the last snapshot
     381      ///created by save() or Snapshot(SmartDigraph&).
    393382      void restore()
    394383      {
     
    622611  /// \brief A smart undirected graph class.
    623612  ///
    624   /// This is a simple and fast graph implementation.
    625   /// It is also quite memory efficient, but at the price
    626   /// that <b> it does support only limited (only stack-like)
    627   /// node and arc deletions</b>.
    628   /// It fully conforms to the \ref concepts::Graph "Graph concept".
     613  /// \ref SmartGraph is a simple and fast graph implementation.
     614  /// It is also quite memory efficient but at the price
     615  /// that it does not support node and edge deletion
     616  /// (except for the Snapshot feature).
    629617  ///
    630   /// \sa concepts::Graph.
     618  /// This type fully conforms to the \ref concepts::Graph "Graph concept"
     619  /// and it also provides some additional functionalities.
     620  /// Most of its member functions and nested classes are documented
     621  /// only in the concept class.
     622  ///
     623  /// \sa concepts::Graph
     624  /// \sa SmartDigraph
    631625  class SmartGraph : public ExtendedSmartGraphBase {
    632626    typedef ExtendedSmartGraphBase Parent;
    633627
    634628  private:
    635 
    636     ///SmartGraph is \e not copy constructible. Use GraphCopy() instead.
    637 
    638     ///SmartGraph is \e not copy constructible. Use GraphCopy() instead.
    639     ///
     629    /// Graphs are \e not copy constructible. Use GraphCopy instead.
    640630    SmartGraph(const SmartGraph &) : ExtendedSmartGraphBase() {};
    641 
    642     ///\brief Assignment of SmartGraph to another one is \e not allowed.
    643     ///Use GraphCopy() instead.
    644 
    645     ///Assignment of SmartGraph to another one is \e not allowed.
    646     ///Use GraphCopy() instead.
     631    /// \brief Assignment of a graph to another one is \e not allowed.
     632    /// Use GraphCopy instead.
    647633    void operator=(const SmartGraph &) {}
    648634
     
    655641    SmartGraph() {}
    656642
    657     ///Add a new node to the graph.
    658 
    659     /// Add a new node to the graph.
     643    /// \brief Add a new node to the graph.
     644    ///
     645    /// This function adds a new node to the graph.
    660646    /// \return The new node.
    661647    Node addNode() { return Parent::addNode(); }
    662648
    663     ///Add a new edge to the graph.
    664 
    665     ///Add a new edge to the graph with node \c s
    666     ///and \c t.
    667     ///\return The new edge.
    668     Edge addEdge(const Node& s, const Node& t) {
    669       return Parent::addEdge(s, t);
     649    /// \brief Add a new edge to the graph.
     650    ///
     651    /// This function adds a new edge to the graph between nodes
     652    /// \c u and \c v with inherent orientation from node \c u to
     653    /// node \c v.
     654    /// \return The new edge.
     655    Edge addEdge(Node u, Node v) {
     656      return Parent::addEdge(u, v);
    670657    }
    671658
    672659    /// \brief Node validity check
    673660    ///
    674     /// This function gives back true if the given node is valid,
    675     /// ie. it is a real node of the graph.
     661    /// This function gives back \c true if the given node is valid,
     662    /// i.e. it is a real node of the graph.
    676663    ///
    677664    /// \warning A removed node (using Snapshot) could become valid again
    678     /// when new nodes are added to the graph.
     665    /// if new nodes are added to the graph.
    679666    bool valid(Node n) const { return Parent::valid(n); }
    680667
     668    /// \brief Edge validity check
     669    ///
     670    /// This function gives back \c true if the given edge is valid,
     671    /// i.e. it is a real edge of the graph.
     672    ///
     673    /// \warning A removed edge (using Snapshot) could become valid again
     674    /// if new edges are added to the graph.
     675    bool valid(Edge e) const { return Parent::valid(e); }
     676
    681677    /// \brief Arc validity check
    682678    ///
    683     /// This function gives back true if the given arc is valid,
    684     /// ie. it is a real arc of the graph.
     679    /// This function gives back \c true if the given arc is valid,
     680    /// i.e. it is a real arc of the graph.
    685681    ///
    686682    /// \warning A removed arc (using Snapshot) could become valid again
    687     /// when new edges are added to the graph.
     683    /// if new edges are added to the graph.
    688684    bool valid(Arc a) const { return Parent::valid(a); }
    689685
    690     /// \brief Edge validity check
    691     ///
    692     /// This function gives back true if the given edge is valid,
    693     /// ie. it is a real edge of the graph.
    694     ///
    695     /// \warning A removed edge (using Snapshot) could become valid again
    696     /// when new edges are added to the graph.
    697     bool valid(Edge e) const { return Parent::valid(e); }
    698 
    699686    ///Clear the graph.
    700687
    701     ///Erase all the nodes and edges from the graph.
     688    ///This function erases all nodes and arcs from the graph.
    702689    ///
    703690    void clear() {
    704691      Parent::clear();
    705692    }
     693
     694    /// Reserve memory for nodes.
     695
     696    /// Using this function, it is possible to avoid superfluous memory
     697    /// allocation: if you know that the graph you want to build will
     698    /// be large (e.g. it will contain millions of nodes and/or edges),
     699    /// then it is worth reserving space for this amount before starting
     700    /// to build the graph.
     701    /// \sa reserveEdge()
     702    void reserveNode(int n) { nodes.reserve(n); };
     703
     704    /// Reserve memory for edges.
     705
     706    /// Using this function, it is possible to avoid superfluous memory
     707    /// allocation: if you know that the graph you want to build will
     708    /// be large (e.g. it will contain millions of nodes and/or edges),
     709    /// then it is worth reserving space for this amount before starting
     710    /// to build the graph.
     711    /// \sa reserveNode()
     712    void reserveEdge(int m) { arcs.reserve(2 * m); };
    706713
    707714  public:
     
    743750  public:
    744751
    745     ///Class to make a snapshot of the digraph and to restrore to it later.
    746 
    747     ///Class to make a snapshot of the digraph and to restrore to it later.
    748     ///
    749     ///The newly added nodes and arcs can be removed using the
    750     ///restore() function.
    751     ///
    752     ///\note After you restore a state, you cannot restore
    753     ///a later state, in other word you cannot add again the arcs deleted
    754     ///by restore() using another one Snapshot instance.
    755     ///
    756     ///\warning If you do not use correctly the snapshot that can cause
    757     ///either broken program, invalid state of the digraph, valid but
    758     ///not the restored digraph or no change. Because the runtime performance
    759     ///the validity of the snapshot is not stored.
     752    ///Class to make a snapshot of the graph and to restore it later.
     753
     754    ///Class to make a snapshot of the graph and to restore it later.
     755    ///
     756    ///The newly added nodes and edges can be removed using the
     757    ///restore() function. This is the only way for deleting nodes and/or
     758    ///edges from a SmartGraph structure.
     759    ///
     760    ///\note After a state is restored, you cannot restore a later state,
     761    ///i.e. you cannot add the removed nodes and edges again using
     762    ///another Snapshot instance.
     763    ///
     764    ///\warning The validity of the snapshot is not stored due to
     765    ///performance reasons. If you do not use the snapshot correctly,
     766    ///it can cause broken program, invalid or not restored state of
     767    ///the graph or no change.
    760768    class Snapshot
    761769    {
     
    769777
    770778      ///Default constructor.
    771       ///To actually make a snapshot you must call save().
    772       ///
     779      ///You have to call save() to actually make a snapshot.
    773780      Snapshot() : _graph(0) {}
    774781      ///Constructor that immediately makes a snapshot
    775782
    776       ///This constructor immediately makes a snapshot of the digraph.
    777       ///\param graph The digraph we make a snapshot of.
    778       Snapshot(SmartGraph &graph) {
    779         graph.saveSnapshot(*this);
     783      /// This constructor immediately makes a snapshot of the given graph.
     784      ///
     785      Snapshot(SmartGraph &gr) {
     786        gr.saveSnapshot(*this);
    780787      }
    781788
    782789      ///Make a snapshot.
    783790
    784       ///Make a snapshot of the graph.
    785       ///
    786       ///This function can be called more than once. In case of a repeated
     791      ///This function makes a snapshot of the given graph.
     792      ///It can be called more than once. In case of a repeated
    787793      ///call, the previous snapshot gets lost.
    788       ///\param graph The digraph we make the snapshot of.
    789       void save(SmartGraph &graph)
     794      void save(SmartGraph &gr)
    790795      {
    791         graph.saveSnapshot(*this);
    792       }
    793 
    794       ///Undo the changes until a snapshot.
    795 
    796       ///Undo the changes until a snapshot created by save().
    797       ///
    798       ///\note After you restored a state, you cannot restore
    799       ///a later state, in other word you cannot add again the arcs deleted
    800       ///by restore().
     796        gr.saveSnapshot(*this);
     797      }
     798
     799      ///Undo the changes until the last snapshot.
     800
     801      ///This function undos the changes until the last snapshot
     802      ///created by save() or Snapshot(SmartGraph&).
    801803      void restore()
    802804      {
  • test/digraph_test.cc

    r440 r740  
    3636  checkGraphArcList(G, 0);
    3737
     38  G.reserveNode(3);
     39  G.reserveArc(4);
     40
    3841  Node
    3942    n1 = G.addNode(),
     
    284287
    285288  snapshot.restore();
     289  snapshot.save(G);
     290
     291  checkGraphNodeList(G, 4);
     292  checkGraphArcList(G, 4);
     293
     294  G.addArc(G.addNode(), G.addNode());
     295
     296  snapshot.restore();
    286297
    287298  checkGraphNodeList(G, 4);
     
    376387  typedef FullDigraph Digraph;
    377388  DIGRAPH_TYPEDEFS(Digraph);
     389
    378390  Digraph G(num);
     391  check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size");
     392
     393  G.resize(num);
     394  check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size");
    379395
    380396  checkGraphNodeList(G, num);
  • test/graph_test.cc

    r440 r740  
    3939  checkGraphArcList(G, 0);
    4040
     41  G.reserveNode(3);
     42  G.reserveEdge(3);
     43
    4144  Node
    4245    n1 = G.addNode(),
     
    257260
    258261  snapshot.restore();
     262  snapshot.save(G);
     263
     264  checkGraphNodeList(G, 4);
     265  checkGraphEdgeList(G, 3);
     266  checkGraphArcList(G, 6);
     267 
     268  G.addEdge(G.addNode(), G.addNode());
     269
     270  snapshot.restore();
    259271
    260272  checkGraphNodeList(G, 4);
     
    268280
    269281  Graph G(num);
     282  check(G.nodeNum() == num && G.edgeNum() == num * (num - 1) / 2,
     283        "Wrong size");
     284
     285  G.resize(num);
     286  check(G.nodeNum() == num && G.edgeNum() == num * (num - 1) / 2,
     287        "Wrong size");
     288
    270289  checkGraphNodeList(G, num);
    271290  checkGraphEdgeList(G, num * (num - 1) / 2);
     
    412431  check(G.height() == height, "Wrong row number");
    413432
     433  G.resize(width, height);
     434  check(G.width() == width, "Wrong column number");
     435  check(G.height() == height, "Wrong row number");
     436
    414437  for (int i = 0; i < width; ++i) {
    415438    for (int j = 0; j < height; ++j) {
     
    487510
    488511  HypercubeGraph G(dim);
     512  check(G.dimension() == dim, "Wrong dimension");
     513
     514  G.resize(dim);
     515  check(G.dimension() == dim, "Wrong dimension");
     516 
    489517  checkGraphNodeList(G, 1 << dim);
    490518  checkGraphEdgeList(G, dim * (1 << (dim-1)));
Note: See TracChangeset for help on using the changeset viewer.