104 EdgeIterator() {;} //Kell inicializalni? (Nem) |
104 EdgeIterator() {;} //Kell inicializalni? (Nem) |
105 EdgeIterator(const EdgeIterator &i) {G=i.G;e=i.e;} |
105 EdgeIterator(const EdgeIterator &i) {G=i.G;e=i.e;} |
106 |
106 |
107 // Lehet, hogy ez a ketto nem kell!!! |
107 // Lehet, hogy ez a ketto nem kell!!! |
108 |
108 |
109 NodeIterator tail() const {NodeIterator i;i.G=G;i.n=e->From();return i;} |
109 NodeIterator source() const {NodeIterator i;i.G=G;i.n=e->From();return i;} |
110 NodeIterator head() const {NodeIterator i;i.G=G;i.n=e->To();return i;} |
110 NodeIterator target() const {NodeIterator i;i.G=G;i.n=e->To();return i;} |
111 NodeIterator opposite(const NodeIterator &n) const |
111 NodeIterator opposite(const NodeIterator &n) const |
112 {return n==tail()?head():tail();} |
112 {return n==source()?target():source();} |
113 |
113 |
114 bool valid() {return e;} |
114 bool valid() {return e;} |
115 E &operator*() const { return G->Data(e); } |
115 E &operator*() const { return G->Data(e); } |
116 E *operator->() const { return &G->Data(e); } |
116 E *operator->() const { return &G->Data(e); } |
117 |
117 |
188 OutEdgeIterator next() const {return OutEdgeIterator(*this).goNext();} |
188 OutEdgeIterator next() const {return OutEdgeIterator(*this).goNext();} |
189 OutEdgeIterator &operator++() { return goNext();} |
189 OutEdgeIterator &operator++() { return goNext();} |
190 OutEdgeIterator operator++(int) |
190 OutEdgeIterator operator++(int) |
191 {OutEdgeIterator tmp(*this); goNext(); return tmp;} |
191 {OutEdgeIterator tmp(*this); goNext(); return tmp;} |
192 |
192 |
193 NodeIterator aNode() const {return tail();} |
193 NodeIterator aNode() const {return source();} |
194 NodeIterator bNode() const {return head();} |
194 NodeIterator bNode() const {return target();} |
195 |
195 |
196 operator const InEdgeIterator () |
196 operator const InEdgeIterator () |
197 {InEdgeIterator i; i.G=G;i.e=e;return i;} |
197 {InEdgeIterator i; i.G=G;i.e=e;return i;} |
198 operator const BiEdgeIterator () |
198 operator const BiEdgeIterator () |
199 {BiEdgeIterator i; i.G=G;i.e=e;return i;} |
199 {BiEdgeIterator i; i.G=G;i.e=e;return i;} |
216 SymEdgeIterator &operator++() { return goNext();} |
216 SymEdgeIterator &operator++() { return goNext();} |
217 SymEdgeIterator operator++(int) |
217 SymEdgeIterator operator++(int) |
218 {SymEdgeIterator tmp(*this); goNext(); return tmp;} |
218 {SymEdgeIterator tmp(*this); goNext(); return tmp;} |
219 |
219 |
220 NodeIterator aNode() const {return n;} |
220 NodeIterator aNode() const {return n;} |
221 NodeIterator bNode() const {return n.n==tail().n?head():tail();} |
221 NodeIterator bNode() const {return n.n==source().n?target():source();} |
222 |
222 |
223 operator const InEdgeIterator () |
223 operator const InEdgeIterator () |
224 {InEdgeIterator i; i.G=G;i.e=e;return i;} |
224 {InEdgeIterator i; i.G=G;i.e=e;return i;} |
225 operator const OutEdgeIterator () |
225 operator const OutEdgeIterator () |
226 {OutEdgeIterator i; i.G=G;i.e=e;return i;} |
226 {OutEdgeIterator i; i.G=G;i.e=e;return i;} |
252 EachEdgeIterator operator++(int) |
252 EachEdgeIterator operator++(int) |
253 {EachEdgeIterator tmp(*this); goNext(); return tmp;} |
253 {EachEdgeIterator tmp(*this); goNext(); return tmp;} |
254 |
254 |
255 |
255 |
256 NodeIterator aNode() const {return n;} |
256 NodeIterator aNode() const {return n;} |
257 NodeIterator bNode() const {return n.n==tail().n?head():tail();} |
257 NodeIterator bNode() const {return n.n==source().n?target():source();} |
258 |
258 |
259 operator const EdgeIterator () |
259 operator const EdgeIterator () |
260 {EdgeIterator i; i.G=G;i.e=e;return i;} |
260 {EdgeIterator i; i.G=G;i.e=e;return i;} |
261 operator const InEdgeIterator () |
261 operator const InEdgeIterator () |
262 {InEdgeIterator i; i.G=G;i.e=e;return i;} |
262 {InEdgeIterator i; i.G=G;i.e=e;return i;} |
461 int getLength() { return path.size(); } |
461 int getLength() { return path.size(); } |
462 EdgeIterator &operator[](int n) {return path[n];} |
462 EdgeIterator &operator[](int n) {return path[n];} |
463 NodeIterator GetNode(int n) // What about path of length 1? |
463 NodeIterator GetNode(int n) // What about path of length 1? |
464 { |
464 { |
465 return n? |
465 return n? |
466 reversed[n-1]?path[n-1].tail():path[n-1].head(): |
466 reversed[n-1]?path[n-1].source():path[n-1].target(): |
467 reversed[0]?path[0].head():path[0].tail(); |
467 reversed[0]?path[0].target():path[0].source(); |
468 } |
468 } |
469 void setRevert(int n,bool r=true) {reversed[n]=r;} |
469 void setRevert(int n,bool r=true) {reversed[n]=r;} |
470 void setEdge(int n,SymEdgeIterator i) |
470 void setEdge(int n,SymEdgeIterator i) |
471 { |
471 { |
472 path[n]=i; |
472 path[n]=i; |
473 reversed[n] = i.head()==i.aNode(); |
473 reversed[n] = i.target()==i.aNode(); |
474 } |
474 } |
475 void setEdge(int n,EdgeIterator i,bool r) |
475 void setEdge(int n,EdgeIterator i,bool r) |
476 { |
476 { |
477 path[n]=i; |
477 path[n]=i; |
478 reversed[n] = r; |
478 reversed[n] = r; |
479 } |
479 } |
480 |
480 |
481 NodeIterator tail() { return getNode(0); } |
481 NodeIterator source() { return getNode(0); } |
482 NodeIterator head() { return getNode(getLength()); } |
482 NodeIterator target() { return getNode(getLength()); } |
483 }; |
483 }; |
484 |
484 |
485 /* Ez itt a fiam kommentje: |
485 /* Ez itt a fiam kommentje: |
486 <v n nnnnnnnnnnnnnncncccccccccccccccccvvvvvv |
486 <v n nnnnnnnnnnnnnncncccccccccccccccccvvvvvv |
487 vvnvnvnvnvnvvnnvnvnvnnvnbbbvfffffvvffffffffffffffffffffz |
487 vvnvnvnvnvnvvnnvnvnvnnvnbbbvfffffvvffffffffffffffffffffz |