StaticPath
Declared in lemon/path.h, in the group Path Structures; the same class on the Doxygen site.
-
template< typename GR >
class StaticPath A structure for representing directed paths in a digraph.
A structure for representing directed path in a digraph.
In a sense, a path can be treated as a list of arcs. The LEMON path type simply stores this list. As a consequence, it cannot enumerate the nodes in the path, and the source node of a zero-length path is undefined.
This implementation is completly static, i.e. it can be copy constucted or copy assigned from another path, but otherwise it cannot be modified.
Being the most memory-efficient path type in LEMON, it is intented to be used when you want to store a large number of paths.
- Template Parameters:
GR – The digraph type in which the path is.
Public Functions
-
inline StaticPath()
Default constructor
-
inline StaticPath( const StaticPath & cpath )
Copy constructor.
-
template< typename CPath >
inline StaticPath( const CPath & cpath ) Template copy constructor.
This path can be initialized from any other path type.
-
inline ~StaticPath()
Destructor of the path
-
inline StaticPath & operator=( const StaticPath & cpath )
Copy assignment.
-
template< typename CPath >
inline StaticPath & operator=( const CPath & cpath ) Template copy assignment.
This path can be made equal to any other path type. It simply makes a copy of the given path.
-
inline LemonRangeWrapper1< ArcIt , StaticPath > 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 );
-
inline const Arc & nth( int n ) const
The n-th arc.
Gives back the n-th arc. This function runs in O(1) time.
- Pre:
nis in the range[0..length() - 1].
-
inline const Arc & operator[]( int n ) const
The n-th arc.
Gives back the n-th arc. This operator is just an alias for nth(), it runs in O(1) time.
- Pre:
nis in the range[0..length() - 1].
-
inline int length() const
The length of the path.
-
inline int empty() const
Return true when the path is empty.
-
inline void clear()
Reset the path to an empty one.
-
class ArcIt
Iterator class to iterate on the arcs of the paths.
This class is used to iterate on the arcs of the paths
Of course it converts to Digraph::Arc
Public Functions
-
inline ArcIt()
Default constructor.
-
inline ArcIt( const StaticPath & _path )
Initializate the constructor to the first arc of path.
-
inline ArcIt()