Changeset 798:f5f260a63a9b in lemon for lemon/path.h

Ignore:
Timestamp:
10/12/09 16:37:13 (13 years ago)
Branch:
default
Parents:
797:b7e3662faf02 (diff), 548: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

Unmodified
Removed
• lemon/path.h

 r548 * This file is a part of LEMON, a generic C++ optimization library. * * Copyright (C) 2003-2008 * Copyright (C) 2003-2009 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). /// /// A structure for representing directed path in a digraph. /// \tparam _Digraph The digraph type in which the path is. /// \tparam GR The digraph type in which the path is. /// /// In a sense, the path can be treated as a list of arcs. The /// implementation uses two vectors for storing the front and back /// insertions. template template class Path { public: typedef _Digraph Digraph; typedef GR Digraph; typedef typename Digraph::Arc Arc; /// \brief The nth arc. /// /// \pre n is in the [0..length() - 1] range /// \pre \c n is in the [0..length() - 1] range. const Arc& nth(int n) const { return n < int(head.size()) ? *(head.rbegin() + n) : /// \brief Initialize arc iterator to point to the nth arc /// /// \pre n is in the [0..length() - 1] range /// \pre \c n is in the [0..length() - 1] range. ArcIt nthIt(int n) const { return ArcIt(*this, n); /// /// A structure for representing directed path in a digraph. /// \tparam _Digraph The digraph type in which the path is. /// \tparam GR The digraph type in which the path is. /// /// In a sense, the path can be treated as a list of arcs. The /// then the \c Path type because it use just one vector for the /// arcs. template template class SimplePath { public: typedef _Digraph Digraph; typedef GR Digraph; typedef typename Digraph::Arc Arc; /// \brief The nth arc. /// /// \pre n is in the [0..length() - 1] range /// \pre \c n is in the [0..length() - 1] range. const Arc& nth(int n) const { return data[n]; /// /// A structure for representing directed path in a digraph. /// \tparam _Digraph The digraph type in which the path is. /// \tparam GR The digraph type in which the path is. /// /// In a sense, the path can be treated as a list of arcs. The /// time. The front and back insertion and erasure is O(1) time /// and it can be splited and spliced in O(1) time. template template class ListPath { public: typedef _Digraph Digraph; typedef GR Digraph; typedef typename Digraph::Arc Arc; /// /// This function looks for the nth arc in O(n) time. /// \pre n is in the [0..length() - 1] range /// \pre \c n is in the [0..length() - 1] range. const Arc& nth(int n) const { Node *node = first; /// /// A structure for representing directed path in a digraph. /// \tparam _Digraph The digraph type in which the path is. /// \tparam GR The digraph type in which the path is. /// /// In a sense, the path can be treated as a list of arcs. The /// it is intented to be /// used when you want to store a large number of paths. template template class StaticPath { public: typedef _Digraph Digraph; typedef GR Digraph; typedef typename Digraph::Arc Arc; /// \brief The nth arc. /// /// \pre n is in the [0..length() - 1] range /// \pre \c n is in the [0..length() - 1] range. const Arc& nth(int n) const { return arcs[n];
• lemon/path.h

 r606 /// \brief The source of a path /// /// This function returns the source of the given path. /// This function returns the source node of the given path. /// If the path is empty, then it returns \c INVALID. template typename Digraph::Node pathSource(const Digraph& digraph, const Path& path) { return digraph.source(path.front()); return path.empty() ? INVALID : digraph.source(path.front()); } /// \brief The target of a path /// /// This function returns the target of the given path. /// This function returns the target node of the given path. /// If the path is empty, then it returns \c INVALID. template typename Digraph::Node pathTarget(const Digraph& digraph, const Path& path) { return digraph.target(path.back()); return path.empty() ? INVALID : digraph.target(path.back()); }
Note: See TracChangeset for help on using the changeset viewer.