equal
deleted
inserted
replaced
28 |
28 |
29 ///Euler iterator in directed graphs. |
29 ///Euler iterator in directed graphs. |
30 |
30 |
31 /// \ingroup topology |
31 /// \ingroup topology |
32 ///This iterator converts to the \c Edge type of the graph and using |
32 ///This iterator converts to the \c Edge type of the graph and using |
33 ///the ++ operator it provides an Euler tour of the graph (if there exists). |
33 ///operator ++ it provides an Euler tour of the graph (if there exists). |
34 /// |
34 /// |
35 ///For example |
35 ///For example |
36 ///if the given graph if Euler (i.e it has only one nontrivial component |
36 ///if the given graph if Euler (i.e it has only one nontrivial component |
37 ///and the in-degree is equal to the out-degree for all nodes), |
37 ///and the in-degree is equal to the out-degree for all nodes), |
38 ///the the following code will print the edge IDs according to an |
38 ///the following code will print the edge IDs according to an |
39 ///Euler tour of \c g. |
39 ///Euler tour of \c g. |
40 ///\code |
40 ///\code |
41 /// for(EulerIt<ListGraph> e(g),e!=INVALID;++e) { |
41 /// for(EulerIt<ListGraph> e(g),e!=INVALID;++e) { |
42 /// std::cout << g.id(e) << std::eol; |
42 /// std::cout << g.id(e) << std::eol; |
43 /// } |
43 /// } |
62 |
62 |
63 ///Constructor |
63 ///Constructor |
64 |
64 |
65 ///\param _g A directed graph. |
65 ///\param _g A directed graph. |
66 ///\param start The starting point of the tour. If it is not given |
66 ///\param start The starting point of the tour. If it is not given |
67 /// tho tour will start from the first node. |
67 /// the tour will start from the first node. |
68 EulerIt(const Graph &_g,typename Graph::Node start=INVALID) |
68 EulerIt(const Graph &_g,typename Graph::Node start=INVALID) |
69 : g(_g), nedge(g) |
69 : g(_g), nedge(g) |
70 { |
70 { |
71 if(start==INVALID) start=NodeIt(g); |
71 if(start==INVALID) start=NodeIt(g); |
72 for(NodeIt n(g);n!=INVALID;++n) nedge[n]=OutEdgeIt(g,n); |
72 for(NodeIt n(g);n!=INVALID;++n) nedge[n]=OutEdgeIt(g,n); |
98 } |
98 } |
99 return *this; |
99 return *this; |
100 } |
100 } |
101 ///Postfix incrementation |
101 ///Postfix incrementation |
102 |
102 |
103 ///\warning This gives back an Edge, not an EulerIt! |
103 ///\warning This incrementation |
|
104 ///returns an \c Edge, not an \ref EulerIt, as one may |
|
105 ///expect. |
104 Edge operator++(int) |
106 Edge operator++(int) |
105 { |
107 { |
106 Edge e=*this; |
108 Edge e=*this; |
107 ++(*this); |
109 ++(*this); |
108 return e; |
110 return e; |