COIN-OR::LEMON - Graph Library

Changeset 751:f5f260a63a9b in lemon-main


Ignore:
Timestamp:
10/12/09 16:37:13 (15 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Parents:
750:b7e3662faf02 (diff), 514:41bdb4d6c8c3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge bugfix in #250

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/path.h

    r514 r751  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2009
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    4141  ///
    4242  /// A structure for representing directed path in a digraph.
    43   /// \tparam _Digraph The digraph type in which the path is.
     43  /// \tparam GR The digraph type in which the path is.
    4444  ///
    4545  /// In a sense, the path can be treated as a list of arcs. The
     
    5353  /// implementation uses two vectors for storing the front and back
    5454  /// insertions.
    55   template <typename _Digraph>
     55  template <typename GR>
    5656  class Path {
    5757  public:
    5858
    59     typedef _Digraph Digraph;
     59    typedef GR Digraph;
    6060    typedef typename Digraph::Arc Arc;
    6161
     
    138138    /// \brief The nth arc.
    139139    ///
    140     /// \pre n is in the [0..length() - 1] range
     140    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
    141141    const Arc& nth(int n) const {
    142142      return n < int(head.size()) ? *(head.rbegin() + n) :
     
    146146    /// \brief Initialize arc iterator to point to the nth arc
    147147    ///
    148     /// \pre n is in the [0..length() - 1] range
     148    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
    149149    ArcIt nthIt(int n) const {
    150150      return ArcIt(*this, n);
     
    229229  ///
    230230  /// A structure for representing directed path in a digraph.
    231   /// \tparam _Digraph The digraph type in which the path is.
     231  /// \tparam GR The digraph type in which the path is.
    232232  ///
    233233  /// In a sense, the path can be treated as a list of arcs. The
     
    241241  /// then the \c Path type because it use just one vector for the
    242242  /// arcs.
    243   template <typename _Digraph>
     243  template <typename GR>
    244244  class SimplePath {
    245245  public:
    246246
    247     typedef _Digraph Digraph;
     247    typedef GR Digraph;
    248248    typedef typename Digraph::Arc Arc;
    249249
     
    330330    /// \brief The nth arc.
    331331    ///
    332     /// \pre n is in the [0..length() - 1] range
     332    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
    333333    const Arc& nth(int n) const {
    334334      return data[n];
     
    393393  ///
    394394  /// A structure for representing directed path in a digraph.
    395   /// \tparam _Digraph The digraph type in which the path is.
     395  /// \tparam GR The digraph type in which the path is.
    396396  ///
    397397  /// In a sense, the path can be treated as a list of arcs. The
     
    405405  /// time. The front and back insertion and erasure is O(1) time
    406406  /// and it can be splited and spliced in O(1) time.
    407   template <typename _Digraph>
     407  template <typename GR>
    408408  class ListPath {
    409409  public:
    410410
    411     typedef _Digraph Digraph;
     411    typedef GR Digraph;
    412412    typedef typename Digraph::Arc Arc;
    413413
     
    508508    ///
    509509    /// This function looks for the nth arc in O(n) time.
    510     /// \pre n is in the [0..length() - 1] range
     510    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
    511511    const Arc& nth(int n) const {
    512512      Node *node = first;
     
    733733  ///
    734734  /// A structure for representing directed path in a digraph.
    735   /// \tparam _Digraph The digraph type in which the path is.
     735  /// \tparam GR The digraph type in which the path is.
    736736  ///
    737737  /// In a sense, the path can be treated as a list of arcs. The
     
    747747  /// it is intented to be
    748748  /// used when you want to store a large number of paths.
    749   template <typename _Digraph>
     749  template <typename GR>
    750750  class StaticPath {
    751751  public:
    752752
    753     typedef _Digraph Digraph;
     753    typedef GR Digraph;
    754754    typedef typename Digraph::Arc Arc;
    755755
     
    834834    /// \brief The nth arc.
    835835    ///
    836     /// \pre n is in the [0..length() - 1] range
     836    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
    837837    const Arc& nth(int n) const {
    838838      return arcs[n];
  • lemon/path.h

    r559 r751  
    10161016  /// \brief The source of a path
    10171017  ///
    1018   /// This function returns the source of the given path.
     1018  /// This function returns the source node of the given path.
     1019  /// If the path is empty, then it returns \c INVALID.
    10191020  template <typename Digraph, typename Path>
    10201021  typename Digraph::Node pathSource(const Digraph& digraph, const Path& path) {
    1021     return digraph.source(path.front());
     1022    return path.empty() ? INVALID : digraph.source(path.front());
    10221023  }
    10231024
    10241025  /// \brief The target of a path
    10251026  ///
    1026   /// This function returns the target of the given path.
     1027  /// This function returns the target node of the given path.
     1028  /// If the path is empty, then it returns \c INVALID.
    10271029  template <typename Digraph, typename Path>
    10281030  typename Digraph::Node pathTarget(const Digraph& digraph, const Path& path) {
    1029     return digraph.target(path.back());
     1031    return path.empty() ? INVALID : digraph.target(path.back());
    10301032  }
    10311033
Note: See TracChangeset for help on using the changeset viewer.