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

Detailed Description

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

This iterator provides an Euler tour (Eulerian circuit) of an undirected graph (if there exists) and it converts to the Arc and Edge types of the graph.

For example, if the given graph has an Euler tour (i.e it has only one non-trivial component and the degree of each node is even), the following code will print the arc IDs according to an Euler tour of g.

for(EulerIt<ListGraph> e(g); e!=INVALID; ++e) {
std::cout << g.id(Edge(e)) << std::eol;
}

Although this iterator is for undirected graphs, it still returns arcs in order to indicate the direction of the tour. (But arcs convert to edges, of course.)

If g has no Euler tour, then the resulted walk will not be closed or not contain all edges.

#include <lemon/euler.h>

Public Member Functions

 EulerIt (const GR &gr, typename GR::Node start=INVALID)
 Constructor.
 
 operator Arc () const
 Arc conversion.
 
 operator Edge () const
 Edge conversion.
 
bool operator== (Invalid) const
 Compare with INVALID.
 
bool operator!= (Invalid) const
 Compare with INVALID.
 
EulerItoperator++ ()
 Next arc of the tour.
 
Arc operator++ (int)
 Postfix incrementation.
 

Constructor & Destructor Documentation

EulerIt ( const GR &  gr,
typename GR::Node  start = INVALID 
)
inline

Constructor.

Parameters
grA graph.
startThe starting point of the tour. If it is not given, the tour will start from the first node that has an incident edge.

Member Function Documentation

EulerIt& operator++ ( )
inline

Next arc of the tour

Arc operator++ ( int  )
inline

Postfix incrementation.

Warning
This incrementation returns an Arc (which converts to an Edge), not an EulerIt, as one may expect.