Classes | Public Member Functions

SimplePath< GR > Class Template Reference


Detailed Description

template<typename GR>
class lemon::SimplePath< 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 in the path and the zero length paths cannot store the source.

This implementation is a just back insertable and erasable path type. It can be indexed in O(1) time. The back insertion and erasure is amortized O(1) time. This implementation is faster then the Path type because it use just one vector for the arcs.

#include <lemon/path.h>

List of all members.

Classes

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

Public Member Functions

 SimplePath ()
 Default constructor.
template<typename CPath >
 SimplePath (const CPath &cpath)
 Template copy constructor.
template<typename CPath >
SimplePathoperator= (const CPath &cpath)
 Template copy assignment.
int length () const
 Length of the path.
bool empty () const
 Return true if the path is empty.
void clear ()
 Reset the path to an empty one.
const Arc & nth (int n) const
 The nth arc.
ArcIt nthIt (int n) const
 Initializes arc iterator to point to the nth arc.
const Arc & front () const
 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

SimplePath ( ) [inline]

Default constructor

SimplePath ( const CPath &  cpath) [inline]

This path can be initialized with any other path type. It just makes a copy of the given path.


Member Function Documentation

SimplePath& operator= ( const CPath &  cpath) [inline]

This path can be initialized with any other path type. It just makes a copy of the given path.

const Arc& nth ( int  n) const [inline]
Precondition:
n is in the [0..length() - 1] range.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines