COIN-OR::LEMON - Graph Library

Changeset 686:fc8a3393e0d9 in lemon-0.x for src/work/klao


Ignore:
Timestamp:
06/16/04 11:44:30 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@934
Message:

src/work/alpar/path.h (docs) is merged into src/work/klao/path.h
(and removed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/klao/path.h

    r683 r686  
    11// -*- c++ -*- //
    22
    3 ///\ingroup datas
     3/**
     4@defgroup paths Path Structures
     5@ingroup datas
     6\brief Path structures implemented in Hugo.
     7
     8Hugolib provides flexible data structures
     9to work with paths.
     10
     11All of them have the same interface, especially they can be built or extended
     12using a standard Builder subclass. This make is easy to have e.g. the Dijkstra
     13algorithm to store its result in any kind of path structure.
     14
     15*/
     16
     17///\ingroup paths
    418///\file
    519///\brief Classes for representing paths in graphs.
     
    1832namespace hugo {
    1933
    20   /// \addtogroup datas
     34  /// \addtogroup paths
    2135  /// @{
    2236
     
    3650  class DirPath {
    3751  public:
    38     typedef typename Graph::Edge GraphEdge;
     52    /// Edge type of the underlying graph.
     53    typedef typename Graph::Edge GraphEdge;
     54    /// Node type of the underlying graph.
    3955    typedef typename Graph::Node GraphNode;
    4056    class NodeIt;
     
    153169
    154170
    155     /*** Iterator classes ***/
     171    /* Iterator classes */
     172
     173    /**
     174     * \brief Iterator class to iterate on the edges of the paths
     175     *
     176     * \ingroup paths
     177     * This class is used to iterate on the edges of the paths
     178     *
     179     * Of course it converts to Graph::Edge
     180     *
     181     * \todo Its interface differs from the standard edge iterator.
     182     * Yes, it shouldn't.
     183     */
    156184    class EdgeIt {
    157185      friend class DirPath;
     
    160188      const DirPath *p;
    161189    public:
     190      /// Default constructor
    162191      EdgeIt() {}
     192      /// Invalid constructor
    163193      EdgeIt(Invalid) : idx(-1), p(0) {}
     194      /// Constructor with starting point
    164195      EdgeIt(const DirPath &_p, int _idx = 0) :
    165196        idx(_idx), p(&_p) { validate(); }
    166197
     198      ///Validity check
    167199      bool valid() const { return idx!=-1; }
    168200
     201      ///Conversion to Graph::Edge
    169202      operator GraphEdge () const {
    170203        return valid() ? p->edges[idx] : INVALID;
    171204      }
     205
     206      /// Next edge
    172207      EdgeIt& operator++() { ++idx; validate(); return *this; }
    173208
     209      /// Comparison operator
    174210      bool operator==(const EdgeIt& e) const { return idx==e.idx; }
     211      /// Comparison operator
    175212      bool operator!=(const EdgeIt& e) const { return idx!=e.idx; }
     213      /// Comparison operator
    176214      bool operator<(const EdgeIt& e) const { return idx<e.idx; }
    177215
     
    182220    };
    183221
     222    /**
     223     * \brief Iterator class to iterate on the nodes of the paths
     224     *
     225     * \ingroup paths
     226     * This class is used to iterate on the nodes of the paths
     227     *
     228     * Of course it converts to Graph::Node
     229     *
     230     * \todo Its interface differs from the standard node iterator.
     231     * Yes, it shouldn't.
     232     */
    184233    class NodeIt {
    185234      friend class DirPath;
     
    188237      const DirPath *p;
    189238    public:
     239      /// Default constructor
    190240      NodeIt() {}
     241      /// Invalid constructor
    191242      NodeIt(Invalid) : idx(-1), p(0) {}
     243      /// Constructor with starting point
    192244      NodeIt(const DirPath &_p, int _idx = 0) :
    193245        idx(_idx), p(&_p) { validate(); }
    194246
     247      ///Validity check
    195248      bool valid() const { return idx!=-1; }
    196249
     250      ///Conversion to Graph::Node
    197251      operator const GraphNode& () const {
    198252        if(idx >= p->length())
     
    203257          return INVALID;
    204258      }
     259      /// Next node
    205260      NodeIt& operator++() { ++idx; validate(); return *this; }
    206261
     262      /// Comparison operator
    207263      bool operator==(const NodeIt& e) const { return idx==e.idx; }
     264      /// Comparison operator
    208265      bool operator!=(const NodeIt& e) const { return idx!=e.idx; }
     266      /// Comparison operator
    209267      bool operator<(const NodeIt& e) const { return idx<e.idx; }
    210268
     
    218276     * \brief Class to build paths
    219277     *
    220      * \ingroup datas
     278     * \ingroup paths
    221279     * This class is used to fill a path with edges.
    222280     *
     
    286344      // FIXME: Hmm, pontosan hogy is kene ezt csinalni?
    287345      // Hogy kenyelmes egy ilyet hasznalni?
     346 
     347      ///Reserve storage in advance for the builder
     348
     349      ///If you know an reasonable upper bound of the number of the edges
     350      ///to add, using this function you can speed up the building.
    288351      void reserve(size_t r) {
    289352        front.reserve(r);
     
    350413  class UndirPath {
    351414  public:
     415    /// Edge type of the underlying graph.
    352416    typedef typename Graph::Edge GraphEdge;
    353     typedef typename Graph::Node GraphNode;
     417     /// Node type of the underlying graph.
     418   typedef typename Graph::Node GraphNode;
    354419    class NodeIt;
    355420    class EdgeIt;
     
    467532
    468533
    469     /*** Iterator classes ***/
     534
     535    /**
     536     * \brief Iterator class to iterate on the edges of the paths
     537     *
     538     * \ingroup paths
     539     * This class is used to iterate on the edges of the paths
     540     *
     541     * Of course it converts to Graph::Edge
     542     *
     543     * \todo Its interface differs from the standard edge iterator.
     544     * Yes, it shouldn't.
     545     */
    470546    class EdgeIt {
    471547      friend class UndirPath;
     
    474550      const UndirPath *p;
    475551    public:
     552      /// Default constructor
    476553      EdgeIt() {}
     554      /// Invalid constructor
    477555      EdgeIt(Invalid) : idx(-1), p(0) {}
     556      /// Constructor with starting point
    478557      EdgeIt(const UndirPath &_p, int _idx = 0) :
    479558        idx(_idx), p(&_p) { validate(); }
    480559
     560      ///Validity check
    481561      bool valid() const { return idx!=-1; }
    482562
     563      ///Conversion to Graph::Edge
    483564      operator GraphEdge () const {
    484565        return valid() ? p->edges[idx] : INVALID;
    485566      }
    486       EdgeIt& operator++() { ++idx; validate(); return *this; }
    487 
     567      /// Next edge
     568     EdgeIt& operator++() { ++idx; validate(); return *this; }
     569
     570      /// Comparison operator
    488571      bool operator==(const EdgeIt& e) const { return idx==e.idx; }
     572      /// Comparison operator
    489573      bool operator!=(const EdgeIt& e) const { return idx!=e.idx; }
     574      /// Comparison operator
    490575      bool operator<(const EdgeIt& e) const { return idx<e.idx; }
    491576
     
    496581    };
    497582
     583    /**
     584     * \brief Iterator class to iterate on the nodes of the paths
     585     *
     586     * \ingroup paths
     587     * This class is used to iterate on the nodes of the paths
     588     *
     589     * Of course it converts to Graph::Node
     590     *
     591     * \todo Its interface differs from the standard node iterator.
     592     * Yes, it shouldn't.
     593     */
    498594    class NodeIt {
    499595      friend class UndirPath;
     
    502598      const UndirPath *p;
    503599    public:
     600      /// Default constructor
    504601      NodeIt() {}
     602      /// Invalid constructor
    505603      NodeIt(Invalid) : idx(-1), p(0) {}
     604      /// Constructor with starting point
    506605      NodeIt(const UndirPath &_p, int _idx = 0) :
    507606        idx(_idx), p(&_p) { validate(); }
    508607
     608      ///Validity check
    509609      bool valid() const { return idx!=-1; }
    510610
     611      ///Conversion to Graph::Node
    511612      operator const GraphNode& () const {
    512613        if(idx >= p->length())
     
    517618          return INVALID;
    518619      }
     620      /// Next node
    519621      NodeIt& operator++() { ++idx; validate(); return *this; }
    520622
     623      /// Comparison operator
    521624      bool operator==(const NodeIt& e) const { return idx==e.idx; }
     625      /// Comparison operator
    522626      bool operator!=(const NodeIt& e) const { return idx!=e.idx; }
    523       bool operator<(const NodeIt& e) const { return idx<e.idx; }
     627       /// Comparison operator
     628     bool operator<(const NodeIt& e) const { return idx<e.idx; }
    524629
    525630    private:
     
    532637     * \brief Class to build paths
    533638     *
    534      * \ingroup datas
     639     * \ingroup paths
    535640     * This class is used to fill a path with edges.
    536641     *
     
    600705      // FIXME: Hmm, pontosan hogy is kene ezt csinalni?
    601706      // Hogy kenyelmes egy ilyet hasznalni?
    602       void reserve(size_t r) {
     707
     708      ///Reserve storage in advance for the builder
     709
     710      ///If you know an reasonable upper bound of the number of the edges
     711      ///to add, using this function you can speed up the building.
     712       void reserve(size_t r) {
    603713        front.reserve(r);
    604714        back.reserve(r);
Note: See TracChangeset for help on using the changeset viewer.