Graph | The graph type in which the path is. |
This implementation is a back and front insertable and erasable path type. It can be indexed in O(k) time, where k is the rank of the edge in the path. The length can be computed in O(n) time. The front and back insertion and erasure is O(1) time and it can be splited and spliced in O(1) time. #include <lemon/path.h>
Classes | |
class | EdgeIt |
Iterator class to iterate on the edges of the paths. More... | |
Public Member Functions | |
ListPath () | |
Default constructor. | |
template<typename CPath > | |
ListPath (const CPath &cpath) | |
Template copy constructor. | |
~ListPath () | |
Destructor of the path. | |
template<typename CPath > | |
ListPath & | operator= (const CPath &cpath) |
Template copy assignment. | |
const Edge & | nth (int n) const |
Gives back the nth edge. | |
EdgeIt | nthIt (int n) const |
Initializes edge iterator to point to the nth edge. | |
int | length () const |
Length of the path. | |
bool | empty () const |
Returns whether the path is empty. | |
void | clear () |
Resets the path to an empty path. | |
const Edge & | front () const |
Gives back the first edge of the path. | |
void | addFront (const Edge &edge) |
Add a new edge before the current path. | |
void | eraseFront () |
Erase the first edge of the path. | |
const Edge & | back () const |
Gives back the last edge of the path. | |
void | addBack (const Edge &edge) |
Add a new edge behind the current path. | |
void | eraseBack () |
Erase the last edge of the path. | |
void | spliceBack (ListPath &tpath) |
Splicing the given path to the current path. | |
void | spliceFront (ListPath &tpath) |
Splicing the given path to the current path. | |
void | splice (EdgeIt it, ListPath &tpath) |
Splicing the given path into the current path. | |
void | split (EdgeIt it, ListPath &tpath) |
Spliting the current path. |
ListPath | ( | ) | [inline] |
Default constructor
ListPath | ( | const CPath & | cpath | ) | [inline] |
This path can be initialized with any other path type. It just makes a copy of the given path.
~ListPath | ( | ) | [inline] |
Destructor of the path
ListPath& 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 Edge& nth | ( | int | n | ) | const [inline] |
Gives back the nth edge in O(n) time.
void spliceBack | ( | ListPath< _Graph > & | tpath | ) | [inline] |
It splices the tpath
to the back of the current path and tpath
becomes empty. The time complexity of this function is O(1).
void spliceFront | ( | ListPath< _Graph > & | tpath | ) | [inline] |
It splices the tpath
before the current path and tpath
becomes empty. The time complexity of this function is O(1).
It splices the tpath
into the current path before the position of it
iterator and tpath
becomes empty. The time complexity of this function is O(1). If the it
is INVALID
then it will splice behind the current path.
It splits the current path into two parts. The part before it
iterator will remain in the current path and the part from the it will put into the tpath
. If the tpath
had edges before the operation they will be removed first. The time complexity of this function is O(1) plus the clearing of tpath
. If the it
is INVALID
then it just clears tpath
.