gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Add documentation for StaticDigraph (#68)
0 1 0
default
1 file changed with 49 insertions and 0 deletions:
↑ Collapse diff ↑
Show white space 32 line context
... ...
@@ -213,39 +213,88 @@
213 213

	
214 214
  protected:
215 215
    bool built;
216 216
    int node_num;
217 217
    int arc_num;
218 218
    int *node_first_out;
219 219
    int *node_first_in;
220 220
    int *arc_source;
221 221
    int *arc_target;
222 222
    int *arc_next_in;
223 223
    int *arc_next_out;
224 224
  };
225 225

	
226 226
  typedef DigraphExtender<StaticDigraphBase> ExtendedStaticDigraphBase;
227 227

	
228 228

	
229
  /// \ingroup graphs
230
  ///
231
  /// \brief A static directed graph class.
232
  ///
233
  /// \ref StaticDigraph is a highly efficient digraph implementation,
234
  /// but it is fully static.
235
  /// It stores only two \c int values for each node and only four \c int
236
  /// values for each arc. Moreover it provides faster item iteration than
237
  /// \ref ListDigraph and \ref SmartDigraph, especially using \c OutArcIt
238
  /// iterators, since its arcs are stored in an appropriate order.
239
  /// However it only provides build() and clear() functions and does not
240
  /// support any other modification of the digraph.
241
  ///
242
  /// This type fully conforms to the \ref concepts::Digraph "Digraph concept".
243
  /// Most of its member functions and nested classes are documented
244
  /// only in the concept class.
245
  ///
246
  /// \sa concepts::Digraph
229 247
  class StaticDigraph : public ExtendedStaticDigraphBase {
230 248
  public:
231 249

	
232 250
    typedef ExtendedStaticDigraphBase Parent;
233 251
  
234 252
  public:
235 253
  
254
    /// \brief Clear the digraph.
255
    ///
256
    /// This function erases all nodes and arcs from the digraph.
257
    void clear() {
258
      Parent::clear();
259
    }
260
    
261
    /// \brief Build the digraph copying another digraph.
262
    ///
263
    /// This function builds the digraph copying another digraph of any
264
    /// kind. It can be called more than once, but in such case, the whole
265
    /// structure and all maps will be cleared and rebuilt.
266
    ///
267
    /// This method also makes possible to copy a digraph to a StaticDigraph
268
    /// structure using \ref DigraphCopy.
269
    /// 
270
    /// \param digraph An existing digraph to be copied.
271
    /// \param nodeRef The node references will be copied into this map.
272
    /// Its key type must be \c Digraph::Node and its value type must be
273
    /// \c StaticDigraph::Node.
274
    /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap"
275
    /// concept.
276
    /// \param arcRef The arc references will be copied into this map.
277
    /// Its key type must be \c Digraph::Arc and its value type must be
278
    /// \c StaticDigraph::Arc.
279
    /// It must conform to the \ref concepts::WriteMap "WriteMap" concept.
280
    ///
281
    /// \note If you do not need the arc references, then you could use
282
    /// \ref NullMap for the last parameter. However the node references
283
    /// are required by the function itself, thus they must be readable
284
    /// from the map.
236 285
    template <typename Digraph, typename NodeRefMap, typename ArcRefMap>
237 286
    void build(const Digraph& digraph, NodeRefMap& nodeRef, ArcRefMap& arcRef) {
238 287
      if (built) Parent::clear();
239 288
      Parent::build(digraph, nodeRef, arcRef);
240 289
    }
241 290
  
242 291

	
243 292
  protected:
244 293

	
245 294
    using Parent::fastFirstOut;
246 295
    using Parent::fastNextOut;
247 296
    using Parent::fastLastOut;
248 297
    
249 298
  public:
250 299

	
251 300
    class OutArcIt : public Arc {
0 comments (0 inline)