All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Classes | Public Member Functions
Path< GR > Class Template Reference

Detailed Description

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

A structure for representing directed path in a digraph.

Template Parameters
GRThe digraph type in which the path is.

In a sense, the path can be treated as a list of arcs. The LEMON path type stores just this list. As a consequence, it cannot enumerate the nodes of the path and the source node of a zero length path is undefined.

This implementation is a back and front insertable and erasable path type. It can be indexed in O(1) time. The front and back insertion and erase is done in O(1) (amortized) time. The implementation uses two vectors for storing the front and back insertions.

#include <lemon/path.h>

Classes

class  ArcIt
 LEMON style iterator for path arcs. More...
 

Public Member Functions

 Path ()
 Default constructor. More...
 
 Path (const Path &cpath)
 Copy constructor.
 
template<typename CPath >
 Path (const CPath &cpath)
 Template copy constructor. More...
 
Pathoperator= (const Path &cpath)
 Copy assignment.
 
template<typename CPath >
Pathoperator= (const CPath &cpath)
 Template copy assignment. More...
 
int length () const
 Length of the path.
 
bool empty () const
 Return whether the path is empty.
 
void clear ()
 Reset the path to an empty one.
 
const Arc & nth (int n) const
 The n-th arc. More...
 
ArcIt nthIt (int n) const
 Initialize arc iterator to point to the n-th arc. More...
 
const Arc & front () const
 The first arc of the path.
 
void addFront (const Arc &arc)
 Add a new arc before the current path.
 
void eraseFront ()
 Erase the first arc of the path.
 
const Arc & back () const
 The last arc of the path.
 
void addBack (const Arc &arc)
 Add a new arc behind the current path.
 
void eraseBack ()
 Erase the last arc of the path.
 

Constructor & Destructor Documentation

Path ( )
inline

Default constructor

Path ( const CPath< GR > &  cpath)
inline

This constuctor initializes the path from any other path type. It simply makes a copy of the given path.

Member Function Documentation

Path& operator= ( const CPath< GR > &  cpath)
inline

This operator makes a copy of a path of any other type.

const Arc& nth ( int  n) const
inline
Precondition
n is in the [0..length() - 1] range.
ArcIt nthIt ( int  n) const
inline
Precondition
n is in the [0..length() - 1] range.