Changeset 239:3f76d1aa9d37 in lemon-0.x for src/work/marci/graph_wrapper.h
- Timestamp:
- 03/23/04 14:47:31 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@337
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/graph_wrapper.h
r238 r239 541 541 if (out_or_in) return(out); else return(in); 542 542 } 543 //FIXME 544 //2 edges are equal if they "refer" to the same physical edge 545 //is it good? 543 546 friend bool operator==(const Edge& u, const Edge& v) { 544 547 if (v.out_or_in) 545 return (u.out_or_in && u.out==v.out); 548 if (u.out_or_in) return (u.out==v.out); else return (u.out==v.in); 549 //return (u.out_or_in && u.out==v.out); 546 550 else 547 return (!u.out_or_in && u.in==v.in); 551 if (u.out_or_in) return (u.out==v.in); else return (u.in==v.in); 552 //return (!u.out_or_in && u.in==v.in); 548 553 } 549 554 friend bool operator!=(const Edge& u, const Edge& v) { 550 555 if (v.out_or_in) 551 return (!u.out_or_in || u.out!=v.out); 556 if (u.out_or_in) return (u.out!=v.out); else return (u.out!=v.in); 557 //return (!u.out_or_in || u.out!=v.out); 552 558 else 553 return (u.out_or_in || u.in!=v.in); 559 if (u.out_or_in) return (u.out!=v.in); else return (u.in!=v.in); 560 //return (u.out_or_in || u.in!=v.in); 554 561 } 555 562 }; … … 562 569 OutEdgeIt(const UndirGraphWrapper<GraphWrapper>& _G, const Node& n) 563 570 : Edge() { 564 out_or_in=true; 565 _G.gw.first(out, n); 566 if (!(_G.gw.valid(out))) { 567 out_or_in=false; 568 _G.gw.first(in, n); 569 } 571 out_or_in=true; _G.gw.first(out, n); 572 if (!(_G.gw.valid(out))) { out_or_in=false; _G.gw.first(in, n); } 570 573 } 571 574 }; … … 594 597 595 598 OutEdgeIt& first(OutEdgeIt& e, const Node& n) const { 596 e.out_or_in=true; 597 gw.first(e.out, n); 598 if (!(gw.valid(e.out))) { 599 e.out_or_in=false; 600 gw.first(e.in, n); 601 } 599 e.out_or_in=true; gw.first(e.out, n); 600 if (!(gw.valid(e.out))) { e.out_or_in=false; gw.first(e.in, n); } 602 601 return e; 603 602 } … … 623 622 Node n=gw.tail(e.out); 624 623 gw.next(e.out); 625 if (!gw.valid(e.out)) { 626 e.out_or_in=false; 627 gw.first(e.in, n); 628 } 624 if (!gw.valid(e.out)) { e.out_or_in=false; gw.first(e.in, n); } 629 625 } else { 630 626 gw.next(e.in); … … 644 640 645 641 template<typename I> I& next(I &i) const { return gw.next(i); } 646 647 template<typename I> I getNext(const I& i) const { 648 return gw.getNext(i); } 642 template<typename I> I getNext(const I& i) const { return gw.getNext(i); } 649 643 650 644 template< typename It > It first() const {
Note: See TracChangeset
for help on using the changeset viewer.