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 . | |
EulerIt & | operator++ () |
Next arc of the tour. | |
Arc | operator++ (int) |
Postfix incrementation. |
Constructor.
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. |
EulerIt& operator++ | ( | ) | [inline] |
Next arc of the tour
Arc operator++ | ( | int | ) | [inline] |
Postfix incrementation.
Arc
(which converts to an Edge
), not an EulerIt, as one may expect.