EulerIt

Declared in lemon/euler.h, in the group Connectivity and Other Graph Properties; the same class on the Doxygen site.

template< typename GR >
class EulerIt

Euler tour iterator for graphs.

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.

Public Functions

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

Constructor.

Parameters:
  • gr – A graph.

  • start – The starting point of the tour. If it is not given, the tour will start from the first node that has an incident edge.

inline operator Arc() const

Arc conversion.

inline operator Edge() const

Edge conversion.

inline bool operator==(Invalid) const

Compare with INVALID.

inline bool operator!=(Invalid) const

Compare with INVALID.

inline EulerIt & operator++()

Next arc of the tour

inline Arc operator++(int)

Postfix incrementation.

Warning

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