abLEMON 1.9.0-101-gccb8629
A maintained fork of LEMON
Loading...
Searching...
No Matches
StaticPath< GR > Class Template Reference

A structure for representing directed paths in a digraph. More...

#include <lemon/path.h>

Classes

class  ArcIt
 Iterator class to iterate on the arcs of the paths. More...

Public Member Functions

 StaticPath ()
 Default constructor.
 StaticPath (const StaticPath &cpath)
 Copy constructor.
template< typename CPath >
 StaticPath (const CPath &cpath)
 Template copy constructor.
 ~StaticPath ()
 Destructor of the path.
StaticPath & operator= (const StaticPath &cpath)
 Copy assignment.
template< typename CPath >
StaticPath & operator= (const CPath &cpath)
 Template copy assignment.
LemonRangeWrapper1< ArcIt , StaticPath > arcs () const
 Gets the collection of the arcs of the path.
const Arc & nth (int n) const
 The n-th arc.
ArcIt nthIt (int n) const
 The arc iterator pointing to the n-th arc.
const Arc & operator[] (int n) const
 The n-th arc.
int length () const
 The length of the path.
int empty () const
 Return true when the path is empty.
void clear ()
 Reset the path to an empty one.
const Arc & front () const
 The first arc of the path.
const Arc & back () const
 The last arc of the path.

Detailed Description

template< typename GR >
class lemon::StaticPath< GR >

A structure for representing directed path in a digraph.

Template Parameters
GRThe digraph type in which the path is.

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.

Constructor & Destructor Documentation

◆ StaticPath() [1/2]

template< typename GR >
StaticPath ( )
inline

Default constructor

◆ StaticPath() [2/2]

template< typename GR >
template< typename CPath >
StaticPath ( const CPath & cpath)
inline

This path can be initialized from any other path type.

◆ ~StaticPath()

template< typename GR >
~StaticPath ( )
inline

Destructor of the path

Member Function Documentation

◆ operator=()

template< typename GR >
template< typename CPath >
StaticPath & operator= ( const CPath & cpath)
inline

This path can be made equal to any other path type. It simply makes a copy of the given path.

◆ arcs()

template< typename GR >
LemonRangeWrapper1< ArcIt , StaticPath > arcs ( ) const
inline

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 );

◆ nth()

template< typename GR >
const Arc & nth ( int n) const
inline

Gives back the n-th arc. This function runs in O(1) time.

Precondition
n is in the range [0..length() - 1].

◆ operator[]()

template< typename GR >
const Arc & operator[] ( int n) const
inline

Gives back the n-th arc. This operator is just an alias for nth(), it runs in O(1) time.

Precondition
n is in the range [0..length() - 1].