Changeset 2076:10681ee9d8ae in lemon-0.x for lemon/full_graph.h
- Timestamp:
- 05/12/06 11:51:45 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2739
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/full_graph.h
r2061 r2076 442 442 }; 443 443 444 typedef UGraphExtender<U GraphBaseExtender<FullUGraphBase> >444 typedef UGraphExtender<UndirGraphExtender<FullUGraphBase> > 445 445 ExtendedFullUGraphBase; 446 446 … … 519 519 }; 520 520 521 class Edge {521 class UEdge { 522 522 friend class FullBpUGraphBase; 523 523 protected: 524 524 int id; 525 525 526 Edge(int _id) { id = _id;}526 UEdge(int _id) { id = _id;} 527 527 public: 528 Edge() {}529 Edge (Invalid) { id = -1; }530 bool operator==(const Edge i) const {return id==i.id;}531 bool operator!=(const Edge i) const {return id!=i.id;}532 bool operator<(const Edge i) const {return id<i.id;}528 UEdge() {} 529 UEdge (Invalid) { id = -1; } 530 bool operator==(const UEdge i) const {return id==i.id;} 531 bool operator!=(const UEdge i) const {return id!=i.id;} 532 bool operator<(const UEdge i) const {return id<i.id;} 533 533 }; 534 534 … … 569 569 } 570 570 571 void first( Edge& edge) const {571 void first(UEdge& edge) const { 572 572 edge.id = _edgeNum - 1; 573 573 } 574 void next( Edge& edge) const {574 void next(UEdge& edge) const { 575 575 --edge.id; 576 576 } 577 577 578 void first Out(Edge& edge, const Node& node) const {578 void firstFromANode(UEdge& edge, const Node& node) const { 579 579 LEMON_ASSERT((node.id & 1) == 0, NodeSetError()); 580 580 edge.id = (node.id >> 1) * _bNodeNum; 581 581 } 582 void next Out(Edge& edge) const {582 void nextFromANode(UEdge& edge) const { 583 583 ++(edge.id); 584 584 if (edge.id % _bNodeNum == 0) edge.id = -1; 585 585 } 586 586 587 void first In(Edge& edge, const Node& node) const {587 void firstFromBNode(UEdge& edge, const Node& node) const { 588 588 LEMON_ASSERT((node.id & 1) == 1, NodeSetError()); 589 589 edge.id = (node.id >> 1); 590 590 } 591 void next In(Edge& edge) const {591 void nextFromBNode(UEdge& edge) const { 592 592 edge.id += _bNodeNum; 593 593 if (edge.id >= _edgeNum) edge.id = -1; … … 605 605 } 606 606 607 static int id(const Edge& edge) {607 static int id(const UEdge& edge) { 608 608 return edge.id; 609 609 } 610 static Edge edgeFromId(int id) {611 return Edge(id);612 } 613 int max EdgeId() const {610 static UEdge uEdgeFromId(int id) { 611 return UEdge(id); 612 } 613 int maxUEdgeId() const { 614 614 return _edgeNum - 1; 615 615 } … … 635 635 } 636 636 637 Node aNode(const Edge& edge) const {637 Node aNode(const UEdge& edge) const { 638 638 return Node((edge.id / _bNodeNum) << 1); 639 639 } 640 Node bNode(const Edge& edge) const {640 Node bNode(const UEdge& edge) const { 641 641 return Node(((edge.id % _bNodeNum) << 1) + 1); 642 642 } … … 664 664 665 665 typedef True EdgeNumTag; 666 int edgeNum() const { return _edgeNum; }666 int uEdgeNum() const { return _edgeNum; } 667 667 668 668 }; 669 669 670 670 671 typedef BpUGraphExtender< BpUGraphBaseExtender< 672 FullBpUGraphBase> > ExtendedFullBpUGraphBase; 671 typedef BpUGraphExtender<FullBpUGraphBase> ExtendedFullBpUGraphBase; 673 672 674 673
Note: See TracChangeset
for help on using the changeset viewer.