# HG changeset patch # User alpar # Date 1181041046 0 # Node ID aaf5787f4d5d3cf31391299a6f9274ab3c6d8ca6 # Parent 06f3702bf18d9d8f1f69db3f340690ae8e3ca6f9 - Fix a serious bug in UEulerIt - Add a conversion to UEdge - Make some member funtions to be 'const' diff -r 06f3702bf18d -r aaf5787f4d5d lemon/euler.h --- a/lemon/euler.h Fri May 11 16:03:20 2007 +0000 +++ b/lemon/euler.h Tue Jun 05 10:57:26 2007 +0000 @@ -149,6 +149,7 @@ typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Edge Edge; + typedef typename Graph::UEdge UEdge; typedef typename Graph::EdgeIt EdgeIt; typedef typename Graph::OutEdgeIt OutEdgeIt; typedef typename Graph::InEdgeIt InEdgeIt; @@ -172,16 +173,22 @@ for(NodeIt n(g);n!=INVALID;++n) nedge[n]=OutEdgeIt(g,n); while(nedge[start]!=INVALID) { euler.push_back(nedge[start]); + visited[nedge[start]]=true; Node next=g.target(nedge[start]); ++nedge[start]; - start=next; while(nedge[start]!=INVALID && visited[nedge[start]]) ++nedge[start]; + start=next; + while(nedge[start]!=INVALID && visited[nedge[start]]) ++nedge[start]; } } ///Edge Conversion - operator Edge() { return euler.empty()?INVALID:euler.front(); } - bool operator==(Invalid) { return euler.empty(); } - bool operator!=(Invalid) { return !euler.empty(); } + operator Edge() const { return euler.empty()?INVALID:euler.front(); } + ///Edge Conversion + operator UEdge() const { return euler.empty()?INVALID:euler.front(); } + ///\e + bool operator==(Invalid) const { return euler.empty(); } + ///\e + bool operator!=(Invalid) const { return !euler.empty(); } ///Next edge of the tour UEulerIt &operator++() { @@ -194,6 +201,7 @@ if(nedge[s]==INVALID) break; else { euler.insert(next,nedge[s]); + visited[nedge[s]]=true; Node n=g.target(nedge[s]); ++nedge[s]; s=n;