Changeset 638:493533ead9df in lemon for lemon
- Timestamp:
- 04/15/09 11:41:25 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/euler.h
r633 r638 79 79 : g(gr), nedge(g) 80 80 { 81 if(start==INVALID) start=NodeIt(g); 82 for(NodeIt n(g);n!=INVALID;++n) nedge[n]=OutArcIt(g,n); 83 while(nedge[start]!=INVALID) { 84 euler.push_back(nedge[start]); 85 Node next=g.target(nedge[start]); 86 ++nedge[start]; 87 start=next; 81 if (start==INVALID) { 82 NodeIt n(g); 83 while (n!=INVALID && OutArcIt(g,n)==INVALID) ++n; 84 start=n; 85 } 86 if (start!=INVALID) { 87 for (NodeIt n(g); n!=INVALID; ++n) nedge[n]=OutArcIt(g,n); 88 while (nedge[start]!=INVALID) { 89 euler.push_back(nedge[start]); 90 Node next=g.target(nedge[start]); 91 ++nedge[start]; 92 start=next; 93 } 88 94 } 89 95 } … … 172 178 : g(gr), nedge(g), visited(g, false) 173 179 { 174 if(start==INVALID) start=NodeIt(g); 175 for(NodeIt n(g);n!=INVALID;++n) nedge[n]=OutArcIt(g,n); 176 while(nedge[start]!=INVALID) { 177 euler.push_back(nedge[start]); 178 visited[nedge[start]]=true; 179 Node next=g.target(nedge[start]); 180 ++nedge[start]; 181 start=next; 182 while(nedge[start]!=INVALID && visited[nedge[start]]) ++nedge[start]; 180 if (start==INVALID) { 181 NodeIt n(g); 182 while (n!=INVALID && OutArcIt(g,n)==INVALID) ++n; 183 start=n; 184 } 185 if (start!=INVALID) { 186 for (NodeIt n(g); n!=INVALID; ++n) nedge[n]=OutArcIt(g,n); 187 while(nedge[start]!=INVALID) { 188 euler.push_back(nedge[start]); 189 visited[nedge[start]]=true; 190 Node next=g.target(nedge[start]); 191 ++nedge[start]; 192 start=next; 193 while(nedge[start]!=INVALID && visited[nedge[start]]) ++nedge[start]; 194 } 183 195 } 184 196 }
Note: See TracChangeset
for help on using the changeset viewer.