1.1 --- a/lemon/full_graph.h Thu Dec 10 17:05:35 2009 +0100
1.2 +++ b/lemon/full_graph.h Thu Dec 10 17:18:25 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,28 @@
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 + /// This class provides constant time counting for nodes and arcs.
1.50 + ///
1.51 + /// \note FullDigraph and FullGraph classes are very similar,
1.52 /// but there are two differences. While this class conforms only
1.53 - /// to the \ref concepts::Digraph "Digraph" concept, the \c FullGraph
1.54 - /// class conforms to the \ref concepts::Graph "Graph" concept,
1.55 - /// moreover \c FullGraph does not contain a loop arc for each
1.56 - /// node as \c FullDigraph does.
1.57 + /// to the \ref concepts::Digraph "Digraph" concept, FullGraph
1.58 + /// conforms to the \ref concepts::Graph "Graph" concept,
1.59 + /// moreover FullGraph does not contain a loop for each
1.60 + /// node as this class does.
1.61 ///
1.62 /// \sa FullGraph
1.63 class FullDigraph : public ExtendedFullDigraphBase {
1.64 @@ -173,7 +177,9 @@
1.65
1.66 public:
1.67
1.68 - /// \brief Constructor
1.69 + /// \brief Default constructor.
1.70 + ///
1.71 + /// Default constructor. The number of nodes and arcs will be zero.
1.72 FullDigraph() { construct(0); }
1.73
1.74 /// \brief Constructor
1.75 @@ -184,8 +190,8 @@
1.76
1.77 /// \brief Resizes the digraph
1.78 ///
1.79 - /// Resizes the digraph. The function will fully destroy and
1.80 - /// rebuild the digraph. This cause that the maps of the digraph will
1.81 + /// This function resizes the digraph. It fully destroys and
1.82 + /// rebuilds the structure, therefore the maps of the digraph will be
1.83 /// reallocated automatically and the previous values will be lost.
1.84 void resize(int n) {
1.85 Parent::notifier(Arc()).clear();
1.86 @@ -197,24 +203,26 @@
1.87
1.88 /// \brief Returns the node with the given index.
1.89 ///
1.90 - /// Returns the node with the given index. Since it is a static
1.91 - /// digraph its nodes can be indexed with integers from the range
1.92 - /// <tt>[0..nodeNum()-1]</tt>.
1.93 + /// Returns the node with the given index. Since this structure is
1.94 + /// completely static, the nodes can be indexed with integers from
1.95 + /// the range <tt>[0..nodeNum()-1]</tt>.
1.96 + /// The index of a node is the same as its ID.
1.97 /// \sa index()
1.98 Node operator()(int ix) const { return Parent::operator()(ix); }
1.99
1.100 /// \brief Returns the index of the given node.
1.101 ///
1.102 - /// Returns the index of the given node. Since it is a static
1.103 - /// digraph its nodes can be indexed with integers from the range
1.104 - /// <tt>[0..nodeNum()-1]</tt>.
1.105 - /// \sa operator()
1.106 - int index(const Node& node) const { return Parent::index(node); }
1.107 + /// Returns the index of the given node. Since this structure is
1.108 + /// completely static, the nodes can be indexed with integers from
1.109 + /// the range <tt>[0..nodeNum()-1]</tt>.
1.110 + /// The index of a node is the same as its ID.
1.111 + /// \sa operator()()
1.112 + static int index(const Node& node) { return Parent::index(node); }
1.113
1.114 /// \brief Returns the arc connecting the given nodes.
1.115 ///
1.116 /// Returns the arc connecting the given nodes.
1.117 - Arc arc(const Node& u, const Node& v) const {
1.118 + Arc arc(Node u, Node v) const {
1.119 return Parent::arc(u, v);
1.120 }
1.121
1.122 @@ -283,7 +291,7 @@
1.123 public:
1.124
1.125 Node operator()(int ix) const { return Node(ix); }
1.126 - int index(const Node& node) const { return node._id; }
1.127 + static int index(const Node& node) { return node._id; }
1.128
1.129 Edge edge(const Node& u, const Node& v) const {
1.130 if (u._id < v._id) {
1.131 @@ -520,21 +528,25 @@
1.132 ///
1.133 /// \brief An undirected full graph class.
1.134 ///
1.135 - /// This is a simple and fast undirected full graph
1.136 - /// implementation. From each node go edge to each other node,
1.137 - /// therefore the number of edges in the graph is \f$n(n-1)/2\f$.
1.138 - /// This graph type is completely static, so you can neither
1.139 - /// add nor delete either edges or nodes, and it needs constant
1.140 - /// space in memory.
1.141 + /// FullGraph is a simple and fast implmenetation of undirected full
1.142 + /// (complete) graphs. It contains an edge between every distinct pair
1.143 + /// of nodes, therefore the number of edges is <tt>n(n-1)/2</tt>.
1.144 + /// This class is completely static and it needs constant memory space.
1.145 + /// Thus you can neither add nor delete nodes or edges, however
1.146 + /// the structure can be resized using resize().
1.147 ///
1.148 - /// This class fully conforms to the \ref concepts::Graph "Graph concept".
1.149 + /// This type fully conforms to the \ref concepts::Graph "Graph concept".
1.150 + /// Most of its member functions and nested classes are documented
1.151 + /// only in the concept class.
1.152 ///
1.153 - /// The \c FullGraph and \c FullDigraph classes are very similar,
1.154 - /// but there are two differences. While the \c FullDigraph class
1.155 + /// This class provides constant time counting for nodes, edges and arcs.
1.156 + ///
1.157 + /// \note FullDigraph and FullGraph classes are very similar,
1.158 + /// but there are two differences. While FullDigraph
1.159 /// conforms only to the \ref concepts::Digraph "Digraph" concept,
1.160 /// this class conforms to the \ref concepts::Graph "Graph" concept,
1.161 - /// moreover \c FullGraph does not contain a loop arc for each
1.162 - /// node as \c FullDigraph does.
1.163 + /// moreover this class does not contain a loop for each
1.164 + /// node as FullDigraph does.
1.165 ///
1.166 /// \sa FullDigraph
1.167 class FullGraph : public ExtendedFullGraphBase {
1.168 @@ -542,7 +554,9 @@
1.169
1.170 public:
1.171
1.172 - /// \brief Constructor
1.173 + /// \brief Default constructor.
1.174 + ///
1.175 + /// Default constructor. The number of nodes and edges will be zero.
1.176 FullGraph() { construct(0); }
1.177
1.178 /// \brief Constructor
1.179 @@ -553,8 +567,8 @@
1.180
1.181 /// \brief Resizes the graph
1.182 ///
1.183 - /// Resizes the graph. The function will fully destroy and
1.184 - /// rebuild the graph. This cause that the maps of the graph will
1.185 + /// This function resizes the graph. It fully destroys and
1.186 + /// rebuilds the structure, therefore the maps of the graph will be
1.187 /// reallocated automatically and the previous values will be lost.
1.188 void resize(int n) {
1.189 Parent::notifier(Arc()).clear();
1.190 @@ -568,31 +582,33 @@
1.191
1.192 /// \brief Returns the node with the given index.
1.193 ///
1.194 - /// Returns the node with the given index. Since it is a static
1.195 - /// graph its nodes can be indexed with integers from the range
1.196 - /// <tt>[0..nodeNum()-1]</tt>.
1.197 + /// Returns the node with the given index. Since this structure is
1.198 + /// completely static, the nodes can be indexed with integers from
1.199 + /// the range <tt>[0..nodeNum()-1]</tt>.
1.200 + /// The index of a node is the same as its ID.
1.201 /// \sa index()
1.202 Node operator()(int ix) const { return Parent::operator()(ix); }
1.203
1.204 /// \brief Returns the index of the given node.
1.205 ///
1.206 - /// Returns the index of the given node. Since it is a static
1.207 - /// graph its nodes can be indexed with integers from the range
1.208 - /// <tt>[0..nodeNum()-1]</tt>.
1.209 - /// \sa operator()
1.210 - int index(const Node& node) const { return Parent::index(node); }
1.211 + /// Returns the index of the given node. Since this structure is
1.212 + /// completely static, the nodes can be indexed with integers from
1.213 + /// the range <tt>[0..nodeNum()-1]</tt>.
1.214 + /// The index of a node is the same as its ID.
1.215 + /// \sa operator()()
1.216 + static int index(const Node& node) { return Parent::index(node); }
1.217
1.218 /// \brief Returns the arc connecting the given nodes.
1.219 ///
1.220 /// Returns the arc connecting the given nodes.
1.221 - Arc arc(const Node& s, const Node& t) const {
1.222 + Arc arc(Node s, Node t) const {
1.223 return Parent::arc(s, t);
1.224 }
1.225
1.226 - /// \brief Returns the edge connects the given nodes.
1.227 + /// \brief Returns the edge connecting the given nodes.
1.228 ///
1.229 - /// Returns the edge connects the given nodes.
1.230 - Edge edge(const Node& u, const Node& v) const {
1.231 + /// Returns the edge connecting the given nodes.
1.232 + Edge edge(Node u, Node v) const {
1.233 return Parent::edge(u, v);
1.234 }
1.235