concepts::Path
Declared in lemon/concepts/path.h, in the group Concepts; the same class on the Doxygen site.
-
template< typename GR >
class Path A skeleton structure for representing directed paths in a digraph. In a sense, a path can be treated as a list of arcs. LEMON path types just store this list. As a consequence, they cannot enumerate the nodes on the path directly and a zero length path cannot store its source node.
The arcs of a path should be stored in the order of their directions, i.e. the target node of each arc should be the same as the source node of the next arc. This consistency could be checked using checkPath(). The source and target nodes of a (consistent) path can be obtained using pathSource() and pathTarget().
A path can be constructed from another path of any type using the copy constructor or the assignment operator.
- Template Parameters:
GR – The digraph type in which the path is.
Public Types
Public Functions
-
inline Path()
Default constructor.
-
template< typename CPath >
inline Path & operator=( const CPath & cpath ) Template assigment operator.
-
inline int length() const
Length of the path, i.e. the number of arcs on the path.
-
inline bool empty() const
Returns whether the path is empty.
-
inline void clear()
Resets the path to an empty path.
-
inline LemonRangeWrapper1< ArcIt , Path > arcs() const
Gets the collection of the arcs of the path.
This function can be used for iterating on the arcs of the path. It returns a wrapped ArcIt, which looks like an STL container (by having begin() and end()) which you can use in range-based for loops, STL algorithms, etc. For example you can write:
for( auto a : p.arcs() ) doSomething( a );