lemon/smart_graph.h
changeset 2253 1645f6cc9667
parent 2190 dd887831e9c1
child 2256 b22dfb6c5ff3
equal deleted inserted replaced
31:2b26fff180cf 32:f637ef3324f5
   660     }
   660     }
   661   
   661   
   662     static int aNodeId(const Node& node) {
   662     static int aNodeId(const Node& node) {
   663       return node.id >> 1;
   663       return node.id >> 1;
   664     }
   664     }
   665     static Node fromANodeId(int id) {
   665     static Node nodeFromANodeId(int id) {
   666       return Node(id << 1);
   666       return Node(id << 1);
   667     }
   667     }
   668     int maxANodeId() const {
   668     int maxANodeId() const {
   669       return aNodes.size();
   669       return aNodes.size();
   670     }
   670     }
   671 
   671 
   672     static int bNodeId(const Node& node) {
   672     static int bNodeId(const Node& node) {
   673       return node.id >> 1;
   673       return node.id >> 1;
   674     }
   674     }
   675     static Node fromBNodeId(int id) {
   675     static Node nodeFromBNodeId(int id) {
   676       return Node((id << 1) + 1);
   676       return Node((id << 1) + 1);
   677     }
   677     }
   678     int maxBNodeId() const {
   678     int maxBNodeId() const {
   679       return bNodes.size();
   679       return bNodes.size();
   680     }
   680     }
   741     int uEdgeNum() const { return edges.size(); }
   741     int uEdgeNum() const { return edges.size(); }
   742 
   742 
   743   };
   743   };
   744 
   744 
   745 
   745 
   746   typedef BpUGraphExtender<SmartBpUGraphBase> ExtendedSmartBpUGraphBase;
   746   typedef BpUGraphExtender<BidirBpUGraphExtender<SmartBpUGraphBase> >
       
   747   ExtendedSmartBpUGraphBase;
   747 
   748 
   748   /// \ingroup graphs
   749   /// \ingroup graphs
   749   ///
   750   ///
   750   /// \brief A smart bipartite undirected graph class.
   751   /// \brief A smart bipartite undirected graph class.
   751   ///
   752   ///
   827 	aNodes[edges.back().aNode >> 1].first=edges.back().next_out;
   828 	aNodes[edges.back().aNode >> 1].first=edges.back().next_out;
   828 	bNodes[edges.back().bNode >> 1].first=edges.back().next_in;
   829 	bNodes[edges.back().bNode >> 1].first=edges.back().next_in;
   829 	edges.pop_back();
   830 	edges.pop_back();
   830       }
   831       }
   831       while(s.anode_num<aNodes.size()) {
   832       while(s.anode_num<aNodes.size()) {
   832         Node node = fromANodeId(aNodes.size() - 1);
   833         Node node = nodeFromANodeId(aNodes.size() - 1);
   833 	Parent::getNotifier(ANode()).erase(node);
   834 	Parent::getNotifier(ANode()).erase(node);
   834 	Parent::getNotifier(Node()).erase(node);
   835 	Parent::getNotifier(Node()).erase(node);
   835 	aNodes.pop_back();
   836 	aNodes.pop_back();
   836       }
   837       }
   837       while(s.bnode_num<bNodes.size()) {
   838       while(s.bnode_num<bNodes.size()) {
   838         Node node = fromBNodeId(bNodes.size() - 1);
   839         Node node = nodeFromBNodeId(bNodes.size() - 1);
   839 	Parent::getNotifier(BNode()).erase(node);
   840 	Parent::getNotifier(BNode()).erase(node);
   840 	Parent::getNotifier(Node()).erase(node);
   841 	Parent::getNotifier(Node()).erase(node);
   841 	bNodes.pop_back();
   842 	bNodes.pop_back();
   842       }
   843       }
   843     }    
   844     }