lemon/full_graph.h
changeset 782 ceb2756dea2a
parent 778 a143f19f465b
parent 735 853fcddcf282
child 787 c2230649a493
     1.1 --- a/lemon/full_graph.h	Mon Sep 28 15:53:20 2009 +0200
     1.2 +++ b/lemon/full_graph.h	Thu Nov 05 10:27:17 2009 +0100
     1.3 @@ -24,7 +24,7 @@
     1.4  
     1.5  ///\ingroup graphs
     1.6  ///\file
     1.7 -///\brief FullGraph and FullDigraph classes.
     1.8 +///\brief FullDigraph and FullGraph classes.
     1.9  
    1.10  namespace lemon {
    1.11  
    1.12 @@ -51,7 +51,7 @@
    1.13      typedef True ArcNumTag;
    1.14  
    1.15      Node operator()(int ix) const { return Node(ix); }
    1.16 -    int index(const Node& node) const { return node._id; }
    1.17 +    static int index(const Node& node) { return node._id; }
    1.18  
    1.19      Arc arc(const Node& s, const Node& t) const {
    1.20        return Arc(s._id * _node_num + t._id);
    1.21 @@ -148,24 +148,26 @@
    1.22  
    1.23    /// \ingroup graphs
    1.24    ///
    1.25 -  /// \brief A full digraph class.
    1.26 +  /// \brief A directed full graph class.
    1.27    ///
    1.28 -  /// This is a simple and fast directed full graph implementation.
    1.29 -  /// From each node go arcs to each node (including the source node),
    1.30 -  /// therefore the number of the arcs in the digraph is the square of
    1.31 -  /// the node number. This digraph type is completely static, so you
    1.32 -  /// can neither add nor delete either arcs or nodes, and it needs
    1.33 -  /// constant space in memory.
    1.34 +  /// FullDigraph is a simple and fast implmenetation of directed full
    1.35 +  /// (complete) graphs. It contains an arc from each node to each node
    1.36 +  /// (including a loop for each node), therefore the number of arcs
    1.37 +  /// is the square of the number of nodes.
    1.38 +  /// This class is completely static and it needs constant memory space.
    1.39 +  /// Thus you can neither add nor delete nodes or arcs, however
    1.40 +  /// the structure can be resized using resize().
    1.41    ///
    1.42 -  /// This class fully conforms to the \ref concepts::Digraph
    1.43 -  /// "Digraph concept".
    1.44 +  /// This type fully conforms to the \ref concepts::Digraph "Digraph concept".
    1.45 +  /// Most of its member functions and nested classes are documented
    1.46 +  /// only in the concept class.
    1.47    ///
    1.48 -  /// The \c FullDigraph and \c FullGraph classes are very similar,
    1.49 +  /// \note FullDigraph and FullGraph classes are very similar,
    1.50    /// but there are two differences. While this class conforms only
    1.51 -  /// to the \ref concepts::Digraph "Digraph" concept, the \c FullGraph
    1.52 -  /// class conforms to the \ref concepts::Graph "Graph" concept,
    1.53 -  /// moreover \c FullGraph does not contain a loop arc for each
    1.54 -  /// node as \c FullDigraph does.
    1.55 +  /// to the \ref concepts::Digraph "Digraph" concept, FullGraph
    1.56 +  /// conforms to the \ref concepts::Graph "Graph" concept,
    1.57 +  /// moreover FullGraph does not contain a loop for each
    1.58 +  /// node as this class does.
    1.59    ///
    1.60    /// \sa FullGraph
    1.61    class FullDigraph : public ExtendedFullDigraphBase {
    1.62 @@ -173,7 +175,9 @@
    1.63  
    1.64    public:
    1.65  
    1.66 -    /// \brief Constructor
    1.67 +    /// \brief Default constructor.
    1.68 +    ///
    1.69 +    /// Default constructor. The number of nodes and arcs will be zero.
    1.70      FullDigraph() { construct(0); }
    1.71  
    1.72      /// \brief Constructor
    1.73 @@ -184,8 +188,8 @@
    1.74  
    1.75      /// \brief Resizes the digraph
    1.76      ///
    1.77 -    /// Resizes the digraph. The function will fully destroy and
    1.78 -    /// rebuild the digraph. This cause that the maps of the digraph will
    1.79 +    /// This function resizes the digraph. It fully destroys and
    1.80 +    /// rebuilds the structure, therefore the maps of the digraph will be
    1.81      /// reallocated automatically and the previous values will be lost.
    1.82      void resize(int n) {
    1.83        Parent::notifier(Arc()).clear();
    1.84 @@ -197,24 +201,24 @@
    1.85  
    1.86      /// \brief Returns the node with the given index.
    1.87      ///
    1.88 -    /// Returns the node with the given index. Since it is a static
    1.89 -    /// digraph its nodes can be indexed with integers from the range
    1.90 -    /// <tt>[0..nodeNum()-1]</tt>.
    1.91 +    /// Returns the node with the given index. Since this structure is 
    1.92 +    /// completely static, the nodes can be indexed with integers from
    1.93 +    /// the range <tt>[0..nodeNum()-1]</tt>.
    1.94      /// \sa index()
    1.95      Node operator()(int ix) const { return Parent::operator()(ix); }
    1.96  
    1.97      /// \brief Returns the index of the given node.
    1.98      ///
    1.99 -    /// Returns the index of the given node. Since it is a static
   1.100 -    /// digraph its nodes can be indexed with integers from the range
   1.101 -    /// <tt>[0..nodeNum()-1]</tt>.
   1.102 -    /// \sa operator()
   1.103 -    int index(const Node& node) const { return Parent::index(node); }
   1.104 +    /// Returns the index of the given node. Since this structure is 
   1.105 +    /// completely static, the nodes can be indexed with integers from
   1.106 +    /// the range <tt>[0..nodeNum()-1]</tt>.
   1.107 +    /// \sa operator()()
   1.108 +    static int index(const Node& node) { return Parent::index(node); }
   1.109  
   1.110      /// \brief Returns the arc connecting the given nodes.
   1.111      ///
   1.112      /// Returns the arc connecting the given nodes.
   1.113 -    Arc arc(const Node& u, const Node& v) const {
   1.114 +    Arc arc(Node u, Node v) const {
   1.115        return Parent::arc(u, v);
   1.116      }
   1.117  
   1.118 @@ -283,7 +287,7 @@
   1.119    public:
   1.120  
   1.121      Node operator()(int ix) const { return Node(ix); }
   1.122 -    int index(const Node& node) const { return node._id; }
   1.123 +    static int index(const Node& node) { return node._id; }
   1.124  
   1.125      Edge edge(const Node& u, const Node& v) const {
   1.126        if (u._id < v._id) {
   1.127 @@ -520,21 +524,23 @@
   1.128    ///
   1.129    /// \brief An undirected full graph class.
   1.130    ///
   1.131 -  /// This is a simple and fast undirected full graph
   1.132 -  /// implementation. From each node go edge to each other node,
   1.133 -  /// therefore the number of edges in the graph is \f$n(n-1)/2\f$.
   1.134 -  /// This graph type is completely static, so you can neither
   1.135 -  /// add nor delete either edges or nodes, and it needs constant
   1.136 -  /// space in memory.
   1.137 +  /// FullGraph is a simple and fast implmenetation of undirected full
   1.138 +  /// (complete) graphs. It contains an edge between every distinct pair
   1.139 +  /// of nodes, therefore the number of edges is <tt>n(n-1)/2</tt>.
   1.140 +  /// This class is completely static and it needs constant memory space.
   1.141 +  /// Thus you can neither add nor delete nodes or edges, however
   1.142 +  /// the structure can be resized using resize().
   1.143    ///
   1.144 -  /// This class fully conforms to the \ref concepts::Graph "Graph concept".
   1.145 +  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
   1.146 +  /// Most of its member functions and nested classes are documented
   1.147 +  /// only in the concept class.
   1.148    ///
   1.149 -  /// The \c FullGraph and \c FullDigraph classes are very similar,
   1.150 -  /// but there are two differences. While the \c FullDigraph class
   1.151 +  /// \note FullDigraph and FullGraph classes are very similar,
   1.152 +  /// but there are two differences. While FullDigraph
   1.153    /// conforms only to the \ref concepts::Digraph "Digraph" concept,
   1.154    /// this class conforms to the \ref concepts::Graph "Graph" concept,
   1.155 -  /// moreover \c FullGraph does not contain a loop arc for each
   1.156 -  /// node as \c FullDigraph does.
   1.157 +  /// moreover this class does not contain a loop for each
   1.158 +  /// node as FullDigraph does.
   1.159    ///
   1.160    /// \sa FullDigraph
   1.161    class FullGraph : public ExtendedFullGraphBase {
   1.162 @@ -542,7 +548,9 @@
   1.163  
   1.164    public:
   1.165  
   1.166 -    /// \brief Constructor
   1.167 +    /// \brief Default constructor.
   1.168 +    ///
   1.169 +    /// Default constructor. The number of nodes and edges will be zero.
   1.170      FullGraph() { construct(0); }
   1.171  
   1.172      /// \brief Constructor
   1.173 @@ -553,8 +561,8 @@
   1.174  
   1.175      /// \brief Resizes the graph
   1.176      ///
   1.177 -    /// Resizes the graph. The function will fully destroy and
   1.178 -    /// rebuild the graph. This cause that the maps of the graph will
   1.179 +    /// This function resizes the graph. It fully destroys and
   1.180 +    /// rebuilds the structure, therefore the maps of the graph will be
   1.181      /// reallocated automatically and the previous values will be lost.
   1.182      void resize(int n) {
   1.183        Parent::notifier(Arc()).clear();
   1.184 @@ -568,31 +576,31 @@
   1.185  
   1.186      /// \brief Returns the node with the given index.
   1.187      ///
   1.188 -    /// Returns the node with the given index. Since it is a static
   1.189 -    /// graph its nodes can be indexed with integers from the range
   1.190 -    /// <tt>[0..nodeNum()-1]</tt>.
   1.191 +    /// Returns the node with the given index. Since this structure is 
   1.192 +    /// completely static, the nodes can be indexed with integers from
   1.193 +    /// the range <tt>[0..nodeNum()-1]</tt>.
   1.194      /// \sa index()
   1.195      Node operator()(int ix) const { return Parent::operator()(ix); }
   1.196  
   1.197      /// \brief Returns the index of the given node.
   1.198      ///
   1.199 -    /// Returns the index of the given node. Since it is a static
   1.200 -    /// graph its nodes can be indexed with integers from the range
   1.201 -    /// <tt>[0..nodeNum()-1]</tt>.
   1.202 -    /// \sa operator()
   1.203 -    int index(const Node& node) const { return Parent::index(node); }
   1.204 +    /// Returns the index of the given node. Since this structure is 
   1.205 +    /// completely static, the nodes can be indexed with integers from
   1.206 +    /// the range <tt>[0..nodeNum()-1]</tt>.
   1.207 +    /// \sa operator()()
   1.208 +    static int index(const Node& node) { return Parent::index(node); }
   1.209  
   1.210      /// \brief Returns the arc connecting the given nodes.
   1.211      ///
   1.212      /// Returns the arc connecting the given nodes.
   1.213 -    Arc arc(const Node& s, const Node& t) const {
   1.214 +    Arc arc(Node s, Node t) const {
   1.215        return Parent::arc(s, t);
   1.216      }
   1.217  
   1.218 -    /// \brief Returns the edge connects the given nodes.
   1.219 +    /// \brief Returns the edge connecting the given nodes.
   1.220      ///
   1.221 -    /// Returns the edge connects the given nodes.
   1.222 -    Edge edge(const Node& u, const Node& v) const {
   1.223 +    /// Returns the edge connecting the given nodes.
   1.224 +    Edge edge(Node u, Node v) const {
   1.225        return Parent::edge(u, v);
   1.226      }
   1.227